2 Replies Latest reply on Jun 21, 2012 5:55 PM by Jignesh Patel

    problem of referring OSGI service from EJB (JBOSS - 7.1.1)

    Jignesh Patel Newbie

      On JBoss7.1.1.FInal, I am trying to call OSGI service from EJB but I am getting following error:

       

       

      11:31:34,203 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-16) JBAS015876: Starting deployment of "HelloService.jar"

      11:31:34,216 INFO  [org.jboss.osgi.framework.internal.BundleManager] (MSC service thread 1-6) Install bundle: HelloService:1.0.0.201206191131

      11:31:34,221 INFO  [stdout] (MSC service thread 1-6) Hello World!!

      11:31:34,222 INFO  [org.jboss.osgi.framework.internal.HostBundleState] (MSC service thread 1-6) Bundle started: HelloService:1.0.0.201206191131

      11:31:34,228 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018565: Replaced deployment "HelloService.jar" with deployment "HelloService.jar"

      11:31:39,230 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) JBAS015003: Found TestOSGI.jar in deployment directory. To trigger deployment create a file called TestOSGI.jar.dodeploy

      11:31:39,235 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "TestOSGI.jar"

      11:31:39,245 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-12) JBAS018567: Deployment "deployment.TestOSGI.jar" is using a private module ("org.jboss.osgi.framework:main") which may be changed or removed in future versions without notice.

      11:31:39,246 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-16) MSC00001: Failed to start service jboss.deployment.unit."TestOSGI.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."TestOSGI.jar".POST_MODULE: Failed to process phase POST_MODULE of deployment "TestOSGI.jar"

                at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_31]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_31]

                at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_31]

      Caused by: java.lang.RuntimeException: Error getting reflective information for class com.icare.sample.ejb.HelloSLSB with ClassLoader ModuleClassLoader for Module "deployment.TestOSGI.jar:main" from Service Module Loader

                at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)

                at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85)

                at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70)

                at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)

                at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                ... 5 more

      Caused by: java.lang.NoClassDefFoundError: Lcom/icare/sample/service/HelloService;

                at java.lang.Class.getDeclaredFields0(Native Method) [classes.jar:1.6.0_31]

                at java.lang.Class.privateGetDeclaredFields(Class.java:2291) [classes.jar:1.6.0_31]

                at java.lang.Class.getDeclaredFields(Class.java:1743) [classes.jar:1.6.0_31]

                at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                ... 10 more

      Caused by: java.lang.ClassNotFoundException: com.icare.sample.service.HelloService from [Module "deployment.TestOSGI.jar:main" from Service Module Loader]

                at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]

                at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]

                at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]

                ... 15 more

       

      11:31:39,254 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS015870: Deploy of deployment "TestOSGI.jar" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"TestOSGI.jar\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"TestOSGI.jar\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"TestOSGI.jar\""}}

      11:31:39,258 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-10) JBAS015877: Stopped deployment TestOSGI.jar in 4ms

      11:31:39,259 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report

      JBAS014777:   Services which failed to start:      service jboss.deployment.unit."TestOSGI.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."TestOSGI.jar".POST_MODULE: Failed to process phase POST_MODULE of deployment "TestOSGI.jar"

       

      11:31:39,260 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"TestOSGI.jar\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"TestOSGI.jar\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"TestOSGI.jar\""}}}}

       

       

       

      Here is standalone.xml setup.

       

              <subsystem xmlns="urn:jboss:domain:osgi:1.2" activation="lazy">

                  <properties>

                      <property name="org.osgi.framework.startlevel.beginning">

                          3

                      </property>

                  </properties>

                  <capabilities>

                      <capability name="javax.servlet.api:v25"/>

                      <capability name="javax.transaction.api"/>

                      <capability name="org.apache.felix.log" startlevel="1"/>

                      <capability name="org.jboss.osgi.logging" startlevel="1"/>

                      <capability name="org.apache.felix.configadmin" startlevel="1"/>

                      <capability name="org.jboss.as.osgi.configadmin" startlevel="1"/>

                      <capability name="org.apache.aries:org.apache.aries.util:0.4"/>

                      <capability name="org.apache.aries.proxy:org.apache.aries.proxy:0.4"/>

                      <capability name="org.apache.aries.blueprint:org.apache.aries.blueprint:0.4"/>

                      <capability name="org.ops4j.pax.web:pax-web-jsp:1.1.2" startlevel="2"/>

                      <capability name="org.ops4j.pax.web:pax-web-jetty-bundle:1.1.2" startlevel="2"/>

                      <capability name="org.ops4j.pax.web:pax-web-extender-war:1.1.2" startlevel="2"/>

                  </capabilities>

              </subsystem>

              <subsystem xmlns="urn:jboss:domain:pojo:1.0"/>

              <subsystem xmlns="urn:jboss:domain:remoting:1.1">

                  <connector name="remoting-connector" socket-binding="remoting" security-realm="ApplicationRealm"/>

              </subsystem>

              <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0"/>

              <subsystem xmlns="urn:jboss:domain:sar:1.0"/>

              <subsystem xmlns="urn:jboss:domain:security:1.1">

       

       

       

       

      I also noticed jboss throws error while remove the service bundle.

       

      13:09:46,462 INFO  [stdout] (MSC service thread 1-6) Goodbye World!!

      13:09:46,464 INFO  [org.jboss.osgi.framework.internal.HostBundleState] (MSC service thread 1-6) Bundle stopped: HelloService:1.0.0.201206191309

      13:09:46,470 ERROR [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015892: Deployment unit processor org.jboss.as.jpa.processor.PersistenceProviderProcessor@670fd777 unexpectedly threw an exception during undeploy phase INSTALL of deployment "HelloService.jar": java.lang.NullPointerException

                at org.jboss.as.jpa.processor.PersistenceProviderProcessor.allDeploymentModuleClassLoaders(PersistenceProviderProcessor.java:138)

                at org.jboss.as.jpa.processor.PersistenceProviderProcessor.undeploy(PersistenceProviderProcessor.java:122)

                at org.jboss.as.server.deployment.DeploymentUnitPhaseService.safeUndeploy(DeploymentUnitPhaseService.java:167) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.as.server.deployment.DeploymentUnitPhaseService.stop(DeploymentUnitPhaseService.java:161) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                at org.jboss.msc.service.ServiceControllerImpl$StopTask.stopService(ServiceControllerImpl.java:1911) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at org.jboss.msc.service.ServiceControllerImpl$StopTask.run(ServiceControllerImpl.java:1874) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_31]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_31]

                at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_31]

       

      13:09:46,479 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-15) JBAS015877: Stopped deployment HelloService.jar in 19ms

      13:09:46,486 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018558: Undeployed "HelloService.jar"