404 Errors for Maven webapp

Answered

I have a Maven project created by the maven-webapp archetype. I have my source in webapp, my jsps in webapp/WEB-INF and classes in webapp/WEB-INF/lib.  See my structure below.  I am able to see the index.jsp, but anything beyond that produces a 404 error.  In the past I usually found problems with modules or artifacts in terms of included elements, but I'm not able to see an issue this time.  My lib/*.jar files might look redundant because I started adding jars manually to /src/main/WEB-INF/lib in an act of desperation :-).  I'm hoping something might jump out at someone at this level, otherwise I can forward the code. Thanks in advance!


├── MDSCommitteeWS.iml
├── pom.xml
├── src
│   └── main
│   ├── resources
│   └── webapp
│   ├── WEB-INF
│   │   ├── lib
│   │   │   ├── aopalliance-repackaged-2.5.0-b42.jar
│   │   │   ├── hk2-api-2.5.0-b42.jar
│   │   │   ├── hk2-locator-2.5.0-b42.jar
│   │   │   ├── hk2-utils-2.5.0-b42.jar
│   │   │   ├── javassist-3.22.0-CR2.jar
│   │   │   ├── javax.annotation-api-1.2.jar
│   │   │   ├── javax.inject-1.jar
│   │   │   ├── javax.inject-2.5.0-b42.jar
│   │   │   ├── javax.ws.rs-api-2.1.jar
│   │   │   ├── jersey-client-2.26.jar
│   │   │   ├── jersey-common-2.26.jar
│   │   │   ├── jersey-container-servlet-core-2.26.jar
│   │   │   ├── jersey-hk2-2.26.jar
│   │   │   ├── jersey-media-jaxb-2.26.jar
│   │   │   ├── jersey-server-2.26.jar
│   │   │   ├── json-20170516.jar
│   │   │   ├── osgi-resource-locator-1.0.1.jar
│   │   │   └── validation-api-1.1.0.Final.jar
│   │   └── web.xml
│   ├── edu
│   │   └── mayo
│   │   ├── committee
│   │   │   └── CommitteeData.java
│   │   └── dbconnection
│   │   ├── ConnectionManager.java
│   │   ├── ResultSetConverter.java
│   │   └── WSAction.java
│   └── index.jsp
└── target
├── MDS-Committee-WS
│   ├── META-INF
│   │   └── MANIFEST.MF
│   ├── WEB-INF
│   │   ├── classes
│   │   │   ├── WEB-INF
│   │   │   │   ├── lib
│   │   │   │   │   ├── aopalliance-repackaged-2.5.0-b42.jar
│   │   │   │   │   ├── hk2-api-2.5.0-b42.jar
│   │   │   │   │   ├── hk2-locator-2.5.0-b42.jar
│   │   │   │   │   ├── hk2-utils-2.5.0-b42.jar
│   │   │   │   │   ├── javassist-3.22.0-CR2.jar
│   │   │   │   │   ├── javax.annotation-api-1.2.jar
│   │   │   │   │   ├── javax.inject-1.jar
│   │   │   │   │   ├── javax.inject-2.5.0-b42.jar
│   │   │   │   │   ├── javax.ws.rs-api-2.1.jar
│   │   │   │   │   ├── jersey-client-2.26.jar
│   │   │   │   │   ├── jersey-common-2.26.jar
│   │   │   │   │   ├── jersey-container-servlet-core-2.26.jar
│   │   │   │   │   ├── jersey-hk2-2.26.jar
│   │   │   │   │   ├── jersey-media-jaxb-2.26.jar
│   │   │   │   │   ├── jersey-server-2.26.jar
│   │   │   │   │   ├── json-20170516.jar
│   │   │   │   │   ├── osgi-resource-locator-1.0.1.jar
│   │   │   │   │   └── validation-api-1.1.0.Final.jar
│   │   │   │   └── web.xml
│   │   │   ├── edu
│   │   │   │   └── mayo
│   │   │   │   ├── committee
│   │   │   │   │   └── CommitteeData.class
│   │   │   │   └── dbconnection
│   │   │   │   ├── ConnectionManager.class
│   │   │   │   ├── ResultSetConverter.class
│   │   │   │   └── WSAction.class
│   │   │   └── index.jsp
│   │   ├── lib
│   │   │   ├── aopalliance-repackaged-2.5.0-b42.jar
│   │   │   ├── hk2-api-2.5.0-b42.jar
│   │   │   ├── hk2-locator-2.5.0-b42.jar
│   │   │   ├── hk2-utils-2.5.0-b42.jar
│   │   │   ├── javassist-3.22.0-CR2.jar
│   │   │   ├── javax.annotation-api-1.2.jar
│   │   │   ├── javax.inject-1.jar
│   │   │   ├── javax.inject-2.5.0-b42.jar
│   │   │   ├── javax.ws.rs-api-2.1.jar
│   │   │   ├── jersey-client-2.26.jar
│   │   │   ├── jersey-common-2.26.jar
│   │   │   ├── jersey-container-servlet-core-2.26.jar
│   │   │   ├── jersey-hk2-2.26.jar
│   │   │   ├── jersey-media-jaxb-2.26.jar
│   │   │   ├── jersey-server-2.26.jar
│   │   │   ├── json-20170516.jar
│   │   │   ├── osgi-resource-locator-1.0.1.jar
│   │   │   └── validation-api-1.1.0.Final.jar
│   │   └── web.xml
│   ├── edu
│   │   └── mayo
│   │   ├── committee
│   │   │   └── CommitteeData.java
│   │   └── dbconnection
│   │   ├── ConnectionManager.java
│   │   ├── ResultSetConverter.java
│   │   └── WSAction.java
│   └── index.jsp
├── classes
│   ├── WEB-INF
│   │   ├── lib
│   │   │   ├── aopalliance-repackaged-2.5.0-b42.jar
│   │   │   ├── hk2-api-2.5.0-b42.jar
│   │   │   ├── hk2-locator-2.5.0-b42.jar
│   │   │   ├── hk2-utils-2.5.0-b42.jar
│   │   │   ├── javassist-3.22.0-CR2.jar
│   │   │   ├── javax.annotation-api-1.2.jar
│   │   │   ├── javax.inject-1.jar
│   │   │   ├── javax.inject-2.5.0-b42.jar
│   │   │   ├── javax.ws.rs-api-2.1.jar
│   │   │   ├── jersey-client-2.26.jar
│   │   │   ├── jersey-common-2.26.jar
│   │   │   ├── jersey-container-servlet-core-2.26.jar
│   │   │   ├── jersey-hk2-2.26.jar
│   │   │   ├── jersey-media-jaxb-2.26.jar
│   │   │   ├── jersey-server-2.26.jar
│   │   │   ├── json-20170516.jar
│   │   │   ├── osgi-resource-locator-1.0.1.jar
│   │   │   └── validation-api-1.1.0.Final.jar
│   │   └── web.xml
│   ├── edu
│   │   └── mayo
│   │   ├── committee
│   │   │   └── CommitteeData.class
│   │   └── dbconnection
│   │   ├── ConnectionManager.class
│   │   ├── ResultSetConverter.class
│   │   └── WSAction.class
│   └── index.jsp
└── generated-sources
└── annotations

6 comments
Comment actions Permalink

Please share the sample project to reproduce and describe what URLs don't work for you and why you'd expect them to work.

0
Comment actions Permalink

I've uploaded it as MDSCommitteeWS.zip.  I expect the following URLs to work, but all give a 404 error with the exception of the first one.  No errors in any logs.

localhost:8080 -> this works, shows index.jsp

localhost:8080/rest/committee -> should work based on <url-pattern> (/rest/*) in web.xml plus @path annotation (committee) in WSAction.java

localhost:8080/rest/committee/id -> should work based on <url-pattern> (/rest/*) in web.xml plus @path annotation (/id/) in WSAction.java

localhost:8080/rest/committee/perid -> should work based on <url-pattern> (/rest/*) in web.xml plus @path annotation (/perid/) in WSAction.java

localhost:8080/rest/committee/members -> should work based on <url-pattern> (/rest/*) in web.xml plus @path annotation (/members/) in WSAction.java

Thanks as always,

Al

 

0
Comment actions Permalink

I'm afraid, your file didn't upload well (there is zero length MDSCommitteeWS.zip.part). Please try again.

0
Comment actions Permalink

Okay I uploaded it again.  It went to 100%, for what it's worth.

Thanks,

Al

0
Comment actions Permalink

You have the wrong package specified in the param-value for the jersey.config.server.provider.packages servlet param-name, it should be edu.mayo.dbconnection:

<servlet>
<servlet-name>Committee</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>edu.mayo.dbconnection</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

It doesn't seem to be IntelliJ IDEA specific problem, rather configuration issue of your app. Such questions better fit http://stackoverflow.com/ than this IntelliJ IDEA support forum.

0
Comment actions Permalink

Thanks Serge - had I realized it was a configuration issue I would have tried stackoverflow.  Your suggestion did the trick.

Al

0

Please sign in to leave a comment.