• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use Servlets using Netbeans 6.7.1 and JBoss 5.1.0 GA

 
Dan Farrow
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
wai man
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

netbean->project tree->[your project name]->right click->property->libraries->tab[compile]->add jar/folder->uncheck servlet-api.jar [packaging]
uncheck.jpg
[Thumbnail for uncheck.jpg]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic