Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: NoClassDefFoundError: Could not initialize class com.sun.jersey.spi.ser
Hi All ,
i am using jersey as client to make the rest call . for that i added all the dependences in gradle file .
dependencies {
compile group: "biz.aQute.bnd", name: "biz.aQute.bndlib", version: "3.1.0"
compile group: "com.liferay", name: "com.liferay.osgi.util", version: "3.0.0"
compile group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.6.0"
compile group: "org.osgi", name: "org.osgi.core", version: "5.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
compileOnly group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
compileOnly group: "jstl", name: "jstl", version: "1.2"
compileOnly group: "org.osgi", name: "osgi.cmpn", version: "6.0.0"
compile group: 'commons-lang', name: 'commons-lang', version: '2.6'
compile group: 'commons-logging', name: 'commons-logging', version: '1.1.1'
compile group: 'com.sun.jersey', name: 'jersey-client', version: '1.19'
compile group: 'com.sun.jersey', name: 'jersey-core', version: '1.19'
compile group: 'org.simpleframework', name: 'simple-xml', version: '2.7'
compile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.1'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5'
compile group: 'net.oauth.core', name: 'oauth', version: '20100527'
compile group: 'xpp3', name: 'xpp3', version: '1.1.3.3'
compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.0.1'
runtime group: 'commons-lang', name: 'commons-lang', version: '2.6'
runtime group: 'commons-logging', name: 'commons-logging', version: '1.1.1'
runtime group: 'com.sun.jersey', name: 'jersey-client', version: '1.19'
runtime group: 'com.sun.jersey', name: 'jersey-core', version: '1.19'
runtime group: 'org.simpleframework', name: 'simple-xml', version: '2.7'
runtime group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.1'
runtime group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5'
runtime group: 'net.oauth.core', name: 'oauth', version: '20100527'
runtime group: 'xpp3', name: 'xpp3', version: '1.1.3.3'
runtime group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.0.1'
}
and bnd file i added as below
-includeresource:\
@httpclient-4.5.jar,\
@httpcore-4.4.1.jar,\
@jersey-client-1.19.jar,\
@jersey-core-1.19.jar,\
@javax.ws.rs-api-2.0.1.jar,\
@oauth-20100527.jar,\
@simple-xml-2.7.jar,\
@xpp3-1.1.3.3.jar,\
My module is showing as active in gogo shell . But when i am trying to acesss this module in another portlet i am getting below exception . i could't able to find the root cause . Can any one help me to fix this issue.
[http-nio-8080-exec-6][status_jsp:950] com.liferay.portal.kernel.portlet.PortletContainerException: com.liferay.portal.kernel.portlet.PortletContainerException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class com.sun.jersey.spi.service.ServiceFinder
Thank you
i am using jersey as client to make the rest call . for that i added all the dependences in gradle file .
dependencies {
compile group: "biz.aQute.bnd", name: "biz.aQute.bndlib", version: "3.1.0"
compile group: "com.liferay", name: "com.liferay.osgi.util", version: "3.0.0"
compile group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.6.0"
compile group: "org.osgi", name: "org.osgi.core", version: "5.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
compileOnly group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
compileOnly group: "jstl", name: "jstl", version: "1.2"
compileOnly group: "org.osgi", name: "osgi.cmpn", version: "6.0.0"
compile group: 'commons-lang', name: 'commons-lang', version: '2.6'
compile group: 'commons-logging', name: 'commons-logging', version: '1.1.1'
compile group: 'com.sun.jersey', name: 'jersey-client', version: '1.19'
compile group: 'com.sun.jersey', name: 'jersey-core', version: '1.19'
compile group: 'org.simpleframework', name: 'simple-xml', version: '2.7'
compile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.1'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5'
compile group: 'net.oauth.core', name: 'oauth', version: '20100527'
compile group: 'xpp3', name: 'xpp3', version: '1.1.3.3'
compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.0.1'
runtime group: 'commons-lang', name: 'commons-lang', version: '2.6'
runtime group: 'commons-logging', name: 'commons-logging', version: '1.1.1'
runtime group: 'com.sun.jersey', name: 'jersey-client', version: '1.19'
runtime group: 'com.sun.jersey', name: 'jersey-core', version: '1.19'
runtime group: 'org.simpleframework', name: 'simple-xml', version: '2.7'
runtime group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.1'
runtime group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5'
runtime group: 'net.oauth.core', name: 'oauth', version: '20100527'
runtime group: 'xpp3', name: 'xpp3', version: '1.1.3.3'
runtime group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.0.1'
}
and bnd file i added as below
-includeresource:\
@httpclient-4.5.jar,\
@httpcore-4.4.1.jar,\
@jersey-client-1.19.jar,\
@jersey-core-1.19.jar,\
@javax.ws.rs-api-2.0.1.jar,\
@oauth-20100527.jar,\
@simple-xml-2.7.jar,\
@xpp3-1.1.3.3.jar,\
My module is showing as active in gogo shell . But when i am trying to acesss this module in another portlet i am getting below exception . i could't able to find the root cause . Can any one help me to fix this issue.
[http-nio-8080-exec-6][status_jsp:950] com.liferay.portal.kernel.portlet.PortletContainerException: com.liferay.portal.kernel.portlet.PortletContainerException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class com.sun.jersey.spi.service.ServiceFinder
Thank you
Now we changed all the jersey client code to httpClient code . But still i got the same errror . I done some analysis and deleted the temp ,state ,work folder then it started working fine. But when again we are doing any modification in module and deploying the module then we are facing the same issuse even though we are not using any jersey releated code . We removed all the jersey jar from classpath . but still got the same issue.
i thing some module related cache is storing in db or any folder . Which is overriding our class again . Can any one help me to find the internal working process of module deployement.
i thing some module related cache is storing in db or any folder . Which is overriding our class again . Can any one help me to find the internal working process of module deployement.
In your -includeresource declaration, you don't have to include most of these (except for xpp3-1.1.3.3.jar & simple-xml-2.7.jar ) because they are in OSGi already. (please verify all the jars which are already in OSGi)
Please try again with the above changes and I really appreacite if you can provide your entire bnd file if issue still exists.
Regards
Please try again with the above changes and I really appreacite if you can provide your entire bnd file if issue still exists.
Regards