Muhammad Imran Tariq
Muhammad Imran Tariq

Reputation: 23352

JBOSS Application Server and Servlet

I downloaded latest version of Jboss from JBOSS website.

I created a Dynamic Web Project and create a servlet in it. Servlet class has build path errors as shown in image below. I explored server directories and it did not include any servlet jar. How can I get JBOSS server which include servlet and web jars in it?

enter image description here

Upvotes: 3

Views: 1689

Answers (3)

Juned Ahsan
Juned Ahsan

Reputation: 68715

The servlet jar in JBOSS server should be present under:

JBOSS_HOME/common/lib/

most likely with name servlet-api.jar It should also be included in your class-path.

Upvotes: 4

eis
eis

Reputation: 53553

JBoss has those files, but what it doesn't have is a common classpath folder (common/lib). Everything is divided into separate modules.

This is partly the reason for why if you want to work with Eclipse without Maven (or similar build management tool), you should use JBoss Tools extension. There are full instructions here: https://docs.jboss.org/author/display/AS7/Starting+JBoss+AS+from+Eclipse+with+JBoss+Tools

JBoss Tools will configure you

  • JBoss runtime, containing references to servlet api + other needed files
  • JBoss server that you can use to deploy from Eclipse

Upvotes: 2

tom
tom

Reputation: 2745

You should add the following dependency to your pom.xml file:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>CHOOSE YOUR CORRECT VERSION HERE</version>
   <scope>provided</scope>
</dependency>

Upvotes: 1

Related Questions