Setting context root for EAR application (Resin)

2.7k views Asked by At

I have a EAR application with following structure:

app.ear
|-- app.war
`-- META-INF
    `-- application.xml

application.xml

<?xml version="1.0" encoding="UTF-8"?>
<application 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/application_1_4.xsd"
         version="1.4">

  <display-name>App</display-name>
  <description>Application</description>

  <module>
    <web>
      <web-uri>app.war</web-uri>
      <context-root>/path</context-root>
    </web>
  </module>

</application>

Resin has default configuration. I would expect that http://localhost:3333/path/service should be the app.war, but every request returns this:

<html>
<head>
  <title>404 Not Found</title>
</head>
<body>
  <h1>404 Not Found</h1>
  /path/service was not found on this server.
  <p/>
  <hr/>
  <small>Resin/3.1.9</small>
</body>
</html>

If I put the application only as WAR file, Resin loads it and it works on /app/service. Where is the problem? The configuration seems correct to me.

EDIT: Resin's log

[10:38:57.799] {main} WebApp[http://localhost:3333] active
[10:38:58.018] {main} WebApp[http://localhost:3333/resin-admin] active
[10:38:58.059] {main} WebApp[http://localhost:3333/app.ear] active
[10:39:00.323] {main} WebApp[http://localhost:3333/resin-doc] active
1

There are 1 answers

1
Jörn Horstmann On BEST ANSWER

The application.xml should belong in a folder "META-INF" inside the ear, not "WEB-INF" as in your example.