[jboss-jira] [JBoss JIRA] (AS7-3162) RESTEasy: Unknown servet name javax.ws.rs.core.Application when javax.ws.rs.core.Application subclass is on classpath

Stuart Douglas (Commented) (JIRA) jira-events at lists.jboss.org
Tue Jan 3 16:23:09 EST 2012


    [ https://issues.jboss.org/browse/AS7-3162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12653656#comment-12653656 ] 

Stuart Douglas commented on AS7-3162:
-------------------------------------

I don't think this is a valid deployment. According to the spec:

{code}
• If an Application subclass is present that is not being handled by an existing servlet then the servlet added by the ContainerInitializer MUST be named with the fully qualified name of the Application subclass. If the Application subclass is annotated with @ApplicationPath and no servlet-mapping exists for the added servlet then a new servlet mapping is added with the value of the @ApplicationPath annotation with ”/*” appended otherwise the existing mapping is used. If the Application subclass is not annotated with @ApplicationPath then the application MUST be packaged with a web.xml that specifies a servlet mapping for the added servlet. It is an error for more than one application to be deployed at the same effective servlet mapping
{code}

Basically the presence of an Application class on the CP changes the way that the deployment is handled. I think that we should probably just provide a more meaningful error message in this case. 


                
> RESTEasy: Unknown servet name javax.ws.rs.core.Application when javax.ws.rs.core.Application subclass is on classpath 
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: AS7-3162
>                 URL: https://issues.jboss.org/browse/AS7-3162
>             Project: Application Server 7
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 7.1.0.CR1b
>            Reporter: Pavel Janousek
>            Assignee: Weinan Li
>            Priority: Blocker
>
> I've deployment like this:
> {code}
> @Deployment
> public static Archive<?> deploy() {
> 	WebArchive war = ShrinkWrap.create(WebArchive.class, "jaxrsnoap.war");
> 	war.addPackage(HttpRequest.class.getPackage());
> 	war.addClasses(ApplicationTestCase.class, ApplicationInvalid1.class);
> 	war.addAsWebInfResource(
> 			WebXml.get("<servlet-mapping>\n"
> 					+ "        <servlet-name>javax.ws.rs.core.Application</servlet-name>\n"
> 					+ "        <url-pattern>/myjaxrs/*</url-pattern>\n"
> 					+ "</servlet-mapping>\n" + "\n"), "web.xml");
> 	return war;
> }
> {code}
> This deployment fails during deploying because of "Context [/jaxrsnoap] startup failed due to previous errors: java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name javax.ws.rs.core.Application"
> ApplicationInvalid1 is empty subclass of javax.ws.rs.core.Application like:
> {code}
> public class ApplicationInvalid1 extends Application {
> 	private Set<Class<?>> classes = new HashSet<Class<?>>();
> 	public ApplicationInvalid1() {
> 	}
> 	@Override
> 	public Set<Class<?>> getClasses() {
> 		return classes;
> 	}
> }
> {code}
> There isn't any reference to this class in web.xml or somewhere else. Only class is placed on classpath. If I remove this class from deployment (= change appropriate line to "war.addClasses(ApplicationTestCase.class);", everything will be OK.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the jboss-jira mailing list