Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

servlet example on the eclipse juno with jboss 6.1

Hi,

I am trying below servlet example on the eclipse juno with jboss 6.1 on my local vista 32 bit laptop.
http://sanjaal.com/java/tag/jboss-servlet-tutorial-for-eclipse/

I followed all the steps.

When i ran the servlet nothing is happening. I checked the console, server log at C:\software\jboss-as-distribution-6.1.0.Final\jboss-6.1.0.Final\server\default\log


but no useful information there as well.

Do i really need to create EAR for this simple servlet example. I wonder why the servlet is not running.

My code looks as below


package com.myproj;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class MyTestServlet
 */
@WebServlet("/MyTestServlet")
public class MyTestServlet extends HttpServlet {
      private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public MyTestServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

      /**
       * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            // TODO Auto-generated method stub
      }

      /**
       * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            // TODO Auto-generated method stub
      }

}





web.xml is

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

    <servlet>
        <servlet-name>MyTestServlet</servlet-name>
        <servlet-class>com.myproj.MyTestServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>MyTestServlet</servlet-name>
        <url-pattern>/MyTestServlet</url-pattern>
    </servlet-mapping>


</web-app>



Do i need the web.xml file.

samething happening when i tried few other examples from internet.
Please advise. Any ideas, sample code, resources highly appreciated. Thanks in advance.
ServEx.jpg
Avatar of girionis
girionis
Flag of Greece image

Do i need the web.xml file.

Yes.

How do you deploy your servlet?
Avatar of gudii9

ASKER

dynamic web application 3.0 (ie servlet 3) onwards we can do with annotation as well right?. I think i choose dynamic web application 3.0 instead should i try with dynamic web application 2.5. please advise
dynamic web application 3.0 (ie servlet 3) onwards we can do with annotation as well right?

Yes, this is right. If you use 3.0 you can use annotations, it will work the same.
Avatar of gudii9

ASKER

On tomcat you do not have this kind of separate XML file similar to jboss righ. any simple example end to end or video on this. Please advise
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gudii9

ASKER

vista 32 bit laptop has some issue with jboss installation. It is working perfect on other windows7 with 64 bit laptop