7 Replies Latest reply on Oct 23, 2004 3:52 AM by raist_majere

    running servlet with JBoss Please Help

    aqib9518

      hi
      Im working with JBoss and servlet. i Made a servlet and tested it with Tomcat 4.1 IT WORKED. then i took same servlet to JBoss and it gave following error...

      Help viewer error URL:
      Unable to open location: Document not found on server

      THIS ERROR CAME ON JBUILDER X

      and on web browser it says same old thing...

      type Status report
      message /Chapter/chapter9servlet
      description The requested resource (/Chapter/chapter9servlet) is not available.


      PLEASE HELP ME OUT
      DO I HAVE TO CHANGE SOME CONFIGURATION OF JBOSS TO WORK WITH SERVLET

      waiting..... :(
      [img][/img]

        • 1. Re: running servlet with JBoss Please Help
          raist_majere

          Hi aqib9518

          Your problem is occured from variery reasons.
          So You may need to specify information about your environments.(as DD files)

          But preceding, I have some questions.

          Where did you deploy your servlet?
          Tomcat service is now running in JBoss?

          • 2. Re: running servlet with JBoss Please Help
            raist_majere

            You must provide some feedback if you want somebody to help you, 'cause with the information you provided I'm sure not much people could. Post, at least, the web.xml file and tell us how you deploy your servlet (packaged war or ear). If you have other information you think it could be usefull, post it too (like stack trace if you're getting an exception).

            • 3. Re: running servlet with JBoss Please Help
              aqib9518

               

              "Raist_Majere" wrote:
              You must provide some feedback if you want somebody to help you, 'cause with the information you provided I'm sure not much people could. Post, at least, the web.xml file and tell us how you deploy your servlet (packaged war or ear). If you have other information you think it could be usefull, post it too (like stack trace if you're getting an exception).


              Hi
              im just new to JBoss with Servlet. I used JBuilder X in which i just configured JBoss in CONFIGURE SERVER and then made servlet and web Module

              What else should i tell u... :(
              do i have to make changes to web.xml file also to go on with things??

              waiting...


              • 4. Re: running servlet with JBoss Please Help
                aqib9518

                 

                "Raist_Majere" wrote:
                You must provide some feedback if you want somebody to help you, 'cause with the information you provided I'm sure not much people could. Post, at least, the web.xml file and tell us how you deploy your servlet (packaged war or ear). If you have other information you think it could be usefull, post it too (like stack trace if you're getting an exception).


                Hi
                im just new to JBoss with Servlet. I used JBuilder X in which i just configured JBoss in CONFIGURE SERVER and then made servlet and web Module

                What else should i tell u... :(
                do i have to make changes to web.xml file also to go on with things??

                waiting...


                • 5. Re: running servlet with JBoss Please Help
                  raist_majere

                  Hi again.
                  Copy here your web.xml and jboss-web.xml files at least. You can also copy console output stack tracing if you think it can be useful.

                  • 6. Re: running servlet with JBoss Please Help
                    aqib9518

                    hi
                    this is web.xml

                    <?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>Chapter</display-name>

                    <servlet-name>chapter9servlet</servlet-name>
                    <servlet-class>call.Chapter9Servlet</servlet-class>

                    <servlet-mapping>
                    <servlet-name>chapter9servlet</servlet-name>
                    <url-pattern>/chapter9servlet</url-pattern>
                    </servlet-mapping>
                    </web-app>


                    AND THIS IS THE WHOLE SERVLET

                    import java.util.*;
                    import javax.servlet.*;

                    import javax.servlet.http.*;
                    import java.io.*;

                    public class Chapter9Servlet extends HttpServlet {

                    public void init(ServletConfig config)throws ServletException{
                    super.init(config);
                    }

                    //doGet will be called when a GET request is received.
                    public void doGet(HttpServletRequest request, HttpServletResponse response){
                    //get field value in the query string
                    String value = request.getParameter("request");
                    //turn auto flush on
                    try{
                    PrintWriter out = new PrintWriter(response.getOutputStream(), true);

                    // call getResult to get the current timestamp
                    String message = getResult(value);
                    //send an HTML response back to the client
                    response.setContentType("text/html");
                    response.setContentLength(message.length());
                    out.println(message);
                    }
                    catch(IOException e){}
                    }

                    //dopost will be called when post request is received.
                    public void doPost (HttpServletRequest request,
                    HttpServletResponse response)throws ServletException,IOException{
                    String name="";
                    String value="";

                    try{
                    BufferedReader br = request.getReader();
                    String line;
                    System.out.println("abhee boaly too");
                    String requeststring = "";
                    while((line = br.readLine()) != null){
                    requeststring = requeststring + line;
                    }
                    StringTokenizer sTokenizer = new StringTokenizer(requeststring, "=");
                    if(sTokenizer.hasMoreTokens())
                    name = (String) sTokenizer.nextToken();
                    if(sTokenizer.hasMoreTokens())
                    value = (String) sTokenizer.nextToken();
                    }
                    catch(Exception e){
                    System.err.println(e);
                    }
                    //turn auto flush on
                    PrintWriter out = new PrintWriter(response.getOutputStream(),true);
                    String message = getResult(value);
                    response.setContentType("text/html");
                    response.setContentLength(message.length());
                    out.println(message);
                    }

                    //get current timestamp and put it into HTML format
                    public String getResult(String method){
                    String message = "";
                    //if hte query string value is "gettimstamp"
                    //then current local timestamp is returned
                    if(method.equals("gettimestamp")){
                    TimeZone timezone = TimeZone.getDefault();
                    Calendar calendar = Calendar.getInstance(timezone);
                    String local_time = calendar.getTime().toString();
                    // message = message+""+local_time+"\n";
                    message = message+
                    "web servers local time is \n";
                    message = message+local_time;
                    }
                    else{
                    //otherwise an error message is returned
                    message = message+
                    "Error\n";
                    message = message+
                    "Unrecoganized method name\n";
                    }
                    return message;
                    }
                    }


                    AND THIS IS EXECUTION OF JBOSS...

                    C:\jbuilderx\jdk1.4\bin\javaw -classpath "C:\jboss-3.2.5\bin\run.jar;C:\jbuilderx\jdk1.4\lib\tools.jar" -Djava.io.tmpdir=C:/jboss-3.2.5/server/default/tmp/deploy/server/default/deploy/work -Dprogram.name=run.bat -Xms128m -Xmx512m -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.crimson.jaxp.DocumentBuilderFactoryImpl -Djavax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXParserFactoryImpl org.jboss.Main -c default
                    09:00:08,859 INFO [Server] Starting JBoss (MX MicroKernel)...09:00:08,875 INFO [Server] Release ID: JBoss [WonderLand] 3.2.5 (build: CVSTag=JBoss_3_2_5 date=200406251954)09:00:08,875 INFO [Server] Home Dir: C:\jboss-3.2.509:00:08,875 INFO [Server] Home URL: file:/C:/jboss-3.2.5/09:00:08,875 INFO [Server] Library URL: file:/C:/jboss-3.2.5/lib/09:00:08,875 INFO [Server] Patch URL: null09:00:08,953 INFO [Server] Server Name: default09:00:08,953 INFO [Server] Server Home Dir: C:\jboss-3.2.5\server\default09:00:08,953 INFO [Server] Server Home URL: file:/C:/jboss-3.2.5/server/default/09:00:08,953 INFO [Server] Server Data Dir: C:\jboss-3.2.5\server\default\data09:00:08,953 INFO [Server] Server Temp Dir: C:\jboss-3.2.5\server\default\tmp09:00:08,953 INFO [Server] Server Config URL: file:/C:/jboss-3.2.5/server/default/conf/09:00:08,984 INFO [Server] Server Library URL: file:/C:/jboss-3.2.5/server/default/lib/09:00:08,984 INFO [Server] Root Deployment Filename: jboss-service.xml09:00:08,984 INFO [Server] Starting General Purpose Architecture (GPA)...09:00:10,265 INFO [ServerInfo] Java version: 1.4.2_01,Sun Microsystems Inc.09:00:10,265 INFO [ServerInfo] Java VM: Java HotSpot(TM) Client VM 1.4.2_01-b06,Sun Microsystems Inc.09:00:10,265 INFO [ServerInfo] OS-System: Windows 2000 5.0,x8609:00:10,703 INFO [Server] Core system initialized09:00:12,781 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:log4j.xml09:00:13,328 INFO [WebService] Using RMI server codebase: http://windows:8083/09:00:13,562 INFO [NamingService] Started jnpPort=1099, rmiPort=1098, backlog=50, bindAddress=/0.0.0.0, Client SocketFactory=null, Server SocketFactory=org.jboss.net.sockets.DefaultSocketFactory@ad09307609:00:16,234 INFO [RARMetaData] Loading JBoss Resource Adapter for JDBC 2 XA drivers09:00:16,234 INFO [RARMetaData] Required license terms present. See deployment descriptor.09:00:20,812 INFO [MailService] Mail Service bound to java:/Mail09:00:21,375 INFO [Embedded] Catalina naming disabled09:00:22,000 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0-808009:00:22,046 INFO [Catalina] Initialization processed in 625 ms09:00:22,046 INFO [StandardService] Starting service jboss.web09:00:22,046 INFO [StandardEngine] Starting Servlet Engine: Apache Tomcat/5.0.2609:00:22,062 INFO [StandardHost] XML validation disabled09:00:22,125 INFO [Catalina] Server startup in 79 ms09:00:22,265 WARN [DeploymentInfo] Only the root deployment can set the loader repository, ingoring config=null09:00:22,281 INFO [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=file:/C:/jboss-3.2.5/server/default/deploy/http-invoker.sar/invoker.war/09:00:23,187 WARN [DeploymentInfo] Only the root deployment can set the loader repository, ingoring config=null09:00:23,187 INFO [TomcatDeployer] deploy, ctxPath=, warUrl=file:/C:/jboss-3.2.5/server/default/deploy/jbossweb-tomcat50.sar/ROOT.war/09:00:23,375 WARN [DeploymentInfo] Only the root deployment can set the loader repository, ingoring config=null09:00:23,375 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=file:/C:/jboss-3.2.5/server/default/deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/09:00:23,609 INFO [DefaultDS] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=LocalTxCM,name=DefaultDS to JNDI name 'java:/DefaultDS'09:00:23,625 INFO [JmsXA] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=TxCM,name=JmsXA to JNDI name 'java:/JmsXA'09:00:24,328 INFO [A] Bound to JNDI name: queue/A09:00:24,328 INFO [B] Bound to JNDI name: queue/B09:00:24,328 INFO [C] Bound to JNDI name: queue/C09:00:24,328 INFO [D] Bound to JNDI name: queue/D09:00:24,328 INFO [ex] Bound to JNDI name: queue/ex09:00:24,546 INFO [testTopic] Bound to JNDI name: topic/testTopic09:00:24,546 INFO [securedTopic] Bound to JNDI name: topic/securedTopic09:00:24,546 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic09:00:24,546 INFO [testQueue] Bound to JNDI name: queue/testQueue09:00:24,906 INFO [DLQ] Bound to JNDI name: queue/DLQ09:00:25,125 INFO [UILServerILService] JBossMQ UIL service available at : /0.0.0.0:809309:00:25,296 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=file:/C:/jboss-3.2.5/server/default/deploy/jmx-console.war/09:00:25,875 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=file:/C:/jboss-3.2.5/server/default/tmp/deploy/tmp30552web-console.war/09:00:26,609 INFO [Server] JBoss (MX MicroKernel) [3.2.5 (build: CVSTag=JBoss_3_2_5 date=200406251954)] Started in 17s:625ms09:00:26,609 INFO [Tomcat5] Saw org.jboss.system.server.started notification, starting connectors09:00:26,656 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-808009:00:26,828 INFO [ChannelSocket] JK2: ajp13 listening on /0.0.0.0:800909:00:26,906 INFO [JkMain] Jk running ID=0 time=0/110 config=null

                    AND FOR Min-chang Cha

                    >Where did you deploy your servlet?
                    every thing is done by JBuilder X, i didnt do any thing.

                    >Tomcat service is now running in JBoss?
                    How will i know that??
                    im using jboss-3.2.5

                    sory if im being toooo dubm :(

                    Waiting...

                    • 7. Re: running servlet with JBoss Please Help
                      aqib9518

                      i didnt see any jboss-web.xml in my project file structure....