aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes How to use Servlets using Netbeans 6.7.1 and JBoss 5.1.0 GA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "How to use Servlets using Netbeans 6.7.1 and JBoss 5.1.0 GA" Watch "How to use Servlets using Netbeans 6.7.1 and JBoss 5.1.0 GA" New topic
Author

How to use Servlets using Netbeans 6.7.1 and JBoss 5.1.0 GA

Dan Farrow
Greenhorn

Joined: Sep 18, 2009
Posts: 6
Hello I am a newbie and I am building a Java Web app using the Netbean 6.7.1 IDE. My client uses JBoss server, so I am using that server. When I try to create a servlet in Netbeans, I get an error showing me that NetBeans doesn't know where to get the package javax.servlet.*. I guess this is included when you use Tomcat Server, but not JBoss? How do I use Servlets with JBoss?
Dan Farrow
Greenhorn

Joined: Sep 18, 2009
Posts: 6
Ok, I saw that I could simply include the servlet-api.jar and have the javax.servlet.* package available. However, when I do this and compile my project, I get this error:

java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/jasper/servlet/JasperLoader) previously initiated loading for a different type with name "javax/servlet/http/HttpServletRequest"

So it appears there is some conflict with using this package on JBoss, for some reason. All of the tutorials that use this package seem to assume you are going to use Tomcat, but I need to use JBoss (as that is what my client is using). How can I get Servlets working under JBoss?
Dan Farrow
Greenhorn

Joined: Sep 18, 2009
Posts: 6
Ok, I realized the problem was that servlet-api.jar was being copied to my WAR file, causing the problem. If I open the WAR file and delete the serlet-api.jar package, everything works in JBoss. How do I make the web app compile using servlet-api.jar, but not have it included in the web app?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

How do I make the web app compile using servlet-api.jar, but not have it included in the web app?


This has become a NetBeans question, so I'm moving it to the IDE forum.


JBoss In Action
wai man
Greenhorn

Joined: Oct 25, 2009
Posts: 1

netbean->project tree->[your project name]->right click->property->libraries->tab[compile]->add jar/folder->uncheck servlet-api.jar [packaging]


[Thumbnail for uncheck.jpg]



[img]http://tn3-1.deviantart.com/fs8/300W/i/2005/351/c/5/Tony_Tony_Chopper_by_Centurymon.jpg[/img]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use Servlets using Netbeans 6.7.1 and JBoss 5.1.0 GA