gudii9
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-distr ibution-6. 1.0.Final\ jboss-6.1. 0.Final\se rver\defau lt\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
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
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-distr
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.HttpServletReques t;
import javax.servlet.http.HttpServletRespon se;
/**
* 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(HttpServletReques t 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.MyTestServ let</servl et-class>
</servlet>
<servlet-mapping>
<servlet-name>MyTestServlet</servlet -name>
<url-pattern>/MyTestServlet</url-pat tern>
</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
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.
Yes, this is right. If you use 3.0 you can use annotations, it will work the same.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
vista 32 bit laptop has some issue with jboss installation. It is working perfect on other windows7 with 64 bit laptop
Yes.
How do you deploy your servlet?