8 Replies Latest reply on Nov 6, 2002 6:45 AM by yaorong

    servlet can't run but jsp can

    yaorong

      Hello! I am trying JBoss3.0.0 with WebServer. Question 1:
      1)I copy my application to Jboss3.0.0/server/default/deploy/myapp.
      +myapp
      -META-INF
      -application.xml
      -web
      -jsp,html,image,js,css,etc
      -WEB-INF
      -classes
      -myservlet
      -lib
      -web.xml

      2)I modify Jboss3.0.0/server/default/config/jboss-service.xml, point "URLs" to "./deploy/myapp".

      3)Start Weblogic, http://localhost:8083 can work.

      4)html, jsp can run as well, but when I want to request a servlet, I only can see a blank page. And no error disappears on console.

      Why?

      Another question
      : I add some "System.out.println("xxx")" in jsp and servlet, but can't see any output I want. Maybe it is forbidden by JBoss3. How can I see the trace output I need?

      I am new to JBoss3. So if you can provide a sample ear that can deploy on it or some instrucations, you are appreciated. Thank you very much!

      yao


        • 1. Re: servlet can't run but jsp can
          joelvogt

          you can see your debug in server.log.

          How are you requesting your servlet? Do you have it mapped in your web.xml? Can you see any errors when jboss starts up? And why are you starting weblogic?

          • 2. Re: servlet can't run but jsp can
            yaorong

            Thank you!

            I write mapping in web.xml for the servlet. And "Start Weblogic" should be "Start JBoss". Now I find jboss ingnore all java codes in jsp, it act as a html.

            Why?

            • 3. Re: servlet can't run but jsp can
              joelvogt

              mok, something funny is going on with your configuration. I tell you what try this, change the name of your directory to
              myapp.war

              Then revert your jboss-service.xml to what it was on a clean install and try again.
              You should be able to use the myapp context and see your jsp.
              If this works you know the problem was with your config changes.

              • 4. Re: servlet can't run but jsp can
                yaorong

                Thanks a lot!

                I try as your instructions:
                1) rename the directory name from "myapp" to "myapp.war"
                2) revert the jboss-service.xml to original one.
                3) reconfig jboss-service.xml
                3.1)comment "URLDeploymentScanner" and its URLs
                3.2)uncomment "URLDirectoryScanner"
                3.3)add myapp.war in URLs:





                4)start server

                But when I surf http://localhost:8083/index.jsp, it still can't work.
                The index.jsp is very simple and as follows:
                <%int i=1;%>


                I=<%=i%>


                But http://localhost:8083/index.jsp only shows to me: a white page with two characters "I=" .

                I can see the web service on http://localhost:8082, under jboss.web.

                I ever install j2sdkee1.4 in my pc, now I uninstall it and install j2sdkee1.3.1 instead 1.4 . Does it cause the problem? I can't confirm. Any new idea?

                yao

                • 5. Re: servlet can't run but jsp can
                  joelvogt

                  you went a few steps too far there. Rename the directory and revert your jboss-service.xml.
                  Now start jboss and go to localhost:8080/myapp/index.jsp.
                  This should definately work. If you can't see this, then it is not your later config causing the problem

                  • 6. Re: servlet can't run but jsp can
                    yaorong

                    Thank you for your concern!

                    (1)The context-root can't work. All deploys from /(root).
                    (2)The jetty doesn't compile jsp, when I right-click in browser and view source, I can see the original source codes not html.

                    I try package the application to a WAR or a EAR, put it in other directory that is not under Jboss, or try at another pc, the problem still exists.

                    • 7. Re: servlet can't run but jsp can
                      yaorong

                      I got it!

                      Jetty default port is 8080. Now I use 8080 as port, it works. But how to forbid 8083 port? Because it's dangerous if user surf using 8083 he will see jsp's source.

                      I think the jboss forums is not very good. I can't get any result when I using search function.

                      yao

                      • 8. Re: servlet can't run but jsp can
                        yaorong

                        A new question:

                        I put some utilizable jar file under WEB-INF/lib. But error shows Jboss3 can't find the jar. I have to put it under jboss/server/default/lib.

                        And my /WEB-INF/classes contains some normal class file which are not servlet. Error report to me : JBoss3 can't find the specific class.

                        How to solve?