I am working on a below community article of creating OSGi bundle which consumes third party webservice. I followed all the steps given in the article but I am seeing no class found error . I am using AEM 5.6 and modified the sling.properties file located in the crx-quickstart\conf folder. by adding below line
sling.bootdelegation.com.sun=com.sun.*
Article link:
https://helpx.adobe.com/experience-manager/using/creating-cxf-bundles-consume-web.html
below is the stack trace of the error
Caused by: org.apache.sling.api.SlingException: An exception occurred processing JSP page /apps/weatherapp/components/page/weathertemplate/weathertemplate.jsp at line 7 at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspExceptionInternal(JspServletWrapper.java:683) at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:608) at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:525) at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449) at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:265) at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:87) at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:465) at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:361) ... 114 more Caused by: java.lang.NoClassDefFoundError: com/aem/ws/GlobalWeather at org.apache.jsp.apps.weatherapp.components.page.weathertemplate.weathertemplate_jsp._jspService(weathertemplate_jsp.java:153) at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502) ... 119 more
Solved! Go to Solution.
You are using 5.6. Upgrade to Java 1.7 to make sure that is not the cause of this issue.
The 5.6 install docs state:
Prerequisites
To install AEM you need:
The Java Runtime Environment (JRE). Version 1.7 is preferred. See Java Virtual Machines for details.
https://docs.adobe.com/docs/en/cq/5-6-1/deploying/technical_requirements.html
Views
Replies
Total Likes
I just ran on 5.6 - this is the result you will get:
[img]WSOttawa.png[/img]
Views
Replies
Total Likes
WHat happens when you install the sample package that comes with the article. Install the package and restart AEM and let us know what happens - i just tested and it works.
Views
Replies
Total Likes
Hi Abhilash,
Did you restarted the instance again after modifying sling,properties file?
It works for me in One go!! Please try once again by following the complete article.
Thanks,
Ratna Kumar.
I have restarted AEM instance couple of times but still facing the same issue. Could you please assist where exactly I need to add this line "sling.bootdelegation.com.sun=com.sun.*" in sling.properties file. I have added as shown below.
Part of sling.properties file
#Overlay properties for configuration
#Wed Oct 14 17:29:53 IST 2015
sling.framework.install.incremental=true
obr.repository.url=http\://sling.apache.org/obr/repository.xml
sling.bootdelegation.weblogic=weblogic.xml.*
org.osgi.framework.system.packages=${osgi-core-packages}, ${osgi-compendium-services}, org.apache.sling.launchpad.api;version\=1.1.0, ${jre-${java.specification.version}} ${org.apache.sling.launcher.system.packages}
org.apache.sling.commons.log.file.number=5
org.osgi.framework.startlevel.beginning=30
org.osgi.framework.bundle.parent=framework
org.apache.sling.commons.log.file.size='.'yyyy-MM-dd
gosh.home=${sling.home}
ds.factory.enabled=true
repository.home=${sling.home}/repository
sling.bootdelegation.sun.reflect=sun.reflect
ds.loglevel=warn
org.apache.sling.commons.log.julenabled=true
org.osgi.framework.system.capabilities=${eecap-${java.specification.version}}
osgi-compendium-services=org.osgi.util.tracker;version\="1.5"
org.osgi.framework.storage=${sling.launchpad}/felix
org.apache.sling.commons.log.file=${sling.home}/logs/error.log
sling.bootdelegation.jboss.__redirected=__redirected
sling.bootdelegation.jboss=__redirected
sling.bootdelegation.com.sun=com.sun.*
Views
Replies
Total Likes
That is the correct place in the sling file. Make sure the OSGi bundle is active.
Views
Replies
Total Likes
Thanks Scott. I have checked the bundle status .one bundle (OSGi7) which contain java proxy classes package com..aem.ws was active. But another bundle (Ws_basews_base) is in installed state. When I am trying to start it manually I am getting the below stack trace in log. Do I need to switch to Java 7 to make this bundle active ? I am currently running CQ 5.6 with Java SE 6u24. I am also attaching screen shot of bundle information for your reference. Also Update me how to create this bundle so that I will create the same by making execution environment as java 1.6
*ERROR* [127.0.0.1 [1444830223798] POST /system/console/bundles/357 HTTP/1.1] cqse-httpservice %bundles.pluginTitle: Cannot start (org.osgi.framework.BundleException: Unresolved constraint in bundle ws_base [357]: Execution environment not supported: JavaSE-1.7) org.osgi.framework.BundleException: Unresolved constraint in bundle ws_base [357]: Execution environment not supported: JavaSE-1.7
Views
Replies
Total Likes
There should only be 1 OSGi bundle that exports the package com.aem.ws.
See:
Symbolic Name | WS_osgi4 |
Version | 1.0.0 |
Bundle Location | inputstream:WS_osgi4_1.0.0.jar |
Last Modification | Wed Oct 07 10:20:07 EDT 2015 |
Start Level | 20 |
Exported Packages | com.aem.ws,version=0.0.0 test,version=0.0.0 |
Imported Packages | javax.xml.bind,version=2.1.0 from org.apache.felix.framework (0) javax.xml.namespace,version=0.0.0.fragment_xml from org.apache.felix.framework (0) javax.xml.ws,version=2.1.0 from org.apache.felix.framework (0) |
Manifest Headers | Bundle-ManifestVersion: 2 Bundle-Name: WS_osgi4 Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-SymbolicName: WS_osgi4 Bundle-Version: 1.0.0 Export-Package: com.aem.ws, test Import-Package: javax.xml.bind, javax.xml.namespace, javax.xml.ws Manifest-Version: 1.0 |
Also - Java 1.7 is the Java run-time i use.
Views
Replies
Total Likes
smacdonald2008 wrote...
There should only be 1 OSGi bundle that exports the package com.aem.ws.
See:
Symbolic Name
WS_osgi4
Version
1.0.0
Bundle Location
inputstream:WS_osgi4_1.0.0.jar
Last Modification
Wed Oct 07 10:20:07 EDT 2015
Start Level
20
Exported Packages
com.aem.ws,version=0.0.0
test,version=0.0.0Imported Packages
javax.xml.bind,version=2.1.0 from org.apache.felix.framework (0)
javax.xml.namespace,version=0.0.0.fragment_xml from org.apache.felix.framework (0)
javax.xml.ws,version=2.1.0 from org.apache.felix.framework (0)Manifest Headers
Bundle-ManifestVersion: 2
Bundle-Name: WS_osgi4
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-SymbolicName: WS_osgi4
Bundle-Version: 1.0.0
Export-Package: com.aem.ws, test
Import-Package: javax.xml.bind, javax.xml.namespace, javax.xml.ws
Manifest-Version: 1.0
Also - Java 1.7 is the Java run-time i use.
Yes Scott.. There is only one bundle that is exporting com.aem.ws .Please find the screen shot about the same bundle (Osgi7osgi7 )information and this bundle target run time is Java 1.6 only . But I did not understand what the second bundle(Ws_basews_base) will do.
In that article there are instructions to create only one bundle . I followed the steps since its not working I have downloaded the package link given there but still its not working .I have downloaded the package from below link
https://helpx.adobe.com/experience-manager/using/creating-cxf-bundles-consume-web.html
Views
Replies
Total Likes
You are using 5.6. Upgrade to Java 1.7 to make sure that is not the cause of this issue.
The 5.6 install docs state:
Prerequisites
To install AEM you need:
The Java Runtime Environment (JRE). Version 1.7 is preferred. See Java Virtual Machines for details.
https://docs.adobe.com/docs/en/cq/5-6-1/deploying/technical_requirements.html
Views
Replies
Total Likes
smacdonald2008 wrote...
You are using 5.6. Upgrade to Java 1.7 to make sure that is not the cause of this issue.
The 5.6 install docs state:
Prerequisites
To install AEM you need:
The Java Runtime Environment (JRE). Version 1.7 is preferred. See Java Virtual Machines for details.
https://docs.adobe.com/docs/en/cq/5-6-1/deploying/technical_requirements.html
Thank you Scott. I have upgraded to java 1.7 and its working fine.
Views
Replies
Total Likes
Sure Scott.. Let me upgrade to java 1.7 and I will let you no if issue comes again. Thanks for your help on this :)
Views
Replies
Total Likes