Liferay: Any method written in *LocalServiceImpl n

2019-08-25 08:32发布

Any method I write in *LocalServiceImpl is not found in *LocalServiceUtil. I re-run service builder every time and nothing. The methods are recognized on local server but not found in production server. All old methods are working, just new written methods are not found. What could be the problem? Thanks. I am using Liferay 6.1.1 GA2 on both servers.

this is my service builder log

     [echo] Loading jar:file:/C:/sbl-workspace-1/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/system.properties
     [echo] 28.11.2013 08:30:46 com.liferay.portal.kernel.log.Jdk14LogImpl info
     [echo] INFO: Global shared lib directory /C:/sbl-workspace-1-plugins-sdk/liferay-plugins-sdk-6.1.1/lib/
     [echo] 28.11.2013 08:30:46 com.liferay.portal.kernel.log.Jdk14LogImpl info
     [echo] INFO: Global lib directory /C:/sbl-workspace-1/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/lib/ext/
     [echo] 28.11.2013 08:30:46 com.liferay.portal.kernel.log.Jdk14LogImpl info
     [echo] INFO: Portal lib directory /C:/sbl-workspace-1/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/
     [echo] 28.11.2013 08:30:47 com.liferay.portal.kernel.log.Jdk14LogImpl info
     [echo] INFO: Properties for portal loaded from [file:/C:/sbl-workspace-1/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/classes/portal-ext.properties, jar:file:/C:/sbl-workspace-1/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/com/liferay/portal/tools/dependencies/portal-tools.properties, jar:file:/C:/sbl-workspace-1/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties]
     [echo] Loading jar:file:/C:/sbl-workspace-1/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties
     [echo] Loading jar:file:/C:/sbl-workspace-1/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/com/liferay/portal/tools/dependencies/portal-tools.properties
     [echo] Loading file:/C:/sbl-workspace-1/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/classes/portal-ext.properties
     [echo] Building Menus
     [echo] Building MenusImages
     [echo] Building Sections
    [mkdir] Created dir: C:\sbl-workspace-1-plugins-sdk\liferay-plugins-sdk-6.1.1\portlets\AdminSBL-portlet\docroot\WEB-INF\service-classes
    compile-java:
     [copy] Copied 65 empty directories to 65 empty directories under C:\sbl-workspace-1-plugins-sdk\liferay-plugins-sdk-6.1.1\portlets\AdminSBL-portlet\docroot\WEB-INF\service-classes
    [javac] Compiling 398 source files to C:\sbl-workspace-1-plugins-sdk\liferay-plugins-sdk-6.1.1\portlets\AdminSBL-portlet\docroot\WEB-INF\service-classes
      [zip] Building zip: C:\sbl-workspace-1-plugins-sdk\liferay-plugins-sdk-6.1.1\portlets\AdminSBL-portlet\docroot\WEB-INF\lib\AdminSBL-portlet-service.jar
      [delete] Deleting directory C:\sbl-workspace-1-plugins-sdk\liferay-plugins-sdk-6.1.1\portlets\AdminSBL-portlet\docroot\WEB-INF\service-classes
      BUILD SUCCESSFUL
      Total time: 37 seconds

SOLVED:It worked like yannicular and Pankaj Kathiriya said. Thanks.....

4条回答
Rolldiameter
2楼-- · 2019-08-25 09:19

This is an old problem but still doesn't have an accepted answer. As this question mentioned this old problem it came to my attention. In case somebody else stumbles upon it, here's a late guess on what might have gone wrong (from my answer to the other question):

First of all: Check the sourcecode for your *LocalServiceUtil and make sure it really doesn't have the method's implementation. If the method is there, you'll have to look elsewhere. Here's where:

When you deploy a portlet, you can get the API on multiple ways: Someone might have deployed the plugin containing the services on tomcat's global class path. If you don't update that one, you probably won't see your updates.

Also, someone might have copied an older version of your plugin into their own plugin as well - naturally not seeing any updates unless they update their dependency. Check for changed names of the jar file as well. Also check for the classes: Some people like to add the compiled java classes to their source directories, ending up with two different implementations of the same code.

查看更多
3楼-- · 2019-08-25 09:24

Could you Check the visibility of your methods: are they public ?

Service builder only creates *LocalServiceUtil methods for the public methods of *LocalServiceImpl.

It would be useful to see the your *LocalServiceImpl method to try to understand what is happening.

查看更多
Melony?
4楼-- · 2019-08-25 09:26

Most probably, your service-build is failing. You can still see the old methods, because you are still using the old .jar, the last one that was successfully built. My advice is to check the build-service log and find the error that's failing the service-build task

Edit: Sometimes, conflicts from the Portal Deployment mechanism, or dynamic Class loading could lead to load Classes from an old service jar. If you are sure that your webapp is legit but the deployment fails, a fail-safe procedure to make sure you are deploying your application is:

  1. Shut down the Portal
  2. Delete the app folder from portal webapps.
  3. Delete the app folder from work/Catalina/localhost
  4. Copy your fresh webapp into /deploy and start the portal.

Bonus hint: If you are deploying into a running remote Portal, it's nice to copy your .war into the remote system, and then move it to the /deploy Folder. Else, if your connection is slow the deployment could start before the .war transfer is complete, the delpoyment fails and your app stays black-listed until you restart your tomcat

查看更多
成全新的幸福
5楼-- · 2019-08-25 09:29

Well you should delete the service.jar which gets created when you build service. Now again build the service.xml and check your methods will be populated under util class.

Try putting that .jar file under your Tomcat_home\lib\ext if it is being shared by multiple portlets.

查看更多
登录 后发表回答