11 Replies Latest reply on Aug 27, 2008 2:40 PM by Peter Johnson

    Classloading issue (loading class from another jar)

    shiva Newbie

      I have a EAR file. In the lib folder of ear i have two jar files commons-beanutils.jar and B.jar(custom jar). The look up class in commons-beanutils.jar is unable to acces class in our custom jar.Is it possible to do it in jboss??
      shiva

        • 1. Re: Classloading issue (loading class from another jar)
          shiva Newbie

          Do i need to create a sar file to keep both the jars in in same classloader..

          • 2. Re: Classloading issue (loading class from another jar)
            Peter Johnson Master

            Which version of JBossAS are you using?

            Are you referencing the jar files in application.xml?

            I am not sure in which version of JBossAS it started to automatically recognize the lib directory.

            • 3. Re: Classloading issue (loading class from another jar)
              shiva Newbie

              I am using jboss 4.2.1 GA.I am not refering the jars in application.xml.DId i am using default classloader settings.my ear struture is
              test.ear
              /lib
              commons-beanutils.jar
              custom.jar
              /META-INF
              application.xml
              jboss-app.xml
              a.war
              b.war


              • 4. Re: Classloading issue (loading class from another jar)
                Peter Johnson Master

                Try referencing the jars in application.xml and see if that fixes it.

                • 5. Re: Classloading issue (loading class from another jar)
                  shiva Newbie

                  should i specify all the jars in the lib directory od EAR???

                  • 6. Re: Classloading issue (loading class from another jar)
                    Peter Johnson Master

                    Which is quicker - just trying it, or asking someone on a forum and waiting for a response?

                    • 7. Re: Classloading issue (loading class from another jar)
                      shiva Newbie

                      Peter,
                      Sorry about the half email.. It did not work after making the changes. I did test by adding all the jar files.i am trying other ways. do you have any other suggestions i really appreciate your help .
                      regards
                      shiva

                      • 8. Re: Classloading issue (loading class from another jar)
                        Peter Johnson Master

                        Please post the full stack trace for the exception you are seeing.

                        • 9. Re: Classloading issue (loading class from another jar)
                          shiva Newbie

                          we have a custom class which overides convert method
                          Instead of calling customclass.convert it is calling org.apache.commons.beanutils.ConvertUtils.convert which is in the same jar
                          below is stcak trace.

                          java.lang.IllegalArgumentException: array element type mismatch
                          at java.lang.reflect.Array.set(Native Method)
                          at org.apache.commons.beanutils.ConvertUtils.convert(ConvertUtils.java:415)
                          at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:983)
                          at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
                          at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
                          at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
                          at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
                          at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
                          at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
                          at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
                          at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                          at com.organization.test.servlet.CompressionFilter.doFilter(CompressionFilter.java:107)
                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                          at com.organization.test.servlet.CheckUriAccessFilter.doFilter(CheckUriAccessFilter.java:115)
                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                          at com.organization.test.servlet.InitializationFilter.doFilter(InitializationFilter.java:144)
                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                          at com.organization.test.servlet.StaticFileCacheControlFilter.doFilter(StaticFileCacheControlFilter.java:51)
                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                          at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
                          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
                          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                          at java.lang.Thread.run(Thread.java:595)

                          • 10. Re: Classloading issue (loading class from another jar)
                            shiva Newbie

                            Peter,
                            Do you suggest any other steps to debug the issue.Did i make the issue clear?
                            regards
                            shiva

                            • 11. Re: Classloading issue (loading class from another jar)
                              Peter Johnson Master

                              Is this stack trace different than what you started with? You originally wrote "unable to acces class in our custom jar" which I interpreted to mean you were getting a ClassNotFound exception. The stack trace you posted is another issue entirely. I have no idea how to convince Struts to call your custom convert method.