Skip to main content

Failed deployment on GF 3.0.1- same url pattern error

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
5 replies [Last post]
jfroumis
Offline
Joined: 2010-12-14

Hello,
I am getting an error deploying a WAR file to Glassfish 3.0.1b22 that I don't remember seeing when I was deploying the same WAR file to Glassfish 2.1 in the past. Specifically, I am seeing this error:
Exception while deploying the app : java.lang.IllegalStateException: Servlet [pointcloudservice] and Servlet [PointCloudDeliveryService] have the same url pattern: [/PointCloudDeliveryService]at org.glassfish.apf.AnnotationInfo@a0d20b9
I've done quite a bit of searching on Google and in this forum and all of the suggestions I've seen do not seem to be either relevant to my development environment (I don't have an autodeploy to Glassfish Eclipse plugin) or they don't seem to suggest anything that actually helped (checking sun-jaxws.xml for duplication and/or removing it altogether from the WAR).
The WAR file is being built by Maven inside Eclipse (which is the same way it was being built when deploying on GF 2.1) and is being manually deployed to Glassfish using the web based admin console.
Here are the relevant lines from the web.xml file:

<servlet><br />
        <servlet-name>pointcloudservice</servlet-name><br />
        <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class><br />
        <load-on-startup>1</load-on-startup><br />
    </servlet><br />
    <servlet-mapping><br />
        <servlet-name>pointcloudservice</servlet-name><br />
        <url-pattern>/PointCloudDeliveryService</url-pattern><br />
    </servlet-mapping>

Am I missing something, or is this an issue with Glassfish 3.0.1?
Thanks!
Jim

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
danielkard
Offline
Joined: 2006-01-18

the problem ("..have the same url pattern...") is because some library is deployed more than once.
Check that your dependencies are not repeated.

Daniel :)

tokad
Offline
Joined: 2013-05-15

danielkard wrote:
the problem ("..have the same url pattern...") is because some library is deployed more than once.
Check that your dependencies are not repeated.

Daniel :)

Thanks for that tip. It pointed me in the right direction.
In my project I have dependencies to other own projects which I include via Maven pom. I had to insert true for each dependency in my included projects. After that the GlassFish error was gone.

For example an excerpt out of the pom of one dependency of my main project:

<dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.ws</groupId>
      <artifactId>webservices-rt</artifactId>
      <version>1.4</version>
      <scope>compile</scope>
      <optional>true</optional>
    </dependency>
</dependencies>
jfroumis
Offline
Joined: 2010-12-14

So It looks like the solution to the problem was to set the metadata-complete attribute to true for the web-app tag:
<web-app 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 <a href="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"" title="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"">http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"</a> version="2.5" metadata-complete="true">

manish099
Offline
Joined: 2010-12-16

Hi

I am using glassfish and postgresql and I have created a web services when I am testing it is giving me error

Source code for web services is:-
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package p;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceUnit;
import javax.persistence.Query;

/**
*
* @author 288949
*/
@WebService()
@Stateless()
public class DemoWebServices {
@PersistenceUnit
private EntityManagerFactory emf;
private EntityManager getEntityManager() {
return emf.createEntityManager();

}

public EntityManagerFactory getEmf() {
return emf;
}

public void setEmf(EntityManagerFactory emf) {
this.emf = emf;
}

/**
* Web service operation
*/
@WebMethod(operationName = "Fetch")
public String Fetch(@WebParam(name = "EmailId")
String EmailId) {

System.out.print("ViewDetail");
Metadatatable objMetadatatable=new Metadatatable();
EntityManager em = getEntityManager();

System.out.print("ViewDetail1");
// Query query1 = em.createNamedQuery("Metadatatable.findByEmailid").setParameter("emailid", "Manish@Gmail.com");
Query query = em.createQuery("select e.creatatorname from Metadatatable e where e.emailid=(:emailid) ").setParameter("emailid", "Manish@Gmail.com");
String iecode= (String) query.getSingleResult();
System.out.print(iecode);

// Query query = em.createNamedQuery(EmailId, null)
// String iecode= (String) query.getSingleResult();
// System.out.print(iecode);
//
// System.out.print("MA");
//

return iecode;
}

}

Exceptions details : null
________________________________
java.lang.NullPointerException at java.io.File.(File.java:222) at org.glassfish.webservices.monitoring.WebServiceTesterServlet.initializePort(WebServiceTesterServlet.java:505) at org.glassfish.webservices.monitoring.WebServiceTesterServlet.doGet(WebServiceTesterServlet.java:165) at org.glassfish.webservices.monitoring.WebServiceTesterServlet.invoke(WebServiceTesterServlet.java:100) at org.glassfish.webservices.JAXWSServlet.doGet(JAXWSServlet.java:193) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309) at java.lang.Thread.run(Thread.java:619)

________________________________
The contents of this e-mail and any attachment(s) may contain confidential or privileged information for the intended recipient(s). Unintended recipients are prohibited from taking action on the basis of information in this e-mail and using or disseminating the information, and must notify the sender and delete it from their system. L&T Infotech will not accept responsibility or liability for the accuracy or completeness of, or the presence of any virus or disabling code in this e-mail"

______________________________________________________________________

cinhtau Guest
Offline
Joined: 2010-12-17

Manish Mishra-2 wrote:
>
> public class DemoWebServices {
> @PersistenceUnit
> private EntityManagerFactory emf;
>
> private EntityManager getEntityManager() {
> return emf.createEntityManager();
> }
> }
>

Usually you let the container handle the PersistenceUnit, i.e.

@PersistenceUnit(name="myPUnit")

Glassfish will inject it for you. Your code above is useless, because you
create an entity manager manually. You use that only outside Glassfish. Post
your persistence.xml please for further help.