Rox
Rox

Reputation: 2917

My web project does not work on JBoss 7 when deployed by maven

I have tried for some hours to get one of my first servlets working on my JBoss 7.1.1 instance.
I am using Maven to compile and deploy the project as an EAR modul where the WAR file is a part of. I am using maven-war-plugin for making the war module. The structure of the web project is as follows:

--src 
   -- main
        -- java
           -- org
              -- myproject
                 -- MyServlet.java
        -- resources
        -- webapp
             -- web.xml  

The web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

    <servlet>
        <servlet-name>myproject</servlet-name>
        <servlet-class>org.myproject.MyServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>myproject</servlet-name>
        <url-pattern>/Myproject</url-pattern>
    </servlet-mapping>

</web-app>

When I go to http://127.0.0.1:8080/Myproject I just get a Status 404 from JBoss. I have really no clue on what I am doing wrong.

When deployd on JBoss, the no errors occur in the log and everything seems alright:

14:37:15,053 INFO  [org.jboss.web] (MSC service thread 1-8) JBAS018210: Registering web context: /Myproject
14:37:15,061 INFO  [org.jboss.as.server] (management-handler-thread - 26) JBAS018562: Redeployed "myproject.ear"
14:37:15,061 INFO  [org.jboss.as.server] (management-handler-thread - 26) JBAS018565: Replaced deployment "myproject.ear" with deployment "myproject.ear"

What could be wrong?

Upvotes: 2

Views: 1588

Answers (1)

StreakyCobra
StreakyCobra

Reputation: 2001

When deploying an application on the server, it has its own root path. Thus you need probably to visit something like http://127.0.0.1:8080/myproject/Myproject

Upvotes: 3

Related Questions