8 Replies Latest reply on May 17, 2016 5:33 AM by arcivanov

    Problem using picket box

    morena.livera

      Hi,

      I'm working on Wildfly 10 with OSGI and JAVA 8

       

      when I try to run my application this exception is thrown:


      java.lang.NoClassDefFoundError: org/jboss/security/auth/callback/UsernamePasswordHandler

       

      It seems to be a class loading issue, but I'm not finding a way to solve it.

       

      The class UsernamePasswordHandler is in picketbox library, the module is present.

      The standalone.xml contains correct modules and capabilities

      The MANIFEST has correct package to import.

       

      Any ideas about solve this issue or other tests I can do?

       

      Thank

       

      Morena

        • 1. Re: Problem using picket box
          igarashitm

          Which version of SwitchYard are you using? Anyway I think SwitchYard would not work with WildFly+OSGi. It's just a plain jar deployment on EAP. If you want to stick to OSGi, then you need to use karaf or Fuse instead.

          • 2. Re: Problem using picket box
            morena.livera

            Hi Igarashi,

            thank you for your answer.

            I'm not using SwitchYard, so I think the problem cannot be that!

            • 3. Re: Problem using picket box
              igarashitm

              Then I guess you posted in a wrong space. This is a SwitchYard user forum.

              • 4. Re: Problem using picket box
                arcivanov

                Could you please provide the following information:

                • The OSGi configuration of your standalone.xml
                • The contents of the bundle Manifest that uses your Picketbox
                • TRACE-level logs containing at least org.jboss.osgi.resolver facilities.

                Thanks!

                • 5. Re: Problem using picket box
                  morena.livera

                  Hi Ivanov! Thank you for your reply and for your help!.

                  Below the data required.

                   

                  osgi sections in standalone.xml 

                  <!-- CAPABILITIES -->

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

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

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

                  <!-- EXTENSIONS -->

                  ...

                  <extension module="org.jboss.as.osgi"/>

                  ...

                  <!-- SUBSYSTEMS -->

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

                    <properties>

                          <property name="org.jboss.osgi.system.modules.extra">

                                  javax.xml.bind.api,org.apache.santuario.xmlsec,javax.xml.soap.api

                                  </property>

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

                                      1

                                  </property>

                                  <property name="org.osgi.framework.system.packages.extra">                                    

                                                      javax.activation;version=1.1.1,

                                                      javax.xml.bind;version=2.2,  

                                                      sun.security.provider;version=1.0,                                                                                                               

                                                      com.sun.org.apache.xerces.internal.dom;version=1.0,

                                                      com.sun.org.apache.xerces.internal.jaxp;version=1.0,                                                      

                                                      com.sun.org.apache.xerces.internal.util;version=1.0

                                  </property>

                              </properties>

                              <capabilities>

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

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

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

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

                                  <capability name="javax.ws.rs.api"/>

                                  <capability name="javax.xml.bind.api"/>

                                  <capability name="javax.xml.ws.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.apache.felix.metatype" startlevel="1"/>

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

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

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

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

                                  <capability name="org.wildfly.extension.security.manager"/>

                                  <capability name="org.apache.aries.blueprint" startlevel="1"/>

                                  <capability name="org.apache.aries.jmx" startlevel="1"/>

                                  <capability name="org.apache.aries.jndi" startlevel="1"/>

                                  <capability name="org.apache.aries.proxy" startlevel="1"/>

                                  <capability name="org.apache.aries.util" startlevel="1"/>

                                  <capability name="sun.jdk"/>

                                  <capability name="org.apache.commons.codec"/>

                                  <capability name="org.apache.commons.io"/>

                                  <capability name="org.picketbox"/>

                                  <capability name="org.apache.commons.lang"/>

                                  <capability name="org.apache.commons.beanutils"/>

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

                                  <capability name="net.sf.ehcache" startlevel="1"/>

                                  <capability name="org.apache.directory.server.apacheds-service" startlevel="1"/>

                              </capabilities>

                          </subsystem>

                   

                   

                  Log level trace:

                   

                  15:01:13,582 INFO  [org.jboss.osgi.framework]  JBOSGI011006: OSGi Framework - 5.0.1.Final

                  15:01:15,436 INFO  [org.jboss.osgi.framework]  JBOSGI011001: Bundle installed: org.apache.felix.log:1.0.1

                  15:01:15,442 INFO  [org.jboss.osgi.framework]  JBOSGI011001: Bundle installed: jboss-osgi-logging:1.0.0

                  15:01:15,452 INFO  [org.jboss.osgi.framework]  JBOSGI011001: Bundle installed: org.apache.felix.configadmin:1.8.8

                  15:01:15,455 INFO  [org.jboss.osgi.framework]  JBOSGI011001: Bundle installed: org.apache.felix.metatype:1.1.2

                  15:01:15,466 INFO  [org.jboss.osgi.framework]  JBOSGI011001: Bundle installed: org.apache.felix.scr:1.8.2

                  15:01:15,471 INFO  [org.jboss.osgi.framework]  JBOSGI011001: Bundle installed: org.apache.aries.blueprint:1.1.0

                  15:01:15,475 INFO  [org.jboss.osgi.framework]  JBOSGI011001: Bundle installed: org.apache.aries.jmx:1.1.5

                  15:01:15,476 INFO  [org.jboss.osgi.framework]  JBOSGI011001: Bundle installed: org.apache.aries.jndi:1.0.0

                  15:01:15,478 INFO  [org.jboss.osgi.framework]  JBOSGI011001: Bundle installed: org.apache.aries.proxy:1.0.1

                  15:01:15,480 INFO  [org.jboss.osgi.framework]  JBOSGI011001: Bundle installed: org.apache.aries.util:1.1.1

                  15:01:15,736 INFO  [org.jboss.osgi.framework]  JBOSGI011011: Starting bundles for start level: 1

                  15:01:15,739 INFO  [org.jboss.osgi.framework]  JBOSGI011002: Bundle started: jbosgi-wildfly-http:2.5.0.Final

                  15:01:15,739 INFO  [org.jboss.osgi.framework]  JBOSGI011002: Bundle started: jbosgi-wildfly-jpa:2.5.0.Final

                  15:01:15,739 INFO  [org.jboss.osgi.framework]  JBOSGI011002: Bundle started: org.jboss.as.security:0.0.0

                  15:01:15,740 INFO  [org.jboss.osgi.framework]  JBOSGI011002: Bundle started: org.apache.xalan:0.0.0

                  15:01:15,740 INFO  [org.jboss.osgi.framework]  JBOSGI011002: Bundle started: net.sf.ehcache:0.0.0

                  15:01:15,741 INFO  [org.jboss.osgi.framework]  JBOSGI011002: Bundle started: gb-messages:1.0.18

                  15:01:15,767 INFO  [org.jboss.osgi.framework]  JBOSGI011002: Bundle started: org.apache.felix.log:1.0.1

                  15:01:15,792 INFO  [org.jboss.osgi.framework]  JBOSGI011002: Bundle started: jboss-osgi-logging:1.0.0

                  15:01:15,831 INFO  [org.jboss.osgi.framework]  JBOSGI011002: Bundle started: org.apache.felix.configadmin:1.8.8

                  15:01:15,849 INFO  [org.jboss.osgi.framework]  JBOSGI011002: Bundle started: org.apache.felix.metatype:1.1.2

                  15:01:15,982 INFO  [org.jboss.osgi.framework]  JBOSGI011002: Bundle started: org.apache.felix.scr:1.8.2

                  15:01:16,028 INFO  [org.jboss.osgi.framework]  JBOSGI011002: Bundle started: org.apache.aries.blueprint:1.1.0

                  15:01:16,068 INFO  [org.jboss.osgi.framework]  JBOSGI011002: Bundle started: org.apache.aries.jmx:1.1.5

                  15:01:16,132 INFO  [org.jboss.osgi.framework]  JBOSGI011002: Bundle started: org.apache.aries.jndi:1.0.0

                  15:01:16,184 INFO  [org.jboss.osgi.framework]  JBOSGI011002: Bundle started: org.apache.aries.proxy:1.0.1

                  15:01:16,192 INFO  [org.jboss.osgi.framework]  JBOSGI011002: Bundle started: org.apache.aries.util:1.1.1

                  15:01:16,199 INFO  [org.jboss.osgi.framework]  JBOSGI011000: OSGi Framework started

                   

                   

                  15:01:39,306 ERROR [io.undertow.request] (default task-5) UT005023: Exception handling request myrequest: java.lang.NoClassDefFoundError: org/jboss/security/auth/callback/UsernamePasswordHandler

                    at myapp

                  Caused by: java.lang.ClassNotFoundException: org.jboss.security.auth.callback.UsernamePasswordHandler from [Module "deployment.myapp- cjboss.jar:main" from Service Module Loader]

                    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198) [jboss-modules.jar:1.5.1.Final]

                    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363) [jboss-modules.jar:1.5.1.Final]

                    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351) [jboss-modules.jar:1.5.1.Final]

                    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93) [jboss-modules.jar:1.5.1.Final]

                    ... 51 more

                   

                  Manifest

                   

                  Manifest-Version: 1.0

                  Build-Jdk: 1.7.0_79

                  Bundle-ClassPath: ., myJar.jar

                  Bundle-ManifestVersion: 2

                  Import-Package: org.osgi.framework;version="[1.5,2)",org.jboss.security,

                  org.jboss.security.auth.callback,javax.security.auth,javax.security.auth.callback,

                  javax.security.auth.login,

                  org.jboss.as.security,

                  org.jboss.as.security.remoting

                  Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.7))"

                  SVN-Revision: 4282

                  version: 1.6.9

                  • 6. Re: Problem using picket box
                    arcivanov

                    Unfortunately those are not TRACE-level logs. You need to shutdown your server, change the log level in subsystem to TRACE or ALL and restart. The file will be very large (tens of megabytes).

                     

                    Secondly, WildFly 10 does not support Java 7 and from what I can see you are at least building with it.

                     

                    Lastly, you may try using Dynamic-ImportPackage.

                    • 7. Re: Problem using picket box
                      morena.livera

                      Hi Ivanov, thank you for the answer,

                      unfortunately I cannot include more logs(company policy), but if you have an idea of which useful information I could looking for that in the log.
                      I tried with Java 7 and the error is the same.

                       

                      Finally I tried  Dynamic-ImportPackage and this change solves the issue!!!!

                      But I just have a doubt ! Is it correct forcing the import?

                       

                      Thanks a lot !!!!

                      • 8. Re: Problem using picket box
                        arcivanov

                        Glad I could help.

                        The excerpt of TRACE logs of the org.jboss.osgi.resolver without Dynamic-ImportPackage would be great!

                         

                        Using Dynamic-ImportPackage is not wrong per se, however, it is suboptimal. It could be that module exports from picketbox are sufficiently restrictive as to prevent proper OSGi resolution and DIP is the only way to get to them. It could be that there is one missing capability module that does actually export the class you need. Logs will tell. DIP is a legitimate-ish solution if you limit the scope of import, i.e. do NOT use "D-IP: *" but rather "D-IP: org.jboss.security.auth.callback" or as close as possible to your non-failure requirements to limit overhead.