1 2 Previous Next 23 Replies Latest reply on Feb 14, 2007 3:49 PM by Thomas Diesler

    Bug in ServiceDeployerEjb's portURI

    Raja Master

      I have two webservices defined in a single EJB Jar archive. During deployment, an error pops out saying
      "Cannot use the same url-pattern with different endpoints, check your port-uri in jboss.xml"

      The server console tells me that the webservices are deployed as

      12:18:44,529 INFO [AxisService] WSDD published to: /apps/jboss-4.0.0/server/default/data/wsdl/test-ejb.jar/CEE_TEST.wsdd
      12:18:44,532 INFO [AxisService] Web Service deployed: http://localhost:8080/test-ejb/CEE_TEST
      12:18:44,535 INFO [AxisService] WSDD published to: /apps/jboss-4.0.0/server/default/data/wsdl/test-ejb.jar/RAJA_TEST.wsdd
      12:18:44,537 INFO [AxisService] Web Service deployed: http://localhost:8080/test-ejb/RAJA_TEST
      12:18:44,538 ERROR [ServiceDeployer] Cannot startup webservice for: test-ejb.jar
      java.lang.IllegalArgumentException: Cannot use the same url-pattern with different endpoints, check your port-uri in jboss.xml
      at org.jboss.webservice.ServiceDeployerEJB.createWebXML(ServiceDeployerEJB.java:221)
      at org.jboss.webservice.ServiceDeployerEJB.deployWebservices(ServiceDeployerEJB.java:103)
      at org.jboss.webservice.ServiceDeployer.startWebservice(ServiceDeployer.java:203)

      Stepping into the code, it shows that the url-pattern of "/*" is added to the urlPatters array during the first deployment(for CEE_TEST) and it bails out during the second deployment for RAJA_TEST as "/*" is already in the urlPatters array. The corresponding code is

      String urlPattern = "/*";
      
       SessionMetaData ejbMetaData = (SessionMetaData)applMetaData.getBeanByEjbName(ejbLink);
       EjbPortComponentMetaData pcMetaData = ejbMetaData.getPortComponent();
       if (pcMetaData != null && pcMetaData.getPortURI() != null)
       {
       urlPattern = pcMetaData.getPortURI();
       if (!urlPattern.startsWith("/"))
       urlPattern = "/" + urlPattern;
       if (!urlPattern.endsWith("/*"))
       urlPattern = urlPattern + "/*";
       }
      
       if (urlPatters.contains(urlPattern))
       throw new IllegalArgumentException("Cannot use the same url-pattern with different endpoints, " +
       "check your port-uri in jboss.xml");
      

      I have nothing defined extra in my jboss.xml so the pcMetaData is always null. Should the check for urlPatters.contains(urlPattern) be not done if urlPattern has a value of "/*".

      Thanks
      Raja

        • 1. Re: Bug in ServiceDeployerEjb's portURI
          Thomas Diesler Master

          Its intended behaviour, not a bug. If you have more than one endpoints, you need to assign individual uri-patterns to them. Otherwise the clients could not distinguish them.

          The error message tells you axactly what to do.

          • 2. Re: Bug in ServiceDeployerEjb's portURI
            Raja Master

            Thanks for the response. Im still new to WS, sorry if im missing something obvious. There are 2 wsdl files in my jar archive, one of them having a
            <wsdlsoap:address location="http://localhost:8080/ws4ee/services/TestBean"/>
            and another with
            <wsdlsoap:address location="http://localhost:8080/ws4ee/services/CEEBean"/>

            So the endpoint address for both of them are different. Im not sure if jboss is complaining because of this?

            • 3. Re: Bug in ServiceDeployerEjb's portURI
              Thomas Diesler Master

              The error message tells you about port-uri in jboss.xml.

              The wsdlsoap:address is irrelevant as this will be overridden anyway at deploy time.

              • 4. Re: Bug in ServiceDeployerEjb's portURI
                Raja Master

                Actually, i dont have any jboss.xml in my system. The reason i believe this is wrong is that JBoss calcuates the endpoint address based on the name of the archive(xxx in the case of xxx.war) and the value thats in the "webservice-description-name" in webservices.xml. So if i have 2 port-components in a single webservices.xml, JBoss cannot diferentiate between the two as both of them have the same webservice-description-name and also are in the same archive.
                I included a jboss.xml with the port-component-uri to resolve this issue but i dont think i should need to do that.
                If you look at the code fragment posted above(in the actual issue message) i dont have any jboss.xml and so it assumes that the urlPattern which is "/*" and is already stored in the urlPattern array gets repeated for the second webservice.

                I will post a detailed test case once i get to work.

                Thanks for the response

                • 5. Re: Bug in ServiceDeployerEjb's portURI
                  Thomas Diesler Master

                  Each webservice-description-name needs to be unique in webservices.xml

                  • 6. Re: Bug in ServiceDeployerEjb's portURI
                    Raja Master

                    Hi Thomas
                    I have a single webservice-description-name only. this is how my webservices.xml looks like

                    <webservices
                     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://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
                     version="1.1">
                     <webservice-description>
                     <webservice-description-name>CEE_TEST</webservice-description-name>
                     <wsdl-file>META-INF/wsdl/testbean.wsdl</wsdl-file>
                     <port-component>
                     <port-component-name>TestBeanPort</port-component-name>
                     ........
                     </port-component>
                     <port-component>
                     <port-component-name>CEEBeanPort</port-component-name>
                     ........
                     </port-component>
                     </webservice-description>
                    </webservices>
                    

                    Now both these services are packed as a single archive(test-ejb.jar). When there is a single webservice in a archive, jboss calculates it as http://localhost:8080/<archive-name>/<webservice-description-name>?wsdl

                    But in my case, i have 2 services packed in the same archive. So according to the above webservices.xml and my packing style, both of these have the same endpoint addresses and so jboss tells me that i should check the port-component-uri in jboss.xml. The error message is
                    "Cannot use the same url-pattern with different endpoints, check your port-uri in jboss.xml"

                    But I dont have a jboss.xml at all. If i add a jboss.xml with different port-component-uri for the ports then all works fine. But im wondering why is that restriction imposed? Cant jboss get the endpoint using , say, maybe the port name and the archive name instead of the webservice-description-name. Please correct me if my understanding is wrong.



                    • 8. Re: Bug in ServiceDeployerEjb's portURI
                      Thomas Diesler Master

                      The implementation leverages the requirement that the <webservice-description-name> must be unique among all <webservice-description> elements within a given deployment.

                      It is also true that you can have multiple <port-component> elements within a <webservice-description> where the <port-component-name> must be unique as well.

                      I still favour the current implementation where it is the responsibility of the deployer to explicitly resolve the uniqueness of the multiple service endpoints within one <webservice-description>.

                      Adding <port-component-name> implilcitly to the <webservice-description-name> assumes that the combined path builds a valid URL and I am not a great fan of this.

                      I'll take this issue to the JSR-109 expert group. It is undefined how the endpoint address is built for an EJB endpoint. In contrary to this, for JSE endpoints it *is* defined - you must explicitly set the URL pattern in web.xml.

                      • 9. Re: Bug in ServiceDeployerEjb's portURI
                        Eyal Katz Newbie

                        Hi Raja and Thomas

                        I am having the same problem on my project.
                        I didn't understand the solution offered: updating port-uri in jboss.xml

                        I am quite new to JBoss and to JBoss-WS (I dont even know where to put jboss.xml).
                        If you could post an example of jboss.xml and the port-uri elements that solve Raja's problem it would be great - not only for me, but for all of the people which end up in this forum by goolgeling :

                        java.lang.IllegalArgumentException: Cannot use the same url-pattern with different endpoints, check your port-uri in jboss.xml


                        I know, I can check it on my own (google : "jboss.xml port-uri" etc.)
                        but if this thread is so specifiec about this problem and new-users end up here - it would be so good and fair to let us all have a full solution to this problem, and somehow ease the first-step burdens which we all face(d) while learning JBoss (which is truly amazing by its own)

                        After all this is why we call it a forum

                        Thank you very much

                        Eyal

                        • 10. Re: Bug in ServiceDeployerEjb's portURI
                          Eyal Katz Newbie

                          could some one please explain why this is NOT a Bug?

                          How can't it be a Bug :
                          1. You define 2 web services in webservices.xml
                          2. You define 2 SLSB's in ejb-jar.xml
                          3. You deploy your app.
                          4. It crahes with that wierd message which Raja initially showed...
                          Is this a J2EE 1.4 standard?
                          Why do I need jboss.xml here? what I did was pure J2EE 1.4 compliant
                          Why is there a need for any extension?

                          Please clarify this to the sake of the others

                          Eyal

                          • 11. Re: Bug in ServiceDeployerEjb's portURI
                            Thomas Diesler Master

                            If you have 2 endpoints you need 2 URLs, e.g.

                            http://somehost:8080/myservice/bean-one
                            http://somehost:8080/myservice/bean-two

                            With an EJB endpoint there is no standard way of setting up an <url-mapping> as you do with POJO endpoints in web.xml. Thats why we need to do it in a propriatary DD (jboss.xml)

                            jboss.xml is our proprietary extension to ejb-jar.xml and lives right next to it. A good entry point to what you can do with jboss.xml is the dtd, which you find in the jboss-4.0.x/docs folder.

                            • 12. Re: Bug in ServiceDeployerEjb's portURI
                              JasonCao Newbie

                              All in all, can anyone give me the total solution for this problem.
                              Because I use JBuilder2005EE+JBoss 4.0.3RC1, I must remove the <port-component> node in the JBoss to deploy the ejb-jar.

                              When there's only one ejb with endpoint webserivce , all is ok. But when there're two webservice , then the error happens.
                              "...Cannot use the same url-pattern with different endpoints..."

                              How on the earth should I config the session beans in the jboss.xml ?

                              Can anyone give me one example with two webserivce endpoint ejb?

                              Thanks!

                              • 13. Re: Bug in ServiceDeployerEjb's portURI
                                Thomas Diesler Master

                                You need to specify a distinct <port-component-uri> for each SLSB. Have a look at jboss_4_0.dtd

                                • 14. Re: Bug in ServiceDeployerEjb's portURI
                                  Anirban Basu Newbie

                                  Hi Thomas,

                                  Even if you do not accept this as a bug, it is an issue that JBossWS should look into. If you need the port-component-uri to be hardcoded, that's a serious portability issue for the EAR.

                                  Anyway, if the whole point is to get two unique URIs like

                                  http://somehost:8080/myservice/bean-one
                                  http://somehost:8080/myservice/bean-two

                                  then why can't JBoss deployer obtain the names 'bean-one' and 'bean-two' either from webservices.xml (<port-component><port-component-name> element).

                                  Otherwise, what do you expect to be put in a port-component-uri in jboss.xml? I tried something like http://somehost:8080/myservice/bean-one and it failed with the exception that it couldn't understand 8080/... portion. What exactly is expected??

                                  XB

                                  1 2 Previous Next