12 Replies Latest reply on Dec 8, 2012 1:23 AM by Stephen Coy

    Alternative to defining dependency without modifying sun.jdk module

    Atul Bansal Newbie

      When using Jboss 7 I faced a couple NoClassDefFoundErros. One of them related to

       

      12:10:21,083 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/system]] (MSC service thread 1-7) StandardWrapper.Throwable: java.lang.NoClassDefFoundError: com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl

                at java.lang.Class.getDeclaredConstructors0(Native Method) [rt.jar:1.6.0_24]

                at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) [rt.jar:1.6.0_24]

                at java.lang.Class.getConstructors(Class.java:1459) [rt.jar:1.6.0_24]

                at com.sun.jersey.server.impl.modelapi.annotation.IntrospectionModeller.createResource(IntrospectionModeller.java:111) [jersey-bundle-1.11.jar:1.11]

       

      I was able to resolved the issue by including

       

      <path name="com/sun/org/apache/xerces/internal/jaxp/datatype"/>

       

      in sun.jdk module.

       

       

      However, I'm facing a situation where I'm not allowed to modify the container's sun.jdk module.

       

      Is there any alternative to this, by way of importing packages in standalone-full.xml or jboss-deployment-structure.xml which can be packaged along with my EAR??

        • 1. Re: Alternative to defining dependency without modifying sun.jdk module
          jaikiran pai Master

          Which exact version of JBoss AS7 are you using? The latest nightly builds https://community.jboss.org/thread/167590 should allow you to add system dependency in the jboss-deployment-structure.xml of your deployment. See the xsd here https://github.com/jbossas/jboss-as/blob/master/build/src/main/resources/docs/schema/jboss-deployment-structure-1_1.xsd (the "system" element).

          • 2. Re: Alternative to defining dependency without modifying sun.jdk module
            Atul Bansal Newbie

            Thanks for the reply!

             

            I'm using the latest Jboss 7.1 final version.

             

            Below is my jboss-deployment-structure.xml

             

            <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">

                      <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

                      <deployment>

                                <exclusions>

                                          <module name="org.apache.log4j" />

                                </exclusions>

                      </deployment>

                      <sub-deployment name="eservice.war">

                                <dependencies>

                                  <module name="deployment.system"/>

                                </dependencies>

                      </sub-deployment>

                      <module name="deployment.system">

                          <dependencies>

                              <system export="true">

                                  <paths>

                                      <path name="com/sun/org/apache/xerces/internal/jaxp/datatype"/>

                                                              <path name="com/sun/jndi/rmi" />

                                  </paths>

                              </system>

                          </dependencies>

                </module>

            </jboss-deployment-structure>

             

            I've tried many different flavors of the above, like defining dependency for the entire EAR and not just one sub-deployment, using deployment.sun.jdk instead of deployment.system, however nothing seems to work.

             

            Only modification of sun.jdk module's xml gets the job done.

            • 3. Re: Alternative to defining dependency without modifying sun.jdk module
              Gonne Martens Novice

              That is the same experience I have made with the current version 7.1.0.Final.

              Instead of modify sun.jdk module I created a separate module, but I would also prefer a jboss-deployment-structure.xml-based solution.

               

              Regards,

              Gonne

              • 4. Re: Alternative to defining dependency without modifying sun.jdk module
                Atul Bansal Newbie

                Absence of any solution to this problem is sort of a big roadblock for me right now. If anyone is able to resolve this issue please let me know.

                 

                Thaks,

                Atul

                • 5. Re: Alternative to defining dependency without modifying sun.jdk module
                  jaikiran pai Master

                  This is what the jboss-deployment-structure.xml should look like:

                   

                  <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
                            <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
                            <deployment>
                                      <exclusions>
                                                <module name="org.apache.log4j" />
                                      </exclusions>
                            </deployment>
                            <sub-deployment name="eservice.war">
                              <dependencies>
                                  <system>
                                      <paths>
                                          <path name="com/sun/org/apache/xerces/internal/jaxp/datatype"/>
                                          <path name="com/sun/jndi/rmi" />
                                      </paths>
                                  </system>
                              </dependencies>
                  
                            </sub-deployment>
                  </jboss-deployment-structure>
                  

                   

                  Also make sure you have placed it in the right location. For .ear deployments, it should be in .ear/META-INF and for independent top-level .war deployments, it should be in .war/WEB-INF folder.

                  • 6. Re: Alternative to defining dependency without modifying sun.jdk module
                    jaikiran pai Master

                    Gonne Martens wrote:

                     

                    That is the same experience I have made with the current version 7.1.0.Final.

                    Instead of modify sun.jdk module I created a separate module, but I would also prefer a jboss-deployment-structure.xml-based solution.

                     

                    Should be possible, like in this example https://community.jboss.org/message/717881#717881. What specific issue are you running into?

                    • 7. Re: Alternative to defining dependency without modifying sun.jdk module
                      Gonne Martens Novice

                      According to your example it works as expected with the following two variants in my ear-deployment:

                       

                      {code:xml}

                      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">

                          <deployment>

                              <dependencies>

                                  <system>

                                      <paths>

                                          <path name="com/sun/net/ssl/internal/ssl"/>

                                      </paths>

                                  </system>

                              </dependencies>

                          </deployment>

                      </jboss-deployment-structure>

                      {code}

                       

                      {code:xml}

                      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">

                          <sub-deployment name="test.war">

                              <dependencies>

                                  <system>

                                      <paths>

                                          <path name="com/sun/net/ssl/internal/ssl"/>

                                      </paths>

                                  </system>

                              </dependencies>

                          </sub-deployment>

                      </jboss-deployment-structure>

                      {code}

                       

                      My problem was that it did not work when I defined a module with system dependency in my jboss-deployment-structure.xml:

                       

                      {code:xml}

                      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">

                          <deployment>

                              <dependencies>

                                  <module name="deployment.system"/>

                              </dependencies>

                          </deployment>

                          <module name="deployment.system">

                              <dependencies>

                                  <system export="true">

                                      <paths>

                                          <path name="com/sun/net/ssl/internal/ssl"/>

                                      </paths>

                                  </system>

                              </dependencies>

                          </module>

                      </jboss-deployment-structure>

                      {code}

                       

                      Thanks for your help!

                       

                      Regards,

                      Gonne

                      • 8. Re: Alternative to defining dependency without modifying sun.jdk module
                        Atul Bansal Newbie

                        Thanks a ton Jai Kiran. The jboss-deployment-structure.xml you provided works, and I'm able to get out of bind.

                         

                        Regards,

                        Atul

                        • 9. Re: Alternative to defining dependency without modifying sun.jdk module
                          yashendra chandrakar Newbie

                          I have been getting this error

                           

                          Caused by: java.lang.ClassNotFoundException: sun.security.x509.X509CertImpl

                           

                          As suggested I added jboss-deployment-structure.xml in my ear/META-INF/

                          Following is content of my jboss-deployment-structure.xml

                           

                          <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">

                              <deployment>

                                  <dependencies>

                                      <system>

                                          <paths>

                                              <path name="sun/security/x509"/>

                                          </paths>

                                      </system>

                                  </dependencies>

                              </deployment>

                          </jboss-deployment-structure>

                           

                           

                          But that didnt resolve the problem, though adding following line in existing sun\jdk module.xml worked

                           

                          <path name="sun/security/x509"/>

                          • 10. Re: Alternative to defining dependency without modifying sun.jdk module
                            Gonne Martens Novice

                            How is the structure of your ear and in which part (jar, war, ...) is the ClassNotFoundException thrown?

                            Which JBoss version do you use?

                            • 11. Re: Alternative to defining dependency without modifying sun.jdk module
                              Newbie

                              Hi Jaikrian,

                               

                              I also had a similar problem with missing module systems, i saw this post.

                              Can I use the same solution for Jboss 7.1.0 Final Thunder version?

                               

                              Also https://github.com/jbossas/jboss-as/blob/master/build/src/main/resources/docs/schema/jboss-deployment-structure-1_1.xsd, is it the same for JBoss 7.1.0 Thunder version?

                               

                              Thanks,

                              Chandru

                              • 12. Re: Alternative to defining dependency without modifying sun.jdk module
                                Stephen Coy Master

                                This schema appears in the 7.1.0 docs/schema directory, so I expect that it will be fine.