11 Replies Latest reply on Mar 4, 2008 12:57 PM by dazhong han

    war file deployed is notworking!!

    dazhong han Newbie

      Hello,

      My war file deployed to Jboss is not working. To verify this is not a problem of my code, I downloaded the HelloWorld servlet and test it.
      I created a war file and deployed it to jboss. I get same error message:
      type Exception report

      message

      description The server encountered an internal error () that prevented it from fulfilling this request.

      exception

      javax.servlet.ServletException: Wrapper cannot find servlet class com.tmg.servlets.HelloWorld or a class it depends on
      org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      java.lang.Thread.run(Thread.java:595)


      root cause

      java.lang.ClassNotFoundException: com.tmg.servlets.HelloWorld
      org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
      org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
      org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      java.lang.Thread.run(Thread.java:595)


      note The full stack trace of the root cause is available in the JBossWeb/2.0.1.GA logs.


      The war file contains class fil, web.xml. can any body help? Thanks!

        • 1. Re: war file deployed is notworking!!
          Peter Johnson Master

          Please post the contents of you war file. Do this:

          jar -tf xxx.war

          and post the results.

          • 2. Re: war file deployed is notworking!!
            dazhong han Newbie

            I can not attach my war file. here are containts of my war file:

            HelloWorld.class
            HelloWorld.java
            web.xml
            Manifest.mf ( idon't know where is this file came from. I did not have that file)

            That's it. Thanks!

            • 3. Re: war file deployed is notworking!!
              Peter Johnson Master

              I know you cannot attach the war file, that is why I told you to run the jar utility and post its output. Please do so. If the list of files you gave is accurate, then your war file is not built correctly.

              Also, please post the contents of web.xml. Make sure you surround the contents with [ code ]...[ /code ] brackets (without the spaces), and preview your post before submitting (raw xml content will not post correctly).

              • 4. Re: war file deployed is notworking!!
                dazhong han Newbie

                Thanks, Sir,

                Now I can see the HelloWorld example after modifying the build.xml. But I still can not see my own application which invokes MS SQL server.
                The meesage I have is :

                2008-03-03 12:28:21,156 ERROR [STDERR] java.lang.ClassNotFoundException: No ClassLoaders found for: com.microsoft.jdbc.sqlserver.SQLServerDriver


                It seems the MSSQL jar files are not found. But I
                did include them in the jar war file.
                I should send you my war file but when I run the
                jar or war commands in coomandline, it says there is no
                jar command recognized. But I did use "war" in
                my build.xml. Could you please tell what I have to set to make coommand line knows the jar coomand?
                Thanks!

                • 5. Re: war file deployed is notworking!!
                  Peter Johnson Master

                  The jar command is in JAVA_HOME/bin, make sure that is in your PATH.

                  Place the JAR file containing the JDBC driver into the server/xxx/lib directory.

                  • 6. Re: war file deployed is notworking!!
                    dazhong han Newbie


                    This is my war file:

                    META-INF/
                    META-INF/MANIFEST.MF
                    classes/
                    classes/com/
                    classes/com/tmg/
                    classes/com/tmg/servlets/
                    lib/
                    src/
                    src/com/
                    src/com/tmg/
                    src/com/tmg/servlets/
                    classes/com/tmg/servlets/FileNetServlet.class
                    classes/com/tmg/servlets/HelloWorld.class
                    filenet.properties
                    lib/log4j-1.2.15.jar
                    lib/msbase.jar
                    lib/mssqlserver.jar
                    lib/msutil.jar
                    log4j.properties
                    src/com/tmg/servlets/FileNetServlet.java
                    src/com/tmg/servlets/HelloWorld.java
                    web.xml
                    WEB-INF/
                    WEB-INF/web.xml

                    my web.xml:
                    <!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>

                    <servlet-name>tmgfile</servlet-name>
                    <servlet-class>com.tmg.servlets.FileNetServlet</servlet-class>

                    <init-param>
                    <param-name>log4j-init-file</param-name>
                    <param-value>/WEB-INF/log4j.properties</param-value>
                    </init-param>



                    <servlet-name>helloworld</servlet-name>
                    <servlet-class>com.tmg.servlets.HelloWorld</servlet-class>


                    <servlet-mapping>
                    <servlet-name>tmgfile</servlet-name>
                    <url-pattern>/tmgfile</url-pattern>
                    </servlet-mapping>
                    <servlet-mapping>
                    <servlet-name>helloworld</servlet-name>
                    <url-pattern>/helloworld</url-pattern>
                    </servlet-mapping>

                    </web-app>

                    my build.xml:



































                    <!-- Create build/dist directories as needed -->








                    <!--javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="project.class.path"/-->






                    <!--fileset dir="${build.dir}"/-->
                    <!--fileset dir="${basedir}/WEB-INF" excludes="${class.dir}"/-->








                    Please take a look and let me know what I did wrong. Thanks!


                    • 7. Re: war file deployed is notworking!!
                      dazhong han Newbie

                      Sorry, this my build.xml




































                      <!-- Create build/dist directories as needed -->








                      <!--javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="project.class.path"/-->






                      <!--fileset dir="${build.dir}"/-->
                      <!--fileset dir="${basedir}/WEB-INF" excludes="${class.dir}"/-->







                      • 8. Re: war file deployed is notworking!!
                        Peter Johnson Master

                         

                        Make sure you surround the contents with [ code ]...[ /code ] brackets (without the spaces), and preview your post before submitting (raw xml content will not post correctly).


                        In your war file, the classes directory is in the wrong location, it should be in WEB-INF. Ditto for the lib directory.

                        • 9. Re: war file deployed is notworking!!
                          dazhong han Newbie

                          Thanks, Sir,

                          I am getting closer. Now Jboss can find my class file and run my class file. It is also indicates it has been able to make MS SQL server connection.
                          The only problem is ii can not find my jsp file and a
                          property file. I check the war file and found the pass of jsp file and property file are incorrect.
                          The jsp file path is
                          project/jsp/**.jsp
                          and the path of propety file should be
                          project/WEB-INF/**.properties

                          But in the war file, they are
                          project/**.jsp

                          project/**.properties

                          I just can not make the path right. Here is my
                          code of war in build.xml. Could you please indicate
                          what wrong cause this problem?









                          • 10. Re: war file deployed is notworking!!
                            dazhong han Newbie

                            Sorry, here is my code for war

                            <target name="war" depends ="compile" description="Generate the runtime war">
                             <war warfile="${dist.dir}/${app.name}.war" webxml="${basedir}/WEB-INF/web.xml">
                             <fileset dir="${basedir}/WEB-INF/classes"/>
                             <fileset dir="${basedir}/jsp"/>
                             <lib dir="${lib.dir}"/>
                            
                             </war>
                             </target>
                            


                            • 11. Re: war file deployed is notworking!!
                              dazhong han Newbie

                              Thank, Mr. Peter Johnson,

                              I have solved all problems. My application is
                              working. thanks for your help!