9 Replies Latest reply on Aug 31, 2011 3:07 PM by Mohan Potturi

    Extra slash '/' in the URL

    Mohan Potturi Newbie

      Friends,

       

      We were using Native stack for web services in previous releases of JBoss. Recently we tried to migrate to JBoss6 and JBoss7. We were able to migrate to 6 with few hiccups and to JBoss7 with a lot of difficulty. The web services piece of the application still does not work in JBoss7 while it works in JBoss6 with a change in the URL. For example, the URL (in Native) used to be http://host:port/xyz/ServiceName. After deploying it in JBoss6 it has changed to http://host:port//xyz/ServiceName. Please note the extra '/' after port in the URL. Has anybody ran into this kind of problem? On JBoss7 the ployment fails with an error saying "IllegalArgumentException - Empty segment in the name" or something to that effect. Appreciate any help with these issues.

        • 1. Re: Extra slash '/' in the URL
          Alessio Soldano Master

          Can you share more info on the deployment and exception you get?

          • 2. Re: Extra slash '/' in the URL
            Mohan Potturi Newbie

            Thank you Alessio for the response. Please see the attached logs from JBoss 7 and JBoss 6.1.0. I have two webservices in our app. One is EJB based (packaged inside the EJB jar) and the other one is POJO based (packaged inside a war). They both are packaged indise a EAR file that is deployed in JBoss. I do not have any problem with EJB based service (WmsService). It is the POJO based service (UploadService) that got messed up as far as the URL is concerned. If you open the JBoss 6 log file and search for 'UploadService' you will see the deployment info for this service including the URL. Apparently the deployment info for JBoss 7 also the same but it does not work in 7 as it is not able to complete the deployment process.

             

            Here is the web.xml contents relating to the POJO service:

             

             

            <!-- Upload Users & Certificates web service -->

             

            <servlet> 

            <servlet-name>UploadService</servlet-name>

            <servlet-class>com.crown.infolink.web.ws.upload.UploadUsersNCerts</servlet-class>

            </servlet> 

             

            <servlet-mapping>

            <servlet-name>UploadService</servlet-name>

            <url-pattern>/upload/UploadServices</url-pattern>

            </servlet-mapping>

             

            In earlier version of JBoss with native stack, the URL used to be 'http://host:port/upload/UploadService' In 6 and 7 of JBoss with CXF stack, the URL has become 'http://host:port//upload/UploadService'

            Am I missing anything here? Appreciate your help.

             

            Mohan

            • 3. Re: Extra slash '/' in the URL
              Alessio Soldano Master

              The problem seems to be in the context-root for the jse endpoint being an empty string. That's the case for both AS6 and AS7 afaics from the logs; AS7 throws an exception because it has an additional component that relies on the endpoint context-root creating an AS7 MSC service name.

              So, the actual issue is in the context root being empty. Can you share any descriptor / configuration you have at ear leve (perhaps an application.xml ) that might influence that? Also, how is you packaged app at the end? I assume you have infolinkApp.ear which contains infolink-ejb.jar and infolink-web.war. What about descriptors in the ear? Do you also have a jboss-web.xml descriptor controlling the context root in the war archive?

              • 4. Re: Extra slash '/' in the URL
                Mohan Potturi Newbie

                Alessio,

                Your assumption about the contents

                 

                of our EAR file is correct. We do not use jboss-web.xml or any other descriptor at the war file level. We, however, use application.xml at the EAR file level. I am pasting its contents below:

                 

                <?xml version="1.0" encoding="UTF-8"?>

                <application 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 http://java.sun.com/xml/ns/javaee/application_6.xsd"

                version="6">

                <display-name>InfoLink Software Application</display-name>

                <module>

                <ejb>infolink-ejb.jar</ejb>

                </module>

                <module>

                <web>

                <web-uri>infolink-web.war</web-uri>

                <context-root>/</context-root>

                </web>

                </module>

                </application>

                 

                As you can see, our context root is / and we wanted it at root. It used to work just fine in NATIVE stack. Therefore I am inclined to believe that it is CXF vs NATIVE issue. Is it possible to have context root for the application at root level (/) and a separate context root (/upload ) for the web sevices? Is so, how do I set that up? Appreciate your help.

                 

                Mohan

                • 5. Re: Extra slash '/' in the URL
                  Alessio Soldano Master

                  OK, the application.xml explains to me where that "/" comes from.

                  I've created https://issues.jboss.org/browse/JBWS-3342 for the bug, you can monitor that if you want; it's scheduled for the next major release, should be done by the time AS 7.1 goes final.

                  In the mean time, as a workaround, you can consider splitting the infolink-web.war (if doable) into two wars, one for the ws endpoints only and the other one for the rest of the web app. Then you set "/upload" as context root for the ws endpoint war.

                  Thanks for the feedback, very much appreciated.

                  1 of 1 people found this helpful
                  • 6. Re: Extra slash '/' in the URL
                    Mohan Potturi Newbie

                    Thank you Alessio. Will keep an eye on that. Splitting webservices piece involves a lot of rehashing so we would rather not go that route. In the mean time, is it possible to replace CXF stack with native on AS7? If so how do I do that?

                     

                    Mohan

                    • 7. Re: Extra slash '/' in the URL
                      Alessio Soldano Master

                      I see...

                      Regarding native on AS7, it's currently possible (might not be the case in the future); you need to download jbossws-native sources and install against AS 7 (ant -Djboss700.home=... deploy-jboss700)

                      • 8. Re: Extra slash '/' in the URL
                        Mohan Potturi Newbie

                        Tried that and ran into issues. What am I doing wrong?

                         

                        C:\jbossws-native>ant -Djboss700.home="C:\Program Files\jboss-as-7.0.0.Final" deploy-jboss700
                        Buildfile: C:\jbossws-native\build.xml

                        target-jboss700:

                        os-init:

                        mvn-settings:
                            [mkdir] Created dir: C:\jbossws-native\modules\dist\target
                             [exec] [INFO] Scanning for projects...
                             [exec] [ERROR] The build could not read 1 project -> [Help 1]
                             [exec] [ERROR]
                             [exec] [ERROR]   The project org.jboss.ws.native:jbossws-native:4.0.0-SNAPSHOT (C:\jbossws-native\pom.xml) has 1 er
                        ror
                             [exec] [ERROR]     Non-resolvable parent POM: Could not find artifact org.jboss.ws:jbossws-parent:pom:1.0.10-SNAPSH
                        OT and 'parent.relativePath' points at wrong local POM @ line 24, column 11 -> [Help 2]
                             [exec] [ERROR]
                             [exec] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
                             [exec] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
                             [exec] [ERROR]
                             [exec] [ERROR] For more information about the errors and possible solutions, please read the following articles:
                             [exec] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
                             [exec] [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

                        BUILD FAILEDbuild-error.JPG

                        • 9. Re: Extra slash '/' in the URL
                          Mohan Potturi Newbie

                          Never mind Alessio. After going thru your document about mavenization of the build process and setting up the settings.xml file properly, I am able to build it now. Appreciate your help.

                           

                          Mohan