11 Replies Latest reply on Aug 6, 2008 12:55 PM by peterj

    Application Error - Resource not Found

    shawn.geraghty

      Hello:

      I have run into a situation with JBoss that I can't seem to debug. I have a development environment set up locally where I can deploy our web app in a context called "turtle". We also have an administration tool web app that I am just beginning to work on called "csa". The issue I have is that I can't access the app via JBoss.

      Using the URL for the main app in the turtle context, i.e. http://localhost:8080/turtle/index.jsp works just fine. But if I try http://localhost:8080/csa/index.jsp I get the following:

      HTTP Status 404 - /csa
      type Status report
      message /csa
      description The requested resource (/csa) is not available.
      Apache Tomcat/5.0.28

      I know the app is deploying .. I can see from the server.log file the the war file is initialized and started. Also, this works in our QA, staging, and production environments, just not locally.

      I reallly can't find any other info to debug this ... like in the error.log or access.log files.

      Is there anywhere else I can check for clues as to why the csa context/resource is not working?

      Thanks.

        • 1. Re: Application Error - Resource not Found
          peterj

          Please post the log messages that deal with deploying the csa app.

          You do not, by any chance, have a context root set in meta-inf/jboss-web.xml?

          • 2. Re: Application Error - Resource not Found
            shawn.geraghty

            PeterJ, thanks for the reply.

            No, I've checked the various META-INF directories and there isn't a jboss-web.xml files. I did however find these files in the WEB-INF directories created via the respective .war files, in this case turtle.war and csa.war. However neither of them contain a ContextRoot element.

            I have made some progress on this. If I use the URL

            http://localhost:8080/turtle/csa

            I do get a page of the csa application. Not the login page with is the default redirect from the csa/index.jsp file, but actually a partial application page with a 404 error embedded in it. I would expect to have hit the index.jsp file since no page was specified.

            From here if I click on one of the links from that page, whick looks like this

            http://localhost:8080/turtle/controller.jsp?TrufinaWebRequest=processCustRecord

            It redirects me to the login page. From there everything works fine.

            Interestingly, if I add a "/" to the end of the .../turtle/csa/ URL above, this still doesn't work.

            Thanks to anyone who can make sense of this jibberish.

            sg

            • 3. Re: Application Error - Resource not Found
              peterj

              That was a typo in my part, I meant web-inf, not meta-inf. Please post the web.xaml and jboss-web.xml files for csa.

              Also, please post the full path name for both the turtle.war and csa.war files. Also, are they files or directories?

              Finally, are you using a portal of any kind? The partial page with embedded 404 sounds like something you might get when using a portal, or even when embedding an iframe in your page.

              P.S. Remember to enclose your XML text in UBBCode "code" tags - you can do this by selecting the XML text and clicking the Code button above the editor window. Also, click the Preview button to ensure that the formatting is correct and the XML text shows up before posting.

              • 4. Re: Application Error - Resource not Found
                shawn.geraghty

                Here are the links to the turtle.war and csa.war directories.

                /usr/local/jboss/server/default/tmp/deploy/tmp52561turtle-turtle.ear-contents/turtle.war

                and


                /usr/local/jboss/server/default/tmp/deploy/tmp52560csa-turtle.ear-contents/csa.war

                Inside each directory is the expanded war file ... jsp pages and xml files.


                Here is the turtle.war/web-xml file:

                <?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>Trufina</display-name>
                 <description>Trufina website version1.0</description>
                
                 <servlet>
                 <servlet-name>SessionController</servlet-name>
                 <display-name>SessionController</display-name>
                 <servlet-class>com.trufina.web.controller.SessionController</servlet-class>
                <!--
                 <jsp-file>/reg/controller.jsp</jsp-file>
                -->
                 </servlet>
                
                <!-- Trufina API Server -->
                 <servlet>
                 <servlet-name>TrufinaAPIServer</servlet-name>
                 <display-name>Trufina API Server</display-name>
                 <servlet-class>com.trufina.webservice.api.TrufinaAPIServer</servlet-class>
                 </servlet>
                
                <!-- Trufina API Validator -->
                 <servlet>
                 <servlet-name>TrufinaAPIValidator</servlet-name>
                 <display-name>Trufina API Validator</display-name>
                 <servlet-class>com.trufina.webservice.api.TrufinaAPIValidator</servlet-class>
                 </servlet>
                
                <!-- Trufina Free Look Server -->
                 <servlet>
                 <servlet-name>TrufinaIDServer</servlet-name>
                 <display-name>Trufina Free Look Server</display-name>
                 <servlet-class>com.trufina.webservice.freelook.TrufinaIDServer</servlet-class>
                 </servlet>
                
                 <servlet-mapping>
                 <servlet-name>SessionController</servlet-name>
                 <url-pattern>/reg/SessionController</url-pattern>
                 </servlet-mapping>
                
                 <servlet-mapping>
                 <servlet-name>TrufinaAPIServer</servlet-name>
                 <url-pattern>/TrufinaAPIServer</url-pattern>
                 </servlet-mapping>
                
                 <servlet-mapping>
                 <servlet-name>TrufinaAPIValidator</servlet-name>
                 <url-pattern>/TrufinaAPIValidator</url-pattern>
                 </servlet-mapping>
                
                 <servlet-mapping>
                 <servlet-name>TrufinaIDServer</servlet-name>
                 <url-pattern>/TrufinaIDServer</url-pattern>
                 </servlet-mapping>
                
                 <session-config>
                 <session-timeout>30</session-timeout>
                 </session-config>
                
                 <error-page>
                 <error-code>404</error-code>
                 <location>/404.htm</location>
                 </error-page>
                
                 <security-constraint>
                 <web-resource-collection>
                 <web-resource-name>Trufina Protected Areas</web-resource-name>
                 <url-pattern>/mytrufina/*</url-pattern>
                 <url-pattern>/test/snoop2.jsp</url-pattern>
                 <http-method>DELETE</http-method>
                 <http-method>GET</http-method>
                 <http-method>POST</http-method>
                 <http-method>PUT</http-method>
                 </web-resource-collection>
                 <auth-constraint>
                 <role-name>*</role-name>
                 </auth-constraint>
                 </security-constraint>
                
                 <login-config>
                 <auth-method>FORM</auth-method>
                 <form-login-config>
                 <form-login-page>/LoginForm.jsp</form-login-page>
                 <form-error-page>/LoginError.jsp</form-error-page>
                 </form-login-config>
                 </login-config>
                
                 <security-role>
                 <description>Trufina Roles</description>
                 <role-name>trufina_guest</role-name>
                 </security-role>
                
                </web-app>
                
                


                Here is the csa.war.web-xml file:
                <?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>TrufinaCSA</display-name>
                 <description>TrufinaCSA website version1.0</description>
                 <distributable/>
                 <context-param>
                 <param-name>basePath</param-name>
                 <param-value>http://localhost:8080/</param-value>
                 <description>TrufinaCSA root context path</description>
                 </context-param>
                 <context-param>
                 <param-name>rootPathSecured</param-name>
                 <param-value>@rootPathSecured@</param-value>
                 <description>TrufinaCSA secured (SSL) root context path with the IP address or site name</description>
                 </context-param>
                 <context-param>
                 <param-name>rootPathNonSecured</param-name>
                 <param-value>@rootPathNonSecured@</param-value>
                 <description>TrufinaCSA non-secured root context path with the IP address or site name, usually used to break the
                 https secure linking when exiting from it.
                 </description>
                 </context-param>
                 <session-config>
                 <session-timeout>30</session-timeout>
                 </session-config>
                 <welcome-file-list>
                 <welcome-file>index.jsp</welcome-file>
                 <welcome-file>index.htm</welcome-file>
                 <welcome-file>index.html</welcome-file>
                 <welcome-file>default.htm</welcome-file>
                 <welcome-file>default.html</welcome-file>
                 <welcome-file>default.jsp</welcome-file>
                 </welcome-file-list>
                 <error-page>
                 <error-code>404</error-code>
                 <location>/errorpages/err404.jsp</location>
                 </error-page>
                 <error-page>
                 <error-code>500</error-code>
                 <location>/errorpages/err500.jsp</location>
                 </error-page>
                 <!--
                 <taglib>
                 <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
                 <taglib-location>/WEB-INF/c.tld</taglib-location>
                 </taglib>
                 <taglib>
                 <taglib-uri>http://java.sun.com/jstl/core_rt</taglib-uri>
                 <taglib-location>/WEB-INF/c-rt.tld</taglib-location>
                 </taglib>
                 <taglib>
                 <taglib-uri>http://java.sun.com/jstl/xml</taglib-uri>
                 <taglib-location>/WEB-INF/x.tld</taglib-location>
                 </taglib>
                 <taglib>
                 <taglib-uri>http://java.sun.com/jstl/xml_rt</taglib-uri>
                 <taglib-location>/WEB-INF/x-rt.tld</taglib-location>
                 </taglib>
                 <taglib>
                 <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
                 <taglib-location>/WEB-INF/fmt.tld</taglib-location>
                 </taglib>
                 <taglib>
                 <taglib-uri>http://java.sun.com/jstl/fmt_rt</taglib-uri>
                 <taglib-location>/WEB-INF/fmt-rt.tld</taglib-location>
                 </taglib>
                 <taglib>
                 <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
                 <taglib-location>/WEB-INF/sql.tld</taglib-location>
                 </taglib>
                 <taglib>
                 <taglib-uri>http://java.sun.com/jstl/sql_rt</taglib-uri>
                 <taglib-location>/WEB-INF/sql-rt.tld</taglib-location>
                 </taglib>
                 <taglib>
                 <taglib-uri>http://jakarta.apache.org/taglibs/request-1.0</taglib-uri>
                 <taglib-location>/WEB-INF/request.tld</taglib-location>
                 </taglib>
                 <taglib>
                 <taglib-uri>http://jakarta.apache.org/taglibs/xtags-1.0</taglib-uri>
                 <taglib-location>/WEB-INF/xtags.tld</taglib-location>
                 </taglib>
                 <taglib>
                 <taglib-uri>http://jakarta.apache.org/taglibs/string-1.0.1</taglib-uri>
                 <taglib-location>/WEB-INF/string.tld</taglib-location>
                 </taglib>
                 <taglib>
                 <taglib-uri>http://jakarta.apache.org/taglibs/session-1.0</taglib-uri>
                 <taglib-location>/WEB-INF/session.tld</taglib-location>
                 </taglib>
                 <taglib>
                 <taglib-uri>http://jakarta.apache.org/taglibs/image-1.0</taglib-uri>
                 <taglib-location>/WEB-INF/image.tld</taglib-location>
                 </taglib>
                 -->
                </web-app>
                


                There are frames in this app, but no iframes.

                I also notice one other thing ... my turtle app runs perfect until I use the

                http://localhost:8080/turtle/csa

                URL. Once I get hit that URL the turtle app ceases to work and only csa app pages, or actually, csa pages with 404 errors on them appear. It appear as though the turtle and csa apps are sharing the same turtle context. But it doesn't make sense since both the turtle app and csa app have equivalent directory structures and I am assuming that to mean that accessing them should be done using

                http://localhost:8080/turtle

                and

                http://localhost:8080/csa

                Thanks.

                sg

                • 5. Re: Application Error - Resource not Found
                  peterj

                  First, the directory locations are incorrect. The 'tmp' directory is a temporary, working directory. I hope that you did not place the files there. You should have placed them into the /usr/local/jboss/server/default/deploy directory. If you did place the file in the 'tmp' directory, stop the app server, remove the /usr/local/jboss/server/default/tmp, /usr/local/jboss/server/default/work, and /usr/local/jboss/server/default/data directories. Then place the EAR archive into the the /usr/local/jboss/server/default/deploy directory. Then start the app server again.

                  Since you have the WARs embedded within an EAR, post your application.xml file. Also, post the jboss-app.xml file, if you have one. Both should be in the meta-inf directory.

                  I assume that since you did not post any jboss-web.xml files that you don't have any (earlier you implied that you did have jboss-web.xml file).

                  I also assume that the file names (turtle.war/web-xml, csa.war.web-xml) are typos, and that they are both actually named web.xml.

                  • 6. Re: Application Error - Resource not Found
                    shawn.geraghty

                    Actually, my ant buld script deploys to /usr/local/jboss-3.2.6/server/default/deploy, and I see the turtle-turtle.war and csa-turtle.war files there, but no corresponding directories.

                    So, I'm a little confused as to where to find the application.xml and jboss-app.xml files. Doing a find on the directory structure only locates them in ../tmp/deploy directories. Do I take the latest from there? Doesn't JBoss just xvf the ear, then war to these directories? With the latest one being the last deploy?

                    I do have jboss-web.xml files, but again, they reside in the temp directories.

                    And lastly, yes, that was a type ...they are name web.xml

                    Thanks.

                    sg



                    • 7. Re: Application Error - Resource not Found
                      peterj

                      If the application.xml, jboss-app.xml and jboss-web.xml files appear in the tmp directory, then they must be in the EAR and WAR war files. Therefore, your ant script is placing them in the those files as part of the build. Since it is your ant script and your build, you should know where those files are coming from. When you find them, post the jboss-web.xml file that gets packaged inside the csa.war.

                      Also, is your build placing both the csa.war and csa-turtle.ear files into the deploy directory? Or is the csa.war file embedded within csa-turtle.ear? I ask because based on your third post (where you gave the full path) the war is embedded within the ear but your latest post claims that the war is not in embedded within the ear (you said the war appears in the deploy directory). Run an "ls -al" on the deploy directory and post the results.

                      • 8. Re: Application Error - Resource not Found
                        shawn.geraghty

                        Here is the application.xml file:

                        <?xml version="1.0" encoding="UTF-8"?>
                        
                        <!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN' 'http://java.sun.com/dtd/application_1_3.dtd'>
                        
                        <application>
                         <display-name>TrufinaCSA</display-name>
                         <module>
                         <web>
                         <web-uri>csa.war</web-uri>
                         <context-root>turtle</context-root>
                         </web>
                         </module>
                        </application>
                        


                        Here is the jboss-app.xml file:

                        <?xml version="1.0" encoding="UTF-8"?>
                        
                        <!--
                         Document : jboss-app.xml
                         Created on : April 11, 2005, 1:27 PM
                         Author : Administrator
                         Description:
                         Purpose of the document follows.
                        -->
                        
                        <jboss-app>
                         <loader-repository>www.trufina.com:loader=csa-turtle</loader-repository>
                        </jboss-app>
                        


                        And here is the jboss-web.xml file:

                        <jboss-web>
                        <security-domain>java:/jaas/mytrufina_TrufinaDev</security-domain>
                        </jboss-web>



                        And here is the ls of the deploy directory:

                        rw-r--r--@ 1 slegg slegg 2048 Oct 14 2004 cache-invalidation-service.xml
                        -rw-r--r--@ 1 slegg slegg 1481 Oct 14 2004 client-deployer-service.xml
                        -rw-r--r-- 1 slegg slegg 9475965 Aug 1 18:11 csa-turtle.ear
                        -rw-r--r--@ 1 slegg slegg 384 Oct 14 2004 hibernate-deployer-service.xml
                        -rw-r--r--@ 1 slegg slegg 4486 Oct 14 2004 hsqldb-ds.xml
                        drwxr-xr-x@ 4 slegg slegg 136 Oct 14 2004 http-invoker.sar
                        -rw-r--r--@ 1 slegg slegg 123001 Oct 14 2004 jboss-jca.sar
                        -rw-r--r--@ 1 slegg slegg 6735 Oct 14 2004 jboss-local-jdbc.rar
                        -rw-r--r--@ 1 slegg slegg 12307 Oct 14 2004 jboss-xa-jdbc.rar
                        drwxr-xr-x@ 33 slegg slegg 1122 Jun 16 19:50 jbossweb-tomcat50.sar
                        drwxr-xr-x@ 11 slegg slegg 374 Jun 16 19:50 jms
                        drwxr-xr-x@ 11 slegg slegg 374 Aug 1 18:10 jmx-console.war
                        drwxr-xr-x@ 3 slegg slegg 102 Oct 14 2004 jmx-invoker-adaptor-server.sar
                        -rw-r--r--@ 1 slegg slegg 1580 Oct 14 2004 mail-service.xml
                        drwxr-xr-x@ 4 slegg slegg 136 Oct 14 2004 management
                        -rw-r--r--@ 1 slegg slegg 4025 Oct 14 2004 monitoring-service.xml
                        -rw-r--r--@ 1 slegg slegg 1830 Oct 14 2004 properties-service.xml
                        -rw-r--r--@ 1 slegg slegg 3906 Oct 14 2004 schedule-manager-service.xml
                        -rw-r--r--@ 1 slegg slegg 1784 Oct 14 2004 scheduler-service.xml
                        -rw-r--r--@ 1 slegg slegg 198 Oct 14 2004 sqlexception-service.xml
                        -rw-r--r--@ 1 slegg slegg 1348 Oct 14 2004 transaction-service.xml
                        -rw-r--r-- 1 slegg slegg 704 Jul 29 14:39 trufina_TrufinaDev-ds.xml
                        -rw-r--r-- 1 slegg slegg 10827882 Jul 29 14:39 turtle-turtle.ear
                        -rw-r--r--@ 1 slegg slegg 1103 Oct 14 2004 user-service.xml
                        -rw-r--r--@ 1 slegg slegg 5405 Oct 14 2004 uuid-key-generator.sar
                        


                        And yes, the csa.war file is contained within the csa-turtle.ear file.

                        So, from the application.xml file, I see the context-root is "turtle". Now in our QA, staging, and production environments, context-root is set to "latest", "stage", and "prod". I would assume that I have this incorrectly set here .... it should be something other than "turtle". Is this why my turtle app is getting hosed?

                        • 9. Re: Application Error - Resource not Found
                          peterj

                          Your assumption is correct - you need to change the context-root in the application.xml file for csa-turtle.ear. This is one of the hazards of copy-and-paste application development - you need to always make sure that you modify the appropriate things to prevent conflicts.

                          • 10. Re: Application Error - Resource not Found
                            shawn.geraghty

                            PeterJ

                            Sorry to have disappeared, but I've been dealing with resurrecting a crashed server.

                            We implement properties files for each environment to avoid the "cut-n-paste" hazards. But the odd thing is that our Ant build script is wrapped by another script for network deployment. In there was some scripting that changed the context based being deploy. So in effect, the context root was being change again .. and this didn't work for my local environment. Why that is there is a mystery since the build.xml file is no doubt the logical choice, especially since we use property file for each environment.

                            Anyhow, thanks for all your help in tracking this down. I've also started to delve into the JBoss documentation, in order to learn more. Any suggestions on docs would be appreciated.

                            • 11. Re: Application Error - Resource not Found
                              peterj

                              Based on an earlier post, I believe that you are using JBossAS 3.2.6. I don't know of any books on that version (well, I do know of one, but it appears to be more of a printing of the existing online documentation and is more internals focused). There are two book based on early versions of 4.0.x (4.0.2):

                              JBoss at Work: A Practical Guide
                              JBoss: A Developer's Notebook

                              It's been a while since I used 3.2.6 or looked at these books so I am not sure how well they match.