4 Replies Latest reply on Mar 23, 2017 10:23 AM by arch9745

    problem loading dependent jars in jboss7

    arch9745 Newbie

      We are having a problem with jars that depend on other jars. This error is showing up in the log:


      Caused by: java.lang.NoClassDefFoundError: org/apache/commons/io/IOUtils
          at org.apache.commons.fileupload.util.Streams.copy(Streams.java:123)
          at org.apache.commons.fileupload.util.Streams.copy(Streams.java:70)
          at org.apache.commons.fileupload.MultipartStream.readBodyData(MultipartStream.java:593)
          at org.apache.commons.fileupload.MultipartStream.discardBodyData(MultipartStream.java:617)
          at org.apache.commons.fileupload.MultipartStream.skipPreamble(MultipartStream.java:634)
          at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.findNextItem(FileUploadBase.java:1023)
          at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:1003)
          at org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:310)
          at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:334)
          at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:115)


      The org/apache/commons/io/IOUtils package that it complains about is in commons-io-2.5.jar which is included as a dependency. Why does it not pick it up?


      The jboss-deployment-structure.xml file has the following:


      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
            <module name="deployment.ojdbc6.jar" />
            <module name="deployment.commons-fileupload-1.3.2.jar" />
            <module name="deployment.commons-io-2.5.jar" />

        • 1. Re: problem loading dependent jars in jboss7
          Anup Dey Expert



          First, commons-io-2.5.jar of use is to use EAP is PRIVATE of, basically we do not have those customers to use the module.

          Below, there is a list for the segregation of each module to knowledge:

          JBoss Enterprise Application Platform (EAP) 7 Included Modules - Red Hat Customer Portal




          A module with private classification is an internal component intended for use exclusively by the JBoss EAP application server. Private module APIs or behavior may change without notice, which can cause instability in applications that use them.



          As a workaround, it will be your application on whether correct. For terms of whether it is correct from our company, but comment is difficult, it can be realized If the fact that there, the message itself, which is output if you have ignored, problem I think that those of no level.

          • 2. Re: problem loading dependent jars in jboss7
            arch9745 Newbie

            Looks like you are telling me that commons jar is private to jboss. I did take a look under modules and do see org.apache.commons listed. So whats the best way to use it? commons-fileupload needs it to work. How do we get the commons-io module to load?

            • 3. Re: problem loading dependent jars in jboss7
              Anup Dey Expert

              You will need to change org.apache.commons-fileupload module.xml to have also dependency to commons io.In general you should be packaging these with your app rather than relying on the application servers version, as the servers version could be changed or be removed at any point, unless it is explicitly marked as a public module.

              • 4. Re: problem loading dependent jars in jboss7
                arch9745 Newbie

                There was no module created for commons-fileupload. What we did was copy the jars commons-fileupload-1.3.2.jar and commons-io-2.5.jar to /jboss-eap-7.0/standalone/deployments. They got deployed.

                The jboss-deployment-structure.xml then included both jars as the dependency.  When the application runs, commons-fileupload is being found ok, so why not commons-io?