10 Replies Latest reply on Sep 23, 2010 1:21 PM by exosys

    Incompatibility among related classes?

    exosys

      Dear colleagues, please help me with this problem:

      I had already put a small JSFUnit test to work, following the instructions in http://labs.jboss.com/jsfunit/gettingstarted.html. I did it in the middle of July/2010, and I am almost 100% sure this site had a different set of classes listed in the "Package these jars in your WEB-INF/lib" section. I say it because my previous version worked well, but now, after upgrading to the following set, I am having a "java.lang.NoClassDefFoundError: org.apache.http.HttpRequest" very possibly due to some incompatibility.

       

      *  jboss-jsfunit-core-1.3.0.Final.jar
         * aspectjrt-1.2.1.jar
         * cactus-13-1.7.1.jar
         * junit-3.8.1.jar
         * nekohtml-1.9.14.jar
         * htmlunit-2.8.jar
         * htmlunit-core-js-2.8.jar
         * cssparser-0.9.5.jar
         * httpclient-4.0.1.jar
         * httpmime-4.0.1.jar
         * apache-mime4j-0.6.jar
         * commons-io-1.4.jar.jar
         * sac-1.3.jar
         * commons-lang-2.4.jar
         * commons-codec-1.4.jar
         * commons-logging-1.1.1.jar
         * commons-collections-3.2.1.jar
         * commons-httpclient-2.0.2.jar
         * cactus-ant-13-1.7.1.jar
         * cargo-0.5.jar
         * ant-1.5.4.jar

       

      Could somebody, please, give me any help or clue about this? Anyway, I would love also to have the previous set of libraries, but I could not find it in older versions of the "Document Wiki".

       

      Best regards,

      Euler Xavier de Oliveira.

        • 1. Re: Incompatibility among related classes?
          ssilvert

          Hi Euler,

           

          Yes, the list of dependencies changed for JSFUnit 1.3.0.  This is because we upgraded to use HtmlUnit 2.8 and the dependencies for that changed.  I suspect that you still have an old version of HtmlUnit in your classpath somewhere.  The full stack trace should provide more clues if you want to post it.

           

          Stan

          • 2. Re: Incompatibility among related classes?
            exosys

            Dear Stan,

            here is my stack trace, I hope it will be helpful:

             

            --------------------------------------------------------------------------------------------------

            java.lang.NoClassDefFoundError: org.apache.http.HttpRequest
                at java.lang.J9VMInternals.verifyImpl(Native Method)
                at java.lang.J9VMInternals.verify(J9VMInternals.java:69)
                at java.lang.J9VMInternals.initialize(J9VMInternals.java:131)
                at com.gargoylesoftware.htmlunit.WebClient.createWebConnection(WebClient.java:1991)
                at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:121)
                at org.jboss.jsfunit.framework.WebConversationFactory.makeWebClient(WebConversationFactory.java:127)
                at org.jboss.jsfunit.framework.WebClientSpec.<init>(WebClientSpec.java:116)
                at org.jboss.jsfunit.framework.WebClientSpec.<init>(WebClientSpec.java:94)
                at org.jboss.jsfunit.framework.WebClientSpec.<init>(WebClientSpec.java:78)
                at JSFUnitTest.testInitialPage(JSFUnitTest.java:127)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:618)
                at junit.framework.TestCase.runTest(TestCase.java:154)
                at junit.framework.TestCase.runBare(TestCase.java:127)
                at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153)
                at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119)
                at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93)
                at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:224)
                at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)
                at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101)
                at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:224)
                at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)
                at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doPost(JSFUnitServletRedirector.java:46)
                at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72)
                at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:224)
                at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)
                at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doGet(JSFUnitServletRedirector.java:52)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
                at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1151)
                at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1086)
                at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
                at org.jboss.jsfunit.framework.JSFUnitFilter.doFilter(JSFUnitFilter.java:119)
                at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
                at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
                at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
                at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:834)
                at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:682)
                at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:588)
                at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:489)
                at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
                at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:748)
                at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466)
                at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:119)
                at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
                at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
                at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:267)
                at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1037)
                at com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:644)
                at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1818)
                at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
                at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
                at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
                at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
                at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
                at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
                at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
                at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
            Caused by: java.lang.ClassNotFoundException: org.apache.http.HttpRequest
                at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java:587)
                at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:422)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:597)
                ... 60 more

            --------------------------------------------------------------------------------------------------

             

            I will also keep trying to find the error, but I would really appreciate if you could also send me the previous listing of libraries, if possible.

            Thank you very much.

             

            Euler.

            • 3. Re: Incompatibility among related classes?
              ssilvert

              You are missing httpcore-4.0.1.jar.  I accedentally left it off the Getting Started page.  I'll fix that right now.

               

              Stan

              • 4. Re: Incompatibility among related classes?
                exosys

                I had tried it before, but then I get a new problem:

                 

                ------------------------------------------------------------------------------------------------------------------------------------

                java.lang.NullPointerException
                    at org.jboss.jsfunit.framework.FaceletsErrorPageException.isFaceletsErrorPage(FaceletsErrorPageException.java:55)
                    at org.jboss.jsfunit.framework.FaceletsErrorPageDetector.afterRequest(FaceletsErrorPageDetector.java:39)
                    at org.jboss.jsfunit.framework.JSFUnitWebConnection.notifyListenersAfter(JSFUnitWebConnection.java:101)
                    at org.jboss.jsfunit.framework.JSFUnitWebConnection.getResponse(JSFUnitWebConnection.java:83)
                    at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1405)
                    at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1324)
                    at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:303)
                    at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:369)
                    at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:354)
                    at org.jboss.jsfunit.framework.SimpleInitialRequestStrategy.doInitialRequest(SimpleInitialRequestStrategy.java:48)
                    at org.jboss.jsfunit.framework.FormAuthenticationStrategy.doInitialRequest(FormAuthenticationStrategy.java:104)
                    at org.jboss.jsfunit.framework.WebClientSpec.doInitialRequest(WebClientSpec.java:259)
                    at org.jboss.jsfunit.jsfsession.JSFSession.<init>(JSFSession.java:81)
                    at JSFUnitTest.testInitialPage(JSFUnitTest.java:132)
                    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                    at java.lang.reflect.Method.invoke(Method.java:618)
                    at junit.framework.TestCase.runTest(TestCase.java:154)
                    at junit.framework.TestCase.runBare(TestCase.java:127)
                    at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153)
                    at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119)
                    at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93)
                    at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:224)
                    at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)
                    at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101)
                    at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:224)
                    at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)
                    at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doPost(JSFUnitServletRedirector.java:46)
                    at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72)
                    at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:224)
                    at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)
                    at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doGet(JSFUnitServletRedirector.java:52)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
                    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1151)
                    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1086)
                    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
                    at org.jboss.jsfunit.framework.JSFUnitFilter.doFilter(JSFUnitFilter.java:119)
                    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
                    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
                    at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
                    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:834)
                    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:682)
                    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:588)
                    at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:489)
                    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3453)
                    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)
                    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815)
                    at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466)
                    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:119)
                    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
                    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
                    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:267)
                    at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1037)
                    at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.readyInboundPostHandshake(SSLConnectionLink.java:725)
                    at com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyHandshakeCompletedCallback.complete(SSLConnectionLink.java:412)
                    at com.ibm.ws.ssl.channel.impl.SSLUtils.handleHandshake(SSLUtils.java:841)
                    at com.ibm.ws.ssl.channel.impl.SSLHandshakeIOCallback.complete(SSLHandshakeIOCallback.java:70)
                    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
                    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
                    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
                    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
                    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
                    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
                    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
                    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)

                ------------------------------------------------------------------------------------------------------------------------------------

                 

                The set of libraries is now complete, but remains (1)incompatible or (2)my system is somehow misconfigured. Just to remember, the previous listing of libraries worked well, and I am almost sure I didn't change any other relevant information in my project. That's why I think option (1) is more plausible.

                Do you have any idea for help me solving this, please? Thanks in advance!

                 

                Euler.

                • 5. Re: Incompatibility among related classes?
                  ssilvert

                  I notice you are using WebSphere.  Did you follow these special instructions?

                   

                  Stan

                  • 6. Re: Incompatibility among related classes?
                    exosys

                    I had read those instructions, but did not follow them, because I could run my test with no problems.

                    Here I can post my original source code, and you will see that I used FormAuthenticationStrategy successfully:

                    ---------------------------------------------------------------------------------------------------------------

                    public class JSFUnitTest extends org.apache.cactus.ServletTestCase
                    {
                        public JSFUnitTest() {
                            Security.setProperty("ssl.SocketFactory.provider", "com.ibm.jsse2.SSLSocketFactoryImpl");
                            Security.setProperty("ssl.ServerSocketFactory.provider", "com.ibm.jsse2.SSLServerSocketFactoryImpl");
                        }
                       
                        public static Test suite()
                        {
                           return new TestSuite( JSFUnitTest.class );
                        }

                     

                        public void testInitialPage() throws IOException
                        {
                            WebClientSpec wcSpec = new WebClientSpec("/login.jsp");
                            String nome = FacesUtil.getMessageResourceString(Constants.NOME_USUARIO_TESTE);
                            String senha = FacesUtil.getMessageResourceString(Constants.SENHA_USUARIO_TESTE);
                            FormAuthenticationStrategy formAuth = new FormAuthenticationStrategy(nome, senha, "botao_entrar");    
                            wcSpec.setInitialRequestStrategy(formAuth);
                            JSFSession jsfSession = new JSFSession(wcSpec);
                            JSFClientSession client = jsfSession.getJSFClientSession();
                            JSFServerSession server = jsfSession.getJSFServerSession();
                           
                            Element c = client.getElement("formBarraOpcoes:nomeUsuario");
                            assertEquals("Usuario: User Name", c.getChildNodes().item(0).getNodeValue());
                            client.click("id_simulacao_usuario");
                            HtmlForm form = (HtmlForm)client.getElement("formTodasPaginas");
                           
                            List<HtmlInput> inputTags = (List<HtmlInput>)form.getByXPath("//input[lower-case(@type)='radio' and @value='tipoRegistroAluno']");
                            inputTags.get(0).click();

                     

                            client.setValue("chave_de_pesquisa", "2007665439");
                        client.click("botao_processar_simulacaoUsuario");
                       
                        client = jsfSession.getJSFClientSession();
                            client.click("botao_elaborar_proposta_menu");
                            Element nomeAlunoPagina = client.getElement("nomeAlunoPagina");
                            assertEquals("SIMULATION - User name simulation", nomeAlunoPagina.getFirstChild().getNodeValue());
                        }
                    }

                    ---------------------------------------------------------------------------------------------------------------

                    • 7. Re: Incompatibility among related classes?
                      ssilvert

                      I think you must have JSFUnit 1.2 in your classpath somewhere.  I seem to remember an error like this when I was upgrading the code base to use HtmlUnit 2.8.

                       

                      Stan

                      • 8. Re: Incompatibility among related classes?
                        exosys

                        Stan,

                        I found out that the following set worked well for me:

                         

                        ant-1.5.4.jar
                        apache-mime4j-0.6.jar
                        aspectjrt-1.2.1.jar
                        cactus-13-1.7.1.jar
                        cactus-ant-13-1.7.1.jar
                        cargo-0.5.jar
                        commons-codec-1.4.jar
                        commons-collections-3.2.1.jar
                        commons-httpclient-3.1.jar
                        commons-lang-2.4.jar
                        commons-logging-1.1.1.jar
                        cssparser-0.9.5.jar
                        htmlunit-2.7.jar
                        htmlunit-core-js-2.7.jar
                        httpclient-4.0.1.jar
                        httpcore-4.0.1.jar
                        httpmime-4.0.1.jar
                        jboss-jsfunit-core-1.2.0.Final.jar
                        junit-3.8.1.jar
                        nekohtml-1.9.14.jar
                        sac-1.3.jar

                         

                        I consider now that my first question has been answered. However, I am going to upgrade my Websphere Server from version 6.1 to 7.0. Some new questions are about to come.

                        Thanks for you attention!

                        • 9. Re: Incompatibility among related classes?
                          ssilvert

                          In that case, you are definitely using JSFUnit 1.2 and not JSFUnit 1.3.  JSFUnit 1.3 won't work with HtmlUnit 2.7.

                           

                          Stan

                          • 10. Re: Incompatibility among related classes?
                            exosys

                            Stan,

                            I have noticed that, when I use JSFUnit 1.3, the failure related to the last stack trace I sent you (org.jboss.jsfunit.framework.FaceletsErrorPageException.isFaceletsErrorPage(FaceletsErrorPageException.java:55)), strangely only occurs if I try to connect over https but not when I connect over http! When I use JSFUnit 1.2, however, https works fine! Do you have any clue?

                            I see our scope is moving towards another subject, then I am going to start a new thread posting details about that, in case I consider useful for our community.

                             

                            Best regards,

                            Euler.