13 Replies Latest reply on Nov 26, 2002 2:36 AM by Craig Johannsen

    Unable to deploy template

    michal.strelec Newbie

      Hi All,
      I succesfully build template project of JBOSS, but I get folowing error about jndi names when trying to deploy project.
      What is wrong? Does anyone face similar problem.

      Thanks for any help,
      Mikee

      14:53:47,260 ERROR [URLDeploymentScanner] Failed to deploy:
      org.jboss.deployment.scanner.URLDeploymentScanner$DeployedURL@abae3bb4{
      url=file:/home/martinam/opt/jboss-3.0.4/server/default/deploy/web-client.war,
      deployedLastModified=0 }
      org.jboss.deployment.DeploymentException: ejb-ref:
      ejb/webtest/TestSession, no ejb-link match, use jndi-name in
      jboss-web.xml; - nested throwable: (javax.naming.NamingException:
      ejb-ref: ejb/webtest/TestSession, no ejb-link match, use jndi-name in
      jboss-web.xml)

        • 1. Re: Unable to deploy template
          Juha Lindfors Master

          check your deployment descriptors, especially the contents of your ejb-link, and ejb-name elements

          • 2. Re: Unable to deploy template
            michal.strelec Newbie

            Hi juha,
            Here's piece of my web.xml file
            <ejb-ref>
            <ejb-ref-name>ejb/webtest/TestSession</ejb-ref-name>
            <ejb-ref-type>Session</ejb-ref-type>
            test.interfaces.TestSessionHome
            test.interfaces.TestSession
            </ejb-ref>
            and jboss-web.xml file
            <ejb-ref>
            <ejb-ref-name>ejb/webtest/TestSession</ejb-ref-name>
            <jndi-name>ejb/test/TestSession</jndi-name>
            </ejb-ref>

            There is no ejb-link reference mentioned. This example is just normaly compiled jboss template. I face the same problem with sun J2EE reference examples. To be concerete it was sample ConverterApp.ear. This ear is deployable under sun j2ee server, but JBOSS says the same error message as temlate project.

            Any thoughts?

            Cheers,
            Michal

            • 3. Re: Unable to deploy template
              michal.strelec Newbie

              Hi All,
              I found the problem :-)
              I build the template in linux on mounted fat system. When linux tries to create WEB-INF directory it is automaticly converted to small case. After compilation my .war file included folowing structure
              ...
              WEB-INF/....
              web-inf/....
              ...
              And when deploying to JBOSS it didn't read the information from web-inf leading to deployment error.

              Really cool bug ;-)

              Cheers,
              Michal

              • 4. Re: Unable to deploy template
                michal.strelec Newbie

                Hi All,
                I found the problem :-)
                I build the template in linux on mounted fat system. When linux tries to create WEB-INF directory it is automaticly converted to small case. After compilation my .war file included folowing structure
                ...
                WEB-INF/....
                web-inf/....
                ...
                And when deploying to JBOSS it didn't read the information from web-inf leading to deployment error.

                Really cool bug ;-)

                Cheers,
                Michal

                • 5. Re: Unable to deploy template
                  michal.strelec Newbie

                  Hi All,
                  I found the problem :-)
                  I build the template in linux on mounted fat system. When linux tries to create WEB-INF directory it is automaticly converted to small case. After compilation my .war file included folowing structure
                  ...
                  WEB-INF/....
                  web-inf/....
                  ...
                  And when deploying to JBOSS it didn't read the information from web-inf leading to deployment error.

                  Really cool bug ;-)

                  Cheers,
                  Michal

                  • 6. Re: Unable to deploy template
                    michal.strelec Newbie

                    Hi All,
                    I found the problem :-)
                    I build the template in linux on mounted fat system. When linux tries to create WEB-INF directory it is automaticly converted to small case. After compilation my .war file included folowing structure
                    ...
                    WEB-INF/....
                    web-inf/....
                    ...
                    And when deploying to JBOSS it didn't read the information from web-inf leading to deployment error.

                    Really cool bug ;-)

                    Cheers,
                    Michal

                    • 7. Re: Unable to deploy template
                      michal.strelec Newbie

                      Hi All,
                      I found the problem :-)
                      I build the template in linux on mounted fat system. When linux tries to create WEB-INF directory it is automaticly converted to small case. After compilation my .war file included folowing structure
                      ...
                      WEB-INF/....
                      web-inf/....
                      ...
                      And when deploying to JBOSS it didn't read the information from web-inf leading to deployment error.

                      Really cool bug ;-)

                      Cheers,
                      Michal

                      • 8. Re: Unable to deploy template
                        michal.strelec Newbie

                        Hi All,
                        I found the problem :-)
                        I build the template in linux on mounted fat system. When linux tries to create WEB-INF directory it is automaticly converted to small case. After compilation my .war file included folowing structure
                        ...
                        WEB-INF/....
                        web-inf/....
                        ...
                        And when deploying to JBOSS it didn't read the information from web-inf leading to deployment error.

                        Really cool bug ;-)

                        Cheers,
                        Michal

                        • 9. Re: Unable to deploy template solution
                          michal.strelec Newbie

                          Hi All,
                          I found the problem :-)
                          I build the template in linux on mounted fat system. When linux tries to create WEB-INF directory it is automaticly converted to small case. After compilation my .war file included folowing structure
                          ...
                          WEB-INF/....
                          web-inf/....
                          ...
                          And when deploying to JBOSS it didn't read the information from web-inf leading to deployment error.

                          Really cool bug ;-)

                          Cheers,
                          Michal

                          • 10. Re: Unable to deploy template
                            Juha Lindfors Master

                            Is this name correct:

                            <jndi-name>ejb/test/TestSession</jndi-name>

                            I can't tell, you should include full descriptors.

                            • 11. Re: Unable to deploy template
                              Craig Johannsen Newbie

                              I have exactly the same problem deploying Andreas Shaefer's template application that was included with the JBoss 3 Examples. I am using JBoss-3.0.4-src, which I built using J2SDK1.4.1_01. JBoss is running on Win2000 SP3.

                              The relevant JSP code in the example, which I have modified only slightly for debugging purposes, is:
                              Context lContext = new InitialContext();
                              Object ref = lContext.lookup(
                              "java:comp/env/ejb/webtest/TestSession"
                              );
                              if (ref != null)
                              out.println("Lookup succeeded");
                              else
                              out.println("Lookup result null");
                              out.println("Type = " + ref.toString() + ", class = " +
                              ref.getClass().getName() + "");
                              TestSessionHome lHome = (TestSessionHome) ref;

                              The last line here gets the ClassCastException error.
                              I've tried using J2SDK1.4.0_03, with no better luck.
                              I've tried adding an <ejb-link> element in web.xml.
                              Simply restarting JBoss does not help either, so it is not a hot deploy problem.
                              Please note that this application is generated with XDoclet, so one doesn't normally mess with the generated parts of the code.

                              The TestSessionBean has the following XDoclet tags:
                              * @ejb:bean name="test/TestSession"
                              * display-name="Bug TestSession Bean"
                              * type="Stateful"
                              * transaction-type="Container"
                              * jndi-name="ejb/test/TestSession"
                              *
                              * @ejb:ejb-ref ejb-name="test/TestEntity"
                              * ref-name="mytest/TestEntity"
                              *
                              * @ejb:resource-ref res-name="test/Mail"
                              * res-type="javax.mail.Session"
                              * res-auth="Container"
                              *
                              * @jboss:resource-manager res-man-class="javax.mail.Session"
                              * res-man-name="test/Mail"
                              * res-man-jndi-name="java:Mail"


                              The generated web.xml is:
                              <?xml version="1.0" encoding="UTF-8"?>


                              <web-app>

                              <display-name>Web Client</display-name>

                              <!-- The Welcome File List -->
                              <welcome-file-list>
                              <welcome-file>index.jsp</welcome-file>
                              <welcome-file>index.html</welcome-file>
                              </welcome-file-list>

                              <ejb-ref>
                              <ejb-ref-name>ejb/webtest/TestSession</ejb-ref-name>
                              <ejb-ref-type>Session</ejb-ref-type>
                              test.interfaces.TestSessionHome
                              test.interfaces.TestSession
                              </ejb-ref>

                              </web-app>

                              Here is the relevant bit of the stack trace:
                              01:52:22,280 INFO [jbossweb] successfully deployed file:/E:/jboss-3.0.4-src/bui
                              ld/output/jboss-3.0.4/server/default/tmp/deploy/server/default/deploy/web-client
                              .war/69.web-client.war to /web-client
                              01:52:22,280 INFO [MainDeployer] Deployed package: file:/E:/jboss-3.0.4-src/bui
                              ld/output/jboss-3.0.4/server/default/deploy/web-client.war
                              01:58:06,114 ERROR [STDERR] java.lang.ClassCastException: $Proxy27
                              01:58:06,134 ERROR [STDERR] at org.apache.jsp.index$jsp._jspService(index$js
                              p.java:77)
                              01:58:06,134 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service
                              (HttpJspBase.java:107)
                              01:58:06,134 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpSe
                              rvlet.java:853)

                              The output of the index.jsp page is:
                              Web Client
                              The next ID of a Test Entity is:




                              Lookup succeeded
                              Type = ejb/test/TestSessionHome, class = $Proxy27
                              Caught exception: $Proxy27




                              Have fun and see you soon

                              • 12. Re: Unable to deploy template
                                Craig Johannsen Newbie

                                I have exactly the same problem deploying Andreas Shaefer's template application that was included with the JBoss 3 Examples. I am using JBoss-3.0.4-src, which I built using J2SDK1.4.1_01. JBoss is running on Win2000 SP3.

                                The relevant JSP code in the example, which I have modified only slightly for debugging purposes, is:
                                Context lContext = new InitialContext();
                                Object ref = lContext.lookup(
                                "java:comp/env/ejb/webtest/TestSession"
                                );
                                if (ref != null)
                                out.println("Lookup succeeded");
                                else
                                out.println("Lookup result null");
                                out.println("Type = " + ref.toString() + ", class = " +
                                ref.getClass().getName() + "");
                                TestSessionHome lHome = (TestSessionHome) ref;
                                The last line here gets the ClassCastException error.
                                I've tried using J2SDK1.4.0_03, with no better luck.
                                I've tried adding an <ejb-link> element in web.xml.
                                Simply restarting JBoss does not help either, so it is not a hot deploy problem. I didn't find any problem with the capitalization of "WEB-INF" in the expanded web-client.war. However, inside the actual web-client.war file, there is "WEB-INF" and "web-inf".

                                Please note that this application is generated with XDoclet, so one doesn't normally mess with the generated parts of the code.

                                The TestSessionBean has the following XDoclet tags:
                                * @ejb:bean name="test/TestSession"
                                * display-name="Bug TestSession Bean"
                                * type="Stateful"
                                * transaction-type="Container"
                                * jndi-name="ejb/test/TestSession"
                                *
                                * @ejb:ejb-ref ejb-name="test/TestEntity"
                                * ref-name="mytest/TestEntity"
                                *
                                * @ejb:resource-ref res-name="test/Mail"
                                * res-type="javax.mail.Session"
                                * res-auth="Container"
                                *
                                * @jboss:resource-manager res-man-class="javax.mail.Session"
                                * res-man-name="test/Mail"
                                * res-man-jndi-name="java:Mail"


                                The generated web.xml is:
                                <?xml version="1.0" encoding="UTF-8"?>
                                <!DOCTYPE web-app PUBLIC
                                "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
                                "http://java.sun.com/dtd/web-app_2_3.dtd">

                                <web-app>

                                <display-name>Web Client</display-name>

                                <!-- The Welcome File List -->
                                <welcome-file-list>
                                <welcome-file>index.jsp</welcome-file>
                                <welcome-file>index.html</welcome-file>
                                </welcome-file-list>

                                <ejb-ref>
                                <ejb-ref-name>ejb/webtest/TestSession</ejb-ref-name>
                                <ejb-ref-type>Session</ejb-ref-type>
                                test.interfaces.TestSessionHome
                                test.interfaces.TestSession
                                </ejb-ref>

                                </web-app>

                                Here is the relevant bit of the stack trace:
                                01:52:22,280 INFO [jbossweb] successfully deployed file:/E:/jboss-3.0.4-src/bui
                                ld/output/jboss-3.0.4/server/default/tmp/deploy/server/default/deploy/web-client
                                .war/69.web-client.war to /web-client
                                01:52:22,280 INFO [MainDeployer] Deployed package: file:/E:/jboss-3.0.4-src/bui
                                ld/output/jboss-3.0.4/server/default/deploy/web-client.war
                                01:58:06,114 ERROR [STDERR] java.lang.ClassCastException: $Proxy27
                                01:58:06,134 ERROR [STDERR] at org.apache.jsp.index$jsp._jspService(index$js
                                p.java:77)
                                01:58:06,134 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service
                                (HttpJspBase.java:107)
                                01:58:06,134 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpSe
                                rvlet.java:853)

                                The output of the index.jsp page is:
                                Web Client
                                The next ID of a Test Entity is:




                                Lookup succeeded
                                Type = ejb/test/TestSessionHome, class = $Proxy27
                                Caught exception: $Proxy27




                                Have fun and see you soon

                                • 13. Re: Unable to deploy template (fixed)
                                  Craig Johannsen Newbie

                                  Well, I solved this one myself. The problem was I had changed the Java2ClassLoadingCompliance setting in the jboss-service.xml file from true to false, which changed how classloading works. I did this to fix a class loading problem with struts. However, changing it back to true caused Andreas Schaefer's template web application to begin working properly.

                                  Here is the XML from jboss-service.xml:
                                  <!-- ================================================================== -->
                                  <!-- If true, Jetty first delegates loading a class to the webapp's -->
                                  <!-- parent class loader (a la Java 2). If false, Jetty follows the -->
                                  <!-- Servlet 2.3 specification, and tries the webapp's own loader -->
                                  <!-- first (for "non-system" classes) -->
                                  <!-- ================================================================== -->

                                  <!-- uncomment to address Struts classloading problem [added by CWJ]
                                  false
                                  -->
                                  true
                                  ================================================================== -->

                                  Now the problem is how to run struts and access an EJB at the same time. Do I need to explicitly set which classloader to use in my JSP page?