RE: Error while deploying portlet with remote service

francesco patanè, modified 8 Years ago. New Member Posts: 3 Join Date: 1/11/17 Recent Posts
Hello to all.

I'm using plugins sdk 6.2 with a portal 6.2 ga 5 bundled with tomcat 7.0.62

I tried to create a portlet with remote service, but when i try to deploy i get an error during the jsonws registration and i can't see it in the context paths in api/jsonws.

I followed the tutorial in the documentation.

the error is the following

Loading file:/C:/sviluppo/LT-Hipersonic/liferay-portal-6.2-ce-ga5/tomcat-7.0.62/temp/9-PWS-portlet/WEB-INF/classes/service.properties
Loading file:/C:/sviluppo/LT-Hipersonic/liferay-portal-6.2-ce-ga5/tomcat-7.0.62/temp/9-PWS-portlet/WEB-INF/classes/service.properties
16:33:55,624 ERROR [localhost-startStop-20][MethodParametersResolverImpl:59] java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
at jodd.asm4.ClassReader.<init>(ClassReader.java:170)
at jodd.asm4.ClassReader.<init>(ClassReader.java:153)
at jodd.asm4.ClassReader.<init>(ClassReader.java:424)
at jodd.paramo.Paramo.resolveParameters(Paramo.java:59)
at com.liferay.portal.util.MethodParametersResolverImpl.resolveMethodParameters(MethodParametersResolverImpl.java:47)
at com.liferay.portal.kernel.util.MethodParametersResolverUtil.resolveMethodParameters(MethodParametersResolverUtil.java:34)
at com.liferay.portal.jsonwebservice.JSONWebServiceActionConfig.<init>(JSONWebServiceActionConfig.java:44)
at com.liferay.portal.jsonwebservice.JSONWebServiceActionConfig.<init>(JSONWebServiceActionConfig.java:66)
at com.liferay.portal.jsonwebservice.JSONWebServiceActionsManagerImpl.registerJSONWebServiceAction(JSONWebServiceActionsManagerImpl.java:275)
at com.liferay.portal.kernel.jsonwebservice.JSONWebServiceActionsManagerUtil.registerJSONWebServiceAction(JSONWebServiceActionsManagerUtil.java:92)
at com.liferay.portal.jsonwebservice.JSONWebServiceRegistrator.registerJSONWebServiceAction(JSONWebServiceRegistrator.java:261)
at com.liferay.portal.jsonwebservice.JSONWebServiceRegistrator.onJSONWebServiceBean(JSONWebServiceRegistrator.java:195)
at com.liferay.portal.jsonwebservice.JSONWebServiceRegistrator.processBean(JSONWebServiceRegistrator.java:93)
at com.liferay.portal.jsonwebservice.JSONWebServiceRegistrator.processAllBeans(JSONWebServiceRegistrator.java:68)
at com.liferay.portal.jsonwebservice.JSONWebServiceActionsManagerImpl.registerServletContext(JSONWebServiceActionsManagerImpl.java:332)
at com.liferay.portal.jsonwebservice.JSONWebServiceActionsManagerImpl.registerServletContext(JSONWebServiceActionsManagerImpl.java:296)
at com.liferay.portal.kernel.jsonwebservice.JSONWebServiceActionsManagerUtil.registerServletContext(JSONWebServiceActionsManagerUtil.java:97)
at com.liferay.portal.deploy.hot.JSONWebServiceHotDeployListener.doInvokeDeploy(JSONWebServiceHotDeployListener.java:66)
at com.liferay.portal.deploy.hot.JSONWebServiceHotDeployListener.invokeDeploy(JSONWebServiceHotDeployListener.java:34)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:230)
at com.liferay.portal.deploy.hot.HotDeployImpl.fireDeployEvent(HotDeployImpl.java:96)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:28)
at com.liferay.portal.kernel.servlet.PluginContextListener.fireDeployEvent(PluginContextListener.java:164)
at com.liferay.portal.kernel.servlet.PluginContextListener.doPortalInit(PluginContextListener.java:154)
at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:44)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:74)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:58)
at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:54)
at com.liferay.portal.kernel.servlet.PluginContextListener.contextInitialized(PluginContextListener.java:116)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5528)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1948)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
16:33:55,624 ERROR [localhost-startStop-20][JSONWebServiceRegistrator:96] java.lang.NullPointerException
java.lang.NullPointerException
at com.liferay.portal.jsonwebservice.JSONWebServiceActionConfig.<init>(JSONWebServiceActionConfig.java:48)
at com.liferay.portal.jsonwebservice.JSONWebServiceActionConfig.<init>(JSONWebServiceActionConfig.java:66)
at com.liferay.portal.jsonwebservice.JSONWebServiceActionsManagerImpl.registerJSONWebServiceAction(JSONWebServiceActionsManagerImpl.java:275)
at com.liferay.portal.kernel.jsonwebservice.JSONWebServiceActionsManagerUtil.registerJSONWebServiceAction(JSONWebServiceActionsManagerUtil.java:92)
at com.liferay.portal.jsonwebservice.JSONWebServiceRegistrator.registerJSONWebServiceAction(JSONWebServiceRegistrator.java:261)
at com.liferay.portal.jsonwebservice.JSONWebServiceRegistrator.onJSONWebServiceBean(JSONWebServiceRegistrator.java:195)
at com.liferay.portal.jsonwebservice.JSONWebServiceRegistrator.processBean(JSONWebServiceRegistrator.java:93)
at com.liferay.portal.jsonwebservice.JSONWebServiceRegistrator.processAllBeans(JSONWebServiceRegistrator.java:68)
at com.liferay.portal.jsonwebservice.JSONWebServiceActionsManagerImpl.registerServletContext(JSONWebServiceActionsManagerImpl.java:332)
at com.liferay.portal.jsonwebservice.JSONWebServiceActionsManagerImpl.registerServletContext(JSONWebServiceActionsManagerImpl.java:296)
at com.liferay.portal.kernel.jsonwebservice.JSONWebServiceActionsManagerUtil.registerServletContext(JSONWebServiceActionsManagerUtil.java:97)
at com.liferay.portal.deploy.hot.JSONWebServiceHotDeployListener.doInvokeDeploy(JSONWebServiceHotDeployListener.java:66)
at com.liferay.portal.deploy.hot.JSONWebServiceHotDeployListener.invokeDeploy(JSONWebServiceHotDeployListener.java:34)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:230)
at com.liferay.portal.deploy.hot.HotDeployImpl.fireDeployEvent(HotDeployImpl.java:96)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:28)
at com.liferay.portal.kernel.servlet.PluginContextListener.fireDeployEvent(PluginContextListener.java:164)
at com.liferay.portal.kernel.servlet.PluginContextListener.doPortalInit(PluginContextListener.java:154)
at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:44)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:74)
at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:58)
at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:54)
at com.liferay.portal.kernel.servlet.PluginContextListener.contextInitialized(PluginContextListener.java:116)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5528)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1948)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
16:33:55,627 INFO [localhost-startStop-20][PortletHotDeployListener:344] Registering portlets for PWS-portlet
Loading file:/C:/sviluppo/LT-Hipersonic/liferay-portal-6.2-ce-ga5/tomcat-7.0.62/temp/9-PWS-portlet/WEB-INF/classes/portlet.properties
16:33:56,016 INFO [localhost-startStop-20][PortletHotDeployListener:492] 1 portlet for PWS-portlet is available for use
gen 25, 2017 4:33:56 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAZIONI: Deployment of web application directory C:\sviluppo\LT-Hipersonic\liferay-portal-6.2-ce-ga5\tomcat-7.0.62\webapps\PWS-portlet has finished in 2,751 ms


Do anyone has some advice? Is it a problem of web.xml configuration?

Strangely when I tried an example found on internet:

https://sourceforge.net/p/lportal/news/2014/02/liferay-plugin-portlet-json-web-services/

https://sourceforge.net/projects/meeralferay/files/LiferayPluginPortletJSONWebServices/


I inlcuded the portlet with eclipse using new liferay plugin from eexisting source, and it works.

Are there some differences beetween liferay 6.1 and 6.2?

Thanks to all
Dhruv Pandey, modified 5 Years ago. New Member Posts: 2 Join Date: 3/6/20 Recent Posts
Took 2 days to figure this out. This is somehow related to Java version. Try using Java8 for building and deploying your services. It will work. Worked for me.

A blind guess why this is happening:
Liferay is using  jodd.asm5 (Check first line of your exception trace)
and I checked Jodd site https://jodd.org/download/ and they are not supporting it after Java 8. Not sure how Liferay is using that.
thumbnail
Olaf Kock, modified 5 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Dhruv Pandey:

Took 2 days to figure this out. This is somehow related to Java version. Try using Java8 for building and deploying your services. It will work. Worked for me.

A blind guess why this is happening:
Liferay is using  jodd.asm5 (Check first line of your exception trace)
and I checked Jodd site https://jodd.org/download/ and they are not supporting it after Java 8. Not sure how Liferay is using that.

Hm - back in the 6.x times, there was no Java11 support at all, maximum is Java 8 AFAIK.
I understand your objection (and am wondering about it) for newer versions, but in 6.2 the recommendation to go with (max) Java8 is solid.
thumbnail
Enrique Valdes Lacasa, modified 5 Years ago. Junior Member Posts: 92 Join Date: 7/29/14 Recent Posts
Thanks a lot for your answer Dhruv Pandey! By the way, I ran into this exact issue in a Liferay 7.2 instance on Java 11. 
I had this configuration in the build plugin of my service pom.xml:
&nbsp;&nbsp; &nbsp;<build>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<plugins>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<plugin>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<groupid>org.apache.maven.plugins</groupid>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<artifactid>maven-compiler-plugin</artifactid>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<version>3.8.1</version>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<configuration>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<source>1.8
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<target>11</target>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;</configuration>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;</plugin>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;...
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;</plugins>
&nbsp;&nbsp; &nbsp;<build></build></build>
This was throwing the error because the Java runtime version of my artifact was set to 11...but Jodd only works when targeted for Java 8 maximum. What I did, is changed the configuration to the following:
&nbsp;&nbsp; &nbsp;<build>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<plugins>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<plugin>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<groupid>org.apache.maven.plugins</groupid>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<artifactid>maven-compiler-plugin</artifactid>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<version>3.8.1</version>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<configuration>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<source>1.8
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<target>1.8</target>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;</configuration>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;</plugin>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;...
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;</plugins>
&nbsp;&nbsp; &nbsp;<build></build></build>
After building and deploying the error was gone.