9 Replies Latest reply on Jun 17, 2009 8:54 AM by rcracel

    Problem following FUSE ESB 4 tutorial

    rcracel

      Hello there,

       

      I have just spent a couple of hours following the "Getting Stated with FUSE ESB 4 Tutorial" by Adrian Trenaman and found it to be very informative. I do however have hit a couple of snags when trying to reproduce the learned material from the tutorial.

       

      What maven archetype was used to create the payments-web-service project? Was it the same as the payments-api project (spring-osgi-bundle-archetype) ?

       

      I have tried using the spring-osgi-bundle-archetype, and maven successfully installs the bundle on my local repository. The ESB however fails to start the bundle complaining that classpath:META-INF/cxf/cxf.xml is missing.

       

      To correct this I attempted to add the dependencies for the web services framework enumerated in the notes directory (jaxb-api,paxws-api,geronimo-ws-metadata_2.0_spec) even though they didn't seem to have any relation to cxf... this however opened a completely new can of worms and at that point maven fails to install the bundle complaining that javax.jws:jsr181:jar:1.0 is missing.

       

      My last attempt was to try to recreate the project using the servicemix-osgi-cxf-wsdl-first-archetype (from http://repo.open.iona.com/maven2/), but the eclipse maven plugin complains with the following error:

      Failed to create project.

        Unable to create project from archetype \[org.apache.servicemix.tooling:servicemix-osgi-cxf-wsdl-first-archetype:2009.01.0.1-fuse -> null\]

        The desired archetype does not exist (org.apache.servicemix.tooling:servicemix-osgi-cxf-wsdl-first-archetype:2009.01.0.1-fuse)

       

      I am just looking for some guidance as to how to what are the missing pieces from the tutorial that I need to use in order to successfully create a simple web service?

       

      My last remark on this is that the org.springsource.bundlor.maven plugin does not like the Bundle-Version to have dashes in it (the default version is 0.0.1-SNAPSHOT) and causes the build to fail as well.

       

      Thank you,

       

      Roger

        • 1. Re: Problem following FUSE ESB 4 tutorial
          oisin

          On the bundlor complaining about the version number, I don't have bundlor here, but I'd guess it really wants the version to have 4 parts, like 0.0.0.1-SNAPSHOT.

           

          On the topic of the FUSE archetype fail, this can happen if m2eclipse hasn't got the FUSE indexes registered.

           

          There's a couple of things I normally do straight away when I'm using m2eclipse.

           

          Add FUSE Indexes

          Bring up the Maven Indexes view :  Window > Show View > Other... > Maven > Maven Indexes

           

           

          This will bring up a view at the bottom of the workbench with a list of the built-in indexes - the workspace, your local maven repository and central.

           

           

          Click on the little-index-card-with-a-plus-sign-on-it icon to add a new index. In the screenshot below, I'm adding the an index for the FUSE Releases repository.

           

           

          You can also add an index for the FUSE Snapshots repository. In the screenshot below, you'll see the final result in the Maven Indexes View.

           

           

          At this point, your m2eclipse installation should be updating the new indexes. You can tell this is happening because of the Updating indexes... message in the status bar at the bottom of the workbench, and because your computer fan has probably just revved up to top speed.

           

          Add FUSE Release Archetypes

          Go to the Eclipse preference page and choose Maven > Archetypes. Press the Add Remote Catalog button.

           

           

          Ok, once that is done, you can then go ahead and make your project from the archetype. When you get to the Select an Archetype page of the Maven Project wizard, you can then select the FUSE Archtypes from the Catalog drop-down and pick the archetype you require.

           

          I just tried that out - and the archetype is correctly discovered.

          • 2. Re: Problem following FUSE ESB 4 tutorial
            rcracel

            Thank you for the swift response. I tried what you sugested and, although I am further along the creation process, I now still get the following error:

             

            org.apache.maven.lifecycle.LifecycleExecutionException: Internal error in the plugin manager executing goal 'org.apache.cxf:cxf-codegen-plugin:2.2.0.0-fuse:wsdl2java': Mojo execution failed.

             

            I did modify pom.xml/cxf-codegen-plugin entry to point to the correct WSDL file.

             

            Roger

            • 3. Re: Problem following FUSE ESB 4 tutorial
              oisin

              I can reproduce this. Big stack trace in the Errors View indicates that there is a ClassNotFoundException happening deep down in the

              org.apache.cxf.maven_plugin.WSDL2JavaMojo

              . It seems that the WSDL to Java operation is failing because the maven plugin can't find Xerces.

               

              I ran the archetype from the command line, but the behaviour is different, meaning that the WSDL2Java maven plugin doesn't get run at all, and there is a successful end to the project creation. This is not what I would expect.

               

              I think that this could be something to do with a classpath not being set up correctly by m2eclipse when it kicks off the maven run. I would suggest that the next step for you is to open a JIRA at http://issues.apache.org/jira/browse/CXF to get some exposure for this issue.

               

              org.apache.maven.lifecycle.LifecycleExecutionException: Internal error in the plugin manager executing goal 'org.apache.cxf:cxf-codegen-plugin:2.2.0.0-fuse:wsdl2java': Mojo execution failed.
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:505)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmentForProject(DefaultLifecycleExecutor.java:265)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:191)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:149)
              at org.apache.maven.DefaultMaven.execute_aroundBody0(DefaultMaven.java:223)
              at org.apache.maven.DefaultMaven.execute_aroundBody1$advice(DefaultMaven.java:304)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:1)
              at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody2(MavenEmbedder.java:904)
              at org.apache.maven.embedder.MavenEmbedder.execute_aroundBody3$advice(MavenEmbedder.java:304)
              at org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:1)
              at org.maven.ide.eclipse.internal.project.DefaultBuildParticipant$1.execute(DefaultBuildParticipant.java:130)
              at org.maven.ide.eclipse.internal.project.MavenProjectManagerImpl.execute(MavenProjectManagerImpl.java:986)
              at org.maven.ide.eclipse.internal.project.MavenProjectFacade.execute(MavenProjectFacade.java:320)
              at org.maven.ide.eclipse.internal.project.DefaultBuildParticipant.executePostBuild(DefaultBuildParticipant.java:116)
              at org.maven.ide.eclipse.internal.project.DefaultBuildParticipant.build(DefaultBuildParticipant.java:80)
              at org.maven.ide.eclipse.internal.builder.MavenBuilder.build(MavenBuilder.java:84)
              at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:627)
              at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
              at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170)
              at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
              at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253)
              at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
              at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
              at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309)
              at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341)
              at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140)
              at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238)
              at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
              Caused by: org.apache.maven.plugin.PluginExecutionException: Mojo execution failed.
              at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:601)
              at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:498)
              ... 27 more
              Caused by: org.apache.maven.plugin.MojoExecutionException: javax.xml.datatype.DatatypeConfigurationException: Provider org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl not found
              at org.apache.cxf.maven_plugin.WSDL2JavaMojo.processWsdl(WSDL2JavaMojo.java:363)
              at org.apache.cxf.maven_plugin.WSDL2JavaMojo.execute(WSDL2JavaMojo.java:257)
              at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:579)
              ... 28 more
              Caused by: java.lang.Error: javax.xml.datatype.DatatypeConfigurationException: Provider org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl not found
              at com.sun.xml.bind.DatatypeConverterImpl.<clinit>(DatatypeConverterImpl.java:785)
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl$3.run(JAXBContextImpl.java:266)
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl$3.run(JAXBContextImpl.java:265)
              at java.security.AccessController.doPrivileged(Native Method)
              at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:264)
              at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
              at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)
              at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:188)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:585)
              at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:133)
              at javax.xml.bind.ContextFinder.find(ContextFinder.java:286)
              at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
              at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
              at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:244)
              at org.apache.cxf.tools.wsdlto.core.PluginLoader.init(PluginLoader.java:82)
              at org.apache.cxf.tools.wsdlto.core.PluginLoader.<init>(PluginLoader.java:72)
              at org.apache.cxf.tools.wsdlto.core.PluginLoader.getInstance(PluginLoader.java:121)
              at org.apache.cxf.tools.wsdlto.WSDLToJava.<init>(WSDLToJava.java:45)
              at org.apache.cxf.maven_plugin.WSDL2JavaMojo.processWsdl(WSDL2JavaMojo.java:360)
              ... 30 more
              Caused by: javax.xml.datatype.DatatypeConfigurationException: Provider org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl not found
              at javax.xml.datatype.DatatypeFactory.newInstance(DatatypeFactory.java:93)
              at com.sun.xml.bind.DatatypeConverterImpl.<clinit>(DatatypeConverterImpl.java:783)
              ... 51 more
              Caused by: java.lang.ClassNotFoundException: org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl
              at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
              at javax.xml.datatype.FactoryFinder.newInstance(FactoryFinder.java:141)
              at javax.xml.datatype.FactoryFinder.findJarServiceProvider(FactoryFinder.java:291)
              at javax.xml.datatype.FactoryFinder.find(FactoryFinder.java:217)
              at javax.xml.datatype.DatatypeFactory.newInstance(DatatypeFactory.java:87)
              ... 52 more
              
              

               

              • 4. Re: Problem following FUSE ESB 4 tutorial
                rcracel

                Adding xercesImpl as a dependency to the project appears to solve the aforementioned problem. But not to my surprise another error is uncovered...

                 

                 

                Access restriction: The type XmlAccessType is not accessible due to restriction on required library C:\Java\jdk1.6.0_13\jre\lib\rt.jar

                 

                I remember seeing this before, but I do not recall how I've fixed it in the past. I am very new to Maven and so far have found it to lacking on the user experience side of things. I am a lot more comfortable writing scripts and managing dependencies myself, although I do agree that this is not optimal.

                 

                My guess at this point is that there are conflicting classes in my classpath (between the JDK rt.jar and jaxb-api-2.1.jar). This seems to only affect the eclipse environment since so far I have not seen any errors during deployment. Nonetheless it would be nice to clear those errors somehow...

                 

                Roger

                • 5. Re: Problem following FUSE ESB 4 tutorial
                  oisin

                   

                  Adding xercesImpl as a dependency to the project appears to solve the aforementioned problem.

                   

                   

                  Good work - how did you add the dependency? I'd like to record this

                  in case others are suffering from it.

                   

                   

                  Access restriction: The type XmlAccessType is not accessible due to restriction on required library C:\Java\jdk1.6.0_13\jre\lib\rt.jar

                   

                   

                  This could be a clash with the jaxb-api-2.1.jar as you say. Is there any improvement in the situation if you remove it from the dependencies?

                   

                  It would also be a good idea to check if there is a jaxb plugin in the Eclipse installation too - Eclipse > About Eclipse SDK > Installation Details and then scan for a javax.xml.bind plugin.

                  • 6. Re: Problem following FUSE ESB 4 tutorial
                    rcracel

                    For the xerces dependency, this is what fixed my problem:

                     

                               

                     

                    Again, I am very new to maven and unsure if this is the "recommended" way... all I can say is that this fixed my problem.

                     

                    For the eclipse issue, I have to look further into it, but since it has not caused issues during deployment, I am considering it to more of an aesthetic inconvenience than really a problem.

                     

                    I feel that I am really close to getting my own flavor of the demo to work, and have hit what I believe to be the last snag on my process. Hopefully once everything is resolved I will post all the steps from beginning to end that I had to take in order to deploy this "simple" hello world service, based on the FUSE ESB tutorial.

                     

                    My last problem is the following:

                    java.io.FileNotFoundException: OSGi resource[classpath:META-INF/cxf/cxf.xml|bnd.id=97|bnd.sym=null] cannot be resolved to URL because it does not exist

                     

                    My WSLD file has references to external schemas, and I have found the following that could be related to my problem:

                     

                    http://fusesource.com/issues/browse/ESB-238

                     

                    But although it does sound like this could be the exact problem I am currently experiencing, the issue mentioned above is for version 3.3.1.0 and has been already resolved in May 08. I am uncertain as how to proceed at this point... any ideas?

                     

                    Roger

                    • 7. Re: Problem following FUSE ESB 4 tutorial
                      oisin

                      I think I was less than clear in my question - the mechanics of adding the dependency I do understand - what I was trying to discover was if you had managed somehow to add the dependency in such a way that the project creation from archetype succeeded from scratch.

                       

                       

                      Hopefully once everything is resolved I will post all the steps from beginning to end that I had to take in order to deploy this "simple" hello world service, based on the FUSE ESB tutorial.

                       

                       

                      That would be very helpful for all, thank you!

                       

                       

                      My last problem is the following:

                      java.io.FileNotFoundException: OSGi resourceclasspath:META-INF/cxf/cxf.xml cannot be resolved to URL because it does not exist

                       

                       

                      I have not seen this occur myself - that file is a CXF Spring configuration file, and as I understand it, it's not a mandatory thing. CXF should start up in a default mode without it.

                      • 8. Re: Problem following FUSE ESB 4 tutorial
                        rcracel

                        No, unfortunately I had to add the dependency afterwards. I did create a new ticket regarding this issue -- apologies, it is on my work email, which I don't have access to from home -- and will keep an eye on it, and try to post any changes here.

                         

                        The cxf.xml problem is intriguing though, because it seems to go away (still need to test it further) when no external xsd's are present.

                         

                        Additionally another issue I came across was the fact that even though I only specified one WSDL to be parsed by the wsdl2java plugin, it proceeded to parse all of the WSDL files on the given directory -- which in turned caused problems since they were not complete. Not sure why this happened, I guess I also need to look further into this....

                         

                        Roger

                        • 9. Re: Problem following FUSE ESB 4 tutorial
                          rcracel

                          As it turns out, embedding all the type definitions inside the WSDL itself did not solve the problem. I guess now I have to take a step back and try to find a solution to this by comparing my hello world project with the one from the tutorial. Hopefully this will turn out to be something simple that I overlooked when writing some configuration file.