Friday, November 11, 2011

"Same url pattern" error on GlassFish OSE 3.1.1 deployment

When I was experimenting with JSF 2.0 deploying into GlassFish Open Source Edition 3.1.1 using MyEclipse 10, I encountered an error I can't explain, since the source code set was previously tested on eclipse indigo + tomcat 7 combination and seems to work fine.

So I went and get jsf-blank.zip from coreservlets.com JSF 2.0 Tutorial - build and deployed it to GlasshFish from eclipse. Simple project, simple test and it's now proven to work. I copied the source code into MyEclipse and deploy the project into GlassFish, and sure enough it blows again.

The short version of the error is:

Exception while deploying the app : java.lang.IllegalStateException: Servlet [xxxxx] and Servlet [yyyyy] have the same url pattern: [/zzz]at org.glassfish.apf.AnnotationInfo@f3b0e2

Here's the error log associated with the exception:

[#|2011-11-11T10:09:09.367-0800|SEVERE|glassfish3.1.1|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=16;_ThreadName=Thread-2;|Servlet [RegistrationRequesterPortImpl] and Servlet [RegistrationPortImpl] have the same url pattern: [/RegistrationService_V11]|#]

[#|2011-11-11T10:09:09.368-0800|SEVERE|glassfish3.1.1|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=16;_ThreadName=Thread-2;|Exception while deploying the app [jsf-blank]|#]

[#|2011-11-11T10:09:09.368-0800|SEVERE|glassfish3.1.1|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=16;_ThreadName=Thread-2;|Servlet [RegistrationRequesterPortImpl] and Servlet [RegistrationPortImpl] have the same url pattern: [/RegistrationService_V11]at org.glassfish.apf.AnnotationInfo@f3b0e2
java.lang.IllegalStateException: Servlet [RegistrationRequesterPortImpl] and Servlet [RegistrationPortImpl] have the same url pattern: [/RegistrationService_V11]at org.glassfish.apf.AnnotationInfo@f3b0e2
 at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:490)
 at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:432)
 at com.sun.enterprise.deployment.archivist.WebArchivist.postAnnotationProcess(WebArchivist.java:358)
 at com.sun.enterprise.deployment.archivist.WebArchivist.postAnnotationProcess(WebArchivist.java:89)
 at com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:409)
 at com.sun.enterprise.deployment.archivist.Archivist.openWith(Archivist.java:267)
 at com.sun.enterprise.deployment.archivist.ApplicationFactory.openWith(ApplicationFactory.java:240)
 at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:171)
 at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:93)
 at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:828)
 at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:770)
 at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:368)
 at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
 at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382)
 at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:360)
 at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
 at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
 at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
 at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
 at org.glassfish.deployment.autodeploy.AutoOperation.run(AutoOperation.java:145)
 at org.glassfish.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:575)
 at org.glassfish.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:461)
 at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:389)
 at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:380)
 at org.glassfish.deployment.autodeploy.AutoDeployService$1.run(AutoDeployService.java:209)
 at java.util.TimerThread.mainLoop(Timer.java:512)
 at java.util.TimerThread.run(Timer.java:462)
Caused by: Servlet [RegistrationRequesterPortImpl] and Servlet [RegistrationPortImpl] have the same url pattern: [/RegistrationService_V11]at org.glassfish.apf.AnnotationInfo@f3b0e2
 at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:367)
 at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:375)
 at org.glassfish.apf.impl.AnnotationProcessorImpl.processAnnotations(AnnotationProcessorImpl.java:289)
 at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:195)
 at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:134)
 at com.sun.enterprise.deployment.archivist.Archivist.processAnnotations(Archivist.java:606)
 at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:445)
 ... 26 more
Caused by: java.lang.IllegalArgumentException: Servlet [RegistrationRequesterPortImpl] and Servlet [RegistrationPortImpl] have the same url pattern: [/RegistrationService_V11]
 at com.sun.enterprise.deployment.WebBundleDescriptor.addWebComponentDescriptor(WebBundleDescriptor.java:362)
 at org.glassfish.webservices.annotation.handlers.WebServiceHandler.processAnnotation(WebServiceHandler.java:433)
 at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:344)
 ... 32 more
|#]


Long story short, I googled for previous solutions and after a while found an answer in java.net GlassFish forum as it turns out, to resolve the issue a metadata-complete="true" attribute need to be added into web.xml web-app tag.

Here's an example:

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


That additional attribute seems to fix the issue, though I'm still not clear why it works OK through eclipse but not myEclipse.

No comments:

Post a Comment