5 Replies Latest reply on Apr 2, 2002 12:54 PM by Pravir

    PetStore, JB-2.4.3_TC-4.0 & ClassCastException w/

    jim a Newbie

      I'm having trouble getting PetStore 1.1.2 (with the
      patch) running inside the JBoss-2.4.3_Tomcat-4.0
      release.

      I hacked Debug.java to turn on debugging and Hacked
      web.xml to order attributes correctly so that parsing
      would get as far as possible inside MainServlet.java.
      But now I'm stuck. IT looks like a crimson.jar version
      mismatch between the tomcat build and the jboss build.
      Has anyone gotten this to run?

      Below is the stack trace. The initial cause is a
      class-cast exception. I added a printStackTrace()
      in loadDocument() at line 90 to get the first
      stack trace.


      [Default] MainServlet: Initializing
      [Default] ScreenFlowXmlDAO error: java.lang.ClassCastException: org.apache.crims
      on.jaxp.DocumentBuilderFactoryImpl
      [Default] java.lang.ClassCastException: org.apache.crimson.jaxp.DocumentBuilderF
      actoryImpl
      [Default] at javax.xml.parsers.DocumentBuilderFactory.newInstance(Document
      BuilderFactory.java:78)
      [Default]
      [Default] at com.sun.j2ee.blueprints.petstore.control.web.ScreenFlowXmlDAO
      .loadDocument(ScreenFlowXmlDAO.java:72)
      [Default]
      [Default] at com.sun.j2ee.blueprints.petstore.control.web.ScreenFlowXmlDAO
      .loadRequestMappings(ScreenFlowXmlDAO.java:115)
      [Default]
      [Default] at com.sun.j2ee.blueprints.petstore.control.web.MainServlet.init
      (MainServlet.java:47)

      ...

      [Default] at org.apache.catalina.connector.http.HttpProcessor.run(Unknown
      Source)
      [Default]
      [Default] at java.lang.Thread.run(Unknown Source)
      [Default]
      [EmbeddedCatalinaServiceSX] StandardWrapperValve[webTierEntryPoint]: Allocate ex
      ception for servlet webTierEntryPoint
      javax.servlet.ServletException: Servlet.init() for servlet webTierEntryPoint thr
      ew exception
      at org.apache.catalina.core.StandardWrapper.load(Unknown Source)
      at org.apache.catalina.core.StandardWrapper.allocate(Unknown Source)
      at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source)

      ...

      at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
      at org.apache.catalina.connector.http.HttpProcessor.process(Unknown Sour
      ce)
      at org.apache.catalina.connector.http.HttpProcessor.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      [EmbeddedCatalinaServiceSX] ----- Root Cause -----
      java.lang.NullPointerException
      at com.sun.j2ee.blueprints.petstore.control.web.ScreenFlowXmlDAO.getRequ
      estMappings(ScreenFlowXmlDAO.java:250)
      at com.sun.j2ee.blueprints.petstore.control.web.ScreenFlowXmlDAO.loadReq
      uestMappings(ScreenFlowXmlDAO.java:116)
      at com.sun.j2ee.blueprints.petstore.control.web.MainServlet.init(MainSer
      vlet.java:47)
      at javax.servlet.GenericServlet.init(GenericServlet.java:258)

      ...

        • 1. Re: PetStore, JB-2.4.3_TC-4.0 & ClassCastException w/
          jim a Newbie

          I figured out how to get PetStore to run inside
          JBoss-2.4.3_Tomcat-4.0.zip

          - Follow all the normal installation instructions
          for running embedded tomcat.

          - remove the "set JAXP" lines from JBoss's run.bat.
          These lines dont seem to effect startup nor execution
          of JBOss/embedded-Catalina.

          - fix petstore/src/build.xml to put the jaxp classpath
          fragment in front of j2ee.classpath.

          - edit petstore/src/com.sun.j2ee.blueprints.petstore.
          control.web/ScreenFlowXmlDAO and remove "root.normalize()"
          at line 76.


          • 2. Re: PetStore, JB-2.4.3_TC-4.0 & ClassCastException w/
            jim a Newbie

            Below are the changes that I made to
            petstore/src/docroot/WEB-INF/web.xml so that it
            would parse correctly.

            - move servlet-mappings below tags.

            - reorder type-attributes in <env-entry> tags.


            <servlet-name>webTierEntryPoint</servlet-name>
            <display-name>centralServlet</display-name>
            no description
            <servlet-class>com.sun.j2ee.blueprints.petstore.control.web.MainServlet</servlet-class>



            <servlet-name>populateServlet</servlet-name>
            <display-name>Populate Servlet</display-name>
            no description
            <servlet-class>com.sun.j2ee.blueprints.tools.populate.web.PopulateServlet</servlet-class>


            <servlet-mapping>
            <servlet-name>webTierEntryPoint</servlet-name>
            <url-pattern>/control/*</url-pattern>
            </servlet-mapping>

            <servlet-mapping>
            <servlet-name>populateServlet</servlet-name>
            <url-pattern>/populate</url-pattern>
            </servlet-mapping>

            ...

            <env-entry>
            <env-entry-name>ejb/catalog/CatalogDAOClass</env-entry-name>
            <env-entry-value>com.sun.j2ee.blueprints.shoppingcart.catalog.dao.CatalogDAOImpl</env-entry-value>
            <env-entry-type>java.lang.String</env-entry-type>
            </env-entry>
            <env-entry>
            <env-entry-name>ejb/profilemgr/ProfileMgrDAOClass</env-entry-name>
            <env-entry-value>com.sun.j2ee.blueprints.personalization.profilemgr.dao.ProfileMgrDAOImpl</env-entry-value>
            <env-entry-type>java.lang.String</env-entry-type>
            </env-entry>
            <env-entry>
            <env-entry-name>server/ServerType</env-entry-name>
            <env-entry-value>JBoss 2.4 BETA</env-entry-value>
            <env-entry-type>java.lang.String</env-entry-type>
            </env-entry>

            • 3. Re: PetStore, JB-2.4.3_TC-4.0 & ClassCastException w/
              akeijou Newbie

              jimmya, i was having the same problem. thanks very much for posting your findings. i would never, never have been able to figure that one out on my own.
              --meg

              • 4. Re: PetStore, JB-2.4.3_TC-4.0 & ClassCastException w/
                Todd Marshall Newbie

                Seems like removing the JAX stuff from jboss's run.sh file was the key.

                I had done everything else but that, and it still wasn't working. Pull the jax stuff out and bam, I can go to bed. :)

                thanks a bunch jimmy.

                -Todd

                • 5. Re: PetStore, JB-2.4.3_TC-4.0 & ClassCastException w/
                  Pravir Newbie

                  Hi,
                  with jboss-3.0.0beta_ Tomcat 4.x , run.sh doesn not have the JAX entry.
                  I get the following exception while deploying the example InterestServlet .
                  ********
                  2002-04-02 09:23:04,325 ERROR [org.jboss.web.catalina.EmbeddedCatalinaServiceSX] StandardWrapperValve[InterestServlet]: Allocate exception for servlet InterestServlet
                  javax.servlet.ServletException: Failed to lookup java:comp/env/ejb/Interest
                  at org.jboss.docs.interest.InterestServlet.init(InterestServlet.java:46)
                  at javax.servlet.GenericServlet.init(GenericServlet.java:258)
                  at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:916)
                  at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:653)
                  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
                  at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
                  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
                  at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
                  at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
                  at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
                  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                  at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
                  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
                  at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
                  at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
                  at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
                  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
                  at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
                  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
                  at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
                  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                  at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
                  at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
                  at java.lang.Thread.run(Thread.java:484)
                  2002-04-02 09:23:04,348 ERROR [org.jboss.web.catalina.EmbeddedCatalinaServiceSX] ----- Root Cause -----
                  javax.naming.NameNotFoundException: env not bound
                  at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
                  at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
                  at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
                  at org.jnp.server.NamingServer.lookup(NamingServer.java:253)
                  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:365)
                  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:473)
                  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:349)
                  at javax.naming.InitialContext.lookup(InitialContext.java:350)
                  at org.jboss.docs.interest.InterestServlet.init(InterestServlet.java:39)
                  at javax.servlet.GenericServlet.init(GenericServlet.java:258)
                  at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:916)
                  at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:653)
                  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
                  at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
                  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
                  at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
                  at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
                  at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
                  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                  at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
                  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
                  at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
                  at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
                  at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
                  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
                  at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
                  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
                  at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
                  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                  at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                  at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
                  at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
                  at java.lang.Thread.run(Thread.java:484)
                  2002-04-02 09:24:54,466 INFO [org.jboss.system.Server] Shutting down all services
                  2002-04-02 09:24:54,467 INFO [Default] Shutting down
                  2002-04-02 09:24:54,469 INFO [org.jboss.system.ServiceController] Stopping 54 services