<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>how to refresh module</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121277295" />
  <subtitle>how to refresh module</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121277295</id>
  <updated>2026-04-06T09:18:45Z</updated>
  <dc:date>2026-04-06T09:18:45Z</dc:date>
  <entry>
    <title>RE: RE: how to refresh module</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121278351" />
    <author>
      <name>Scarletake Bwi</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121278351</id>
    <updated>2021-12-02T01:22:34Z</updated>
    <published>2021-12-02T01:22:34Z</published>
    <summary type="html">&lt;p&gt;hi Olaf&lt;/p&gt;
&lt;p&gt;thank you.&lt;/p&gt;
&lt;p&gt;i try make this class a @Component, wire it through @Reference.&lt;/p&gt;
&lt;p&gt;if fail when i use &lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;@Component(
		immediate=true,
		service = EnosixRest.class
		)
public class EnosixRest {&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;&amp;gt; Task :modules:Enosix-api:jar FAILED
error  : [com.ci.enosix.api.EnosixRest] The component is not assignable to specified service javax.portlet.Portlet&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;my module is not a service-builder module, it's a just api-module.&lt;/p&gt;
&lt;p&gt;is there any passable to use @Component in my case?&lt;/p&gt;
&lt;p&gt;and, i own the servcer, is there any passabe, i can delete temp or
  somthing, force it build and deploy newest version?&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;thank you&lt;/p&gt;</summary>
    <dc:creator>Scarletake Bwi</dc:creator>
    <dc:date>2021-12-02T01:22:34Z</dc:date>
  </entry>
  <entry>
    <title>RE: how to refresh module</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121277995" />
    <author>
      <name>Olaf Kock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121277995</id>
    <updated>2021-12-01T14:17:45Z</updated>
    <published>2021-12-01T14:17:44Z</published>
    <summary type="html">&lt;p&gt;The class you post is a standard class, not a @Component. I'm
  &lt;em&gt;assuming&lt;/em&gt; you're creating it with something like&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java hljs"&gt;&lt;span class="hljs-class"&gt;&lt;span class="hljs-title"&gt;EnosixRest enosixRest = new EnosixRest();&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;This would create an object, tied to the class loaded once. And even
  if you now deploy a new module (through OSGi), it wouldn't magically
  replace the implementation. Rather, this would eliminate the
  possibility for the Garbage Collector to get rid of the old class, and
  object. OSGi can't do that magically for you.&lt;/p&gt;
&lt;p&gt;Suggestion: Make this class a @Component, wire it through @Reference.
  That reference will automatically update and create a new object
  whenever you deploy the module again.&lt;/p&gt;</summary>
    <dc:creator>Olaf Kock</dc:creator>
    <dc:date>2021-12-01T14:17:44Z</dc:date>
  </entry>
  <entry>
    <title>RE: RE: how to refresh module</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121277478" />
    <author>
      <name>Scarletake Bwi</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121277478</id>
    <updated>2021-12-01T09:05:06Z</updated>
    <published>2021-12-01T09:05:05Z</published>
    <summary type="html">&lt;p&gt;hi Olaf&lt;/p&gt;
&lt;p&gt;sure&lt;/p&gt;
&lt;p&gt;my class of api module&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;package com.ci.enosix.api;

import com.liferay.petra.string.StringPool;
import com.liferay.portal.kernel.json.JSONArray;
import com.liferay.portal.kernel.json.JSONFactoryUtil;
import com.liferay.portal.kernel.json.JSONObject;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.raritan.ci.enosix.constant.Constant;
import com.raritan.ci.enosix.vo.VendorContactVO;
import com.raritan.ci.enosix.vo.VendorVO;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;

public class EnosixRest {
	private static Log LOGGER = LogFactoryUtil.getLog(EnosixRest.class);

	private HttpPost setPostAuthorization(HttpPost httpPost) {
		httpPost.addHeader(&amp;quot;Authorization&amp;quot;, Constant.ENCODED_AUTHORIZATION());
		httpPost.addHeader(&amp;quot;Content-Type&amp;quot;, &amp;quot;text/json&amp;quot;);
		return httpPost;
	}

	private HttpGet setGetAuthorization(HttpGet httpGet) {
		httpGet.setHeader(&amp;quot;Authorization&amp;quot;, Constant.ENCODED_AUTHORIZATION());
		return httpGet;
	}

	

	private void loadContact(HttpClient client, VendorVO vendor) throws Exception {
		HttpResponse responseDetail = client.execute(this.setGetAuthorization(new HttpGet(Constant.REST_VENDOR_DETAIL(vendor.getVendorCode()))));
		if (responseDetail.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject responseJson = JSONFactoryUtil.createJSONObject(EntityUtils.toString(responseDetail.getEntity()));
			boolean success = responseJson.getBoolean(&amp;quot;success&amp;quot;);
			if (success) {
				if (vendor.getVendorName() == null || vendor.getVendorName().trim().length() == 0) {
					vendor.setVendorName(responseJson.getString(&amp;quot;name&amp;quot;));
				}
				JSONArray jsonArrayKnvK = responseJson.getJSONObject(&amp;quot;results&amp;quot;).getJSONArray(&amp;quot;knvK_TAB&amp;quot;);
				for (int i = 0; i &amp;lt; jsonArrayKnvK.length(); i++) {
					JSONObject detailJson = jsonArrayKnvK.getJSONObject(i);
					int contactPersonNumber = detailJson.getInt(&amp;quot;contactPersonNumber&amp;quot;);

					HttpResponse responsePartner = client.execute(this.setGetAuthorization(new HttpGet(Constant.REST_PARTNER_DETAIL(contactPersonNumber))));
					if (responseDetail.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
						JSONObject responsePartnerJson = JSONFactoryUtil.createJSONObject(EntityUtils.toString(responsePartner.getEntity()));
						LOGGER.info(responsePartnerJson.toString());
						vendor.addContact(new VendorContactVO(contactPersonNumber, detailJson.getString(&amp;quot;firstName&amp;quot;), detailJson.getString(&amp;quot;name&amp;quot;), detailJson.getInt(&amp;quot;function&amp;quot;)));
						LOGGER.info(contactPersonNumber + detailJson.getString(&amp;quot;firstName&amp;quot;));
					}
				}
			}
		} else {
			LOGGER.error(responseDetail.getStatusLine());
		}

	}

	public VendorVO getVendor(String vendorCode) throws Exception {
		HttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(Constant.CREDENTIAL_PROVIDER()).build();
		VendorVO vendor = new VendorVO(vendorCode, null);
		this.loadContact(client, vendor);
		return vendor;
	}


}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;bnd.bnd of my api-module&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;Bundle-Name: Enosix-api
Bundle-SymbolicName: com.raritan.ci.enosix
Bundle-Version: 1.0.0
Export-Package: \
    com.ci.enosix.api,\
    com.ci.enosix.vo
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;my build.gradle of mvc-module&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;dependencies {
	compileOnly group: &amp;quot;com.liferay.portal&amp;quot;, name: &amp;quot;release.portal.api&amp;quot;

	cssBuilder group: &amp;quot;com.liferay&amp;quot;, name: &amp;quot;com.liferay.css.builder&amp;quot;, version: &amp;quot;3.0.2&amp;quot;
	compileOnly project(&amp;quot;:modules:CI-Constant-api&amp;quot;)
	compileOnly project(&amp;quot;:modules:CI-CommonUtil-api&amp;quot;)
	compileOnly project(&amp;quot;:modules:CI-PoiUtil-api&amp;quot;)

	compileOnly project(&amp;quot;:modules:Enosix-api&amp;quot;)


}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;because i run server via liferay-studeo, always, after i modify code
  and save it, it will auto deploy and work. i don't even need to
  redeploy or build from gradle tasks.&lt;/p&gt;</summary>
    <dc:creator>Scarletake Bwi</dc:creator>
    <dc:date>2021-12-01T09:05:05Z</dc:date>
  </entry>
  <entry>
    <title>RE: how to refresh module</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121277450" />
    <author>
      <name>Olaf Kock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121277450</id>
    <updated>2021-12-01T08:45:10Z</updated>
    <published>2021-12-01T08:45:09Z</published>
    <summary type="html">&lt;p&gt;Can you show the full class, or better a minimal full sample with
  steps to reproduce?&lt;/p&gt;
&lt;p&gt;If the problem is related to OSGi classloading, a single line won't
  help spot the problem.&lt;/p&gt;
&lt;p&gt;An approach might be to move the logging out of the API module into
  an implementation module.&lt;/p&gt;</summary>
    <dc:creator>Olaf Kock</dc:creator>
    <dc:date>2021-12-01T08:45:09Z</dc:date>
  </entry>
  <entry>
    <title>how to refresh module</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121277294" />
    <author>
      <name>Scarletake Bwi</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121277294</id>
    <updated>2021-12-01T06:43:34Z</updated>
    <published>2021-12-01T06:43:32Z</published>
    <summary type="html">&lt;p&gt;hi &lt;/p&gt;
&lt;p&gt;i use liferay 7.4.3&lt;/p&gt;
&lt;p&gt;i create a api module, and it be use in a mvc-module.&lt;/p&gt;
&lt;p&gt;but, my api's log always cannot print out in console. i use
  liferay-studio to run server up.&lt;/p&gt;
&lt;pre&gt;
&lt;code class="language-java"&gt;private static Log LOGGER = LogFactoryUtil.getLog(MyAPI.class);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;even i add log level category in Server Administration.&lt;/p&gt;
&lt;p&gt;i found that may because the module not refresh, it still keep in old verion.&lt;/p&gt;
&lt;p&gt;sometimes, i change compileOnly to compile in build.gradle, it will
  refresh to newest verion. &lt;/p&gt;
&lt;p&gt;what is the standard process to deploy after i modify my api?&lt;/p&gt;
&lt;p&gt;thank you in advance.&lt;/p&gt;</summary>
    <dc:creator>Scarletake Bwi</dc:creator>
    <dc:date>2021-12-01T06:43:32Z</dc:date>
  </entry>
</feed>
