Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Problem deploying Apache CXF Webservice on Virgo: Cannot resolve XML Schema
Problem deploying Apache CXF Webservice on Virgo: Cannot resolve XML Schema [message #1048415] Wed, 24 April 2013 08:41 Go to next message
Manuel Loth is currently offline Manuel Loth
Messages: 2
Registered: April 2013
Junior Member
Hello everyone.

I have created this topic because I am in quite some predicament here and I hope, that one of you is able to help me get out of it.

The problem is the following:

I am working in an OSGi-Environment with an Eclipse Virgo (Version 3.6) as the OSGi-Application Server.
The build is done using Maven Tycho to create and bundle the jars.
So far deploying and using the bundles worked quite well.

For a new feature in the application I need to specify and automatically deploy a JAX-WS Webservice on Virgo startup.
The Webservice-Content is deployed as a bundle as well.

Now, due to various reasons, it was decided to use the Apache CXF-Framework to specify the Webservice in a Contract-first approach.
If I now try to recreate one of the CXF-Samples (for example the Hello World) as a local Webservice without deploying it on Virgo everything works fine.

The problem occurs as soon as I try to change the local Webservice into a bundle and try to deploy it on my Virgo.
For this I create the necessary web.xml as well as the context.xml files, to specify the Endpoint-Implementation automatically, according to one of the CXF samples.
I placed all CXF-bundles in Virgos repository and specified the new repository in its configuration-file so that Virgo is able to find them.

In my webservice-bundle manifest I declare the required CXF-bundles so they will get started.
My manifest looks like this:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Version: 1.0.0.qualifier
Bundle-Name: CXFTest
Bundle-SymbolicName: CXFTest
Require-Bundle: org.apache.cxf.cxf-rt-frontend-jaxws;bundle-version="2.7.3",
 org.apache.cxf.cxf-api;bundle-version="2.7.3",
 org.apache.cxf.xjc-utils.cxf-xjc-runtime;bundle-version="2.6.1",
 org.apache.cxf.cxf-rt-core;bundle-version="2.7.3"
Web-ContextPath: /cxf
Import-Package: javax.servlet;version="[2.4,4)",
 javax.servlet.http;version="[2.4,4)",
 org.apache.shiro.web.env;version="[1.2.1,2.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7


I am able to add the generated WAR to my Virgo and publish it.

If I then try to start the Virgo it will startup normally until it tries to start my web-bundle.
As soon as it tries to start it, I will get the following error message:
[2013-04-24 11:54:56.823] region-dm-6                  <AG0000E> Application context creation failure for bundle 'org.apache.cxf.cxf-rt-transports-http' version '2.7.3'. org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 27 in XML document from OSGi resource[bundleentry://168.fwk13933553/OSGI-INF/blueprint/osgiservlet.xml|bnd.id=168|bnd.sym=org.apache.cxf.cxf-rt-transports-http] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 27; columnNumber: 87; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'cm:property-placeholder'.
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
	at org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:170)
	at org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:140)
	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:527)
	at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.access$800(AbstractDelegatedExecutionApplicationContext.java:60)
	at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:242)
	at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
	at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:220)
	at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:224)
	at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:177)
	at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:157)
	at org.eclipse.gemini.blueprint.extender.internal.activator.LifecycleManager$1.run(LifecycleManager.java:211)
	at org.eclipse.virgo.kernel.agent.dm.ContextPropagatingTaskExecutor$2.run(ContextPropagatingTaskExecutor.java:95)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:722)
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'cm:property-placeholder'.
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:453)
	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3232)
	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1912)
	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:741)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:376)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2717)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:489)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:237)
	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
	at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
	... 21 common frames omitted


And somewhat later the following error:
[2013-04-24 14:11:32.839] start-signalling-1           <DE0006E> Start failed for bundle 'CXFTest' version '1.0.0.qualifier'. org.eclipse.virgo.nano.deployer.api.core.DeploymentException: Web application failed to start
	at org.eclipse.virgo.web.core.internal.WebBundleLifecycleListener.onStarted(WebBundleLifecycleListener.java:132)
	at org.eclipse.virgo.kernel.install.artifact.internal.StandardArtifactStateMonitor.onStarted(StandardArtifactStateMonitor.java:271)
	at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact.asyncStartSucceeded(AbstractInstallArtifact.java:319)
	at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact.access$0(AbstractInstallArtifact.java:316)
	at org.eclipse.virgo.kernel.install.artifact.internal.AbstractInstallArtifact$StateMonitorSignal.signalSuccessfulCompletion(AbstractInstallArtifact.java:252)
	at org.eclipse.virgo.nano.core.internal.BundleStartTracker$1.run(BundleStartTracker.java:140)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:722)
Caused by: org.eclipse.gemini.web.core.WebApplicationStartFailedException: org.eclipse.gemini.web.core.spi.ServletContainerException: Web application at '/cxf' failed to start. Check the logs for more details.
	at org.eclipse.gemini.web.internal.StandardWebApplication.start(StandardWebApplication.java:137)
	at org.eclipse.virgo.web.core.internal.WebBundleLifecycleListener.onStarted(WebBundleLifecycleListener.java:122)
	... 8 common frames omitted
Caused by: org.eclipse.gemini.web.core.spi.ServletContainerException: Web application at '/cxf' failed to start. Check the logs for more details.
	at org.eclipse.gemini.web.tomcat.internal.TomcatServletContainer.startWebApplication(TomcatServletContainer.java:133)
	at org.eclipse.gemini.web.internal.StandardWebApplication.start(StandardWebApplication.java:109)
	... 9 common frames omitted

(I think this error can be ignored because it happens due to the missing dependencies from the first one?)

The faulty XML file (according to the error) can be found in the cxf-rt-transports-http-2.7.3.jar and looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

h++p://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<blueprint xmlns="h++p://www.osgi.org/xmlns/blueprint/v1.0.0"
           xmlns:xsi="h++p://www.w3.org/2001/XMLSchema-instance"
           xmlns:cm="h++p://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"

           xsi:schemaLocation="
            h++p://www.osgi.org/xmlns/blueprint/v1.0.0 h++p://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">

  <cm:property-placeholder persistent-id="org.apache.cxf.osgi" id="cxfOsgiProperties">

    <cm:default-properties>

      <cm:property name="org.apache.cxf.servlet.context" value="/cxf"/>
      <cm:property name="org.apache.cxf.servlet.name" value="cxf-osgi-transport-servlet"/>
      <cm:property name="org.apache.cxf.servlet.hide-service-list-page" value="false"/>
      <cm:property name="org.apache.cxf.servlet.disable-address-updates" value="false"/>
      <cm:property name="org.apache.cxf.servlet.base-address" value=""/>
      <cm:property name="org.apache.cxf.servlet.service-list-path" value=""/>
      <cm:property name="org.apache.cxf.servlet.static-resources-list" value=""/>
      <cm:property name="org.apache.cxf.servlet.redirects-list" value=""/>
      <cm:property name="org.apache.cxf.servlet.redirect-servlet-name" value=""/>
      <cm:property name="org.apache.cxf.servlet.redirect-servlet-path" value=""/>
      <cm:property name="org.apache.cxf.servlet.service-list-all-contexts" value=""/>

    </cm:default-properties>

  </cm:property-placeholder>

  <bean id="destinationRegistry" class="org.apache.cxf.transport.http.DestinationRegistryImpl"/>

  <bean id="osgiServlet" class="org.apache.cxf.transport.servlet.CXFNonSpringServlet">
    <argument ref="destinationRegistry"/>
    <argument value="false"/>
  </bean>

  <service ref="osgiServlet" interface="javax.servlet.Servlet">
    <service-properties>
      <entry key="alias" value="${org.apache.cxf.servlet.context}"/>
      <entry key="servlet-name" value="${org.apache.cxf.servlet.name}"/>
      <entry key="hide-service-list-page" value="${org.apache.cxf.servlet.hide-service-list-page}"/>
      <entry key="disable-address-updates" value="${org.apache.cxf.servlet.disable-address-updates}"/>
      <entry key="base-address" value="${org.apache.cxf.servlet.base-address}"/>
      <entry key="service-list-path" value="${org.apache.cxf.servlet.service-list-path}"/>
      <entry key="static-resources-list" value="${org.apache.cxf.servlet.static-resources-list}"/>
      <entry key="redirects-list" value="${org.apache.cxf.servlet.redirects-list}"/>
      <entry key="redirect-servlet-name" value="${org.apache.cxf.servlet.redirect-servlet-name}"/>
      <entry key="redirect-servlet-path" value="${org.apache.cxf.servlet.redirect-servlet-path}"/>
      <entry key="service-list-all-contexts" value="${org.apache.cxf.servlet.service-list-all-contexts}"/>
    </service-properties>
  </service>

  <service ref="destinationRegistry" interface="org.apache.cxf.transport.http.DestinationRegistry">
  </service>

</blueprint>


I did not make any changes to this file or the bundle itself.

The xml looks fine to me and I can't see any errors with the Schema definition.
The import of the Apache Camel Schema (xmlns:cm="h++p://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0") is used throughout multiple CXF-bundles and every other bundle seems to work.

While the problem may look like an Apache CXF problem I am quite irritated by the fact, that no one elses seems to have the same problem.
This is why I'm assuming, that this is a problem due to the combination of Apache CXF with Eclipse Virgo.

I have attached a Zip containing the example project I used as well as the complete Virgo log.

I have invested quite some time trying to find a solution for the problem but was unable to solve it.
So I hope someone of you could help me find a solution.

Many thanks.

Kind regards,
Manuel Loth
  • Attachment: CXF.zip
    (Size: 53.85KB, Downloaded 55 times)
Re: Problem deploying Apache CXF Webservice on Virgo: Cannot resolve XML Schema [message #1053008 is a reply to message #1048415] Wed, 01 May 2013 17:04 Go to previous messageGo to next message
Neil Corbet is currently offline Neil Corbet
Messages: 12
Registered: October 2012
Junior Member
Manuel,

Are you using a plan? Is your cxf bundle in the repository/usr directory?

This is not going to help you much, but I get the same behavior if the plan that contains my cxf bundle is scoped="false". This causes the plugins in the plan to be exposed to other regions. I am wondering if there is another plugin that is forcing the cxf schema to be so strict. If I make it true, bundle installs and activates fine.

I hope you figure it out, once I get my JPA/EclipseLink issues resolved I am moving on to CXF.


Neil
Re: Problem deploying Apache CXF Webservice on Virgo: Cannot resolve XML Schema [message #1053282 is a reply to message #1053008] Fri, 03 May 2013 10:35 Go to previous messageGo to next message
Manuel Loth is currently offline Manuel Loth
Messages: 2
Registered: April 2013
Junior Member
Hello Neil

Thank you for your answer.

Sadly it did not help me much further in solving my problem.

The CXF bundles are placed in Virgos repository directory so Virgo is able to access them.
I'm not using a specific plan (only the default org.eclipse.virgo.apps.repository_3.6.0.RELEASE.par).

My latest guess is, that CXF (respectively Apache Camel) tries to use Aries Blueprints.
Those conflict with Virgos Gemini Blueprints so Virgo is unable to parse and interpret those Aries-specific namespaces or elements:
xmlns:cm="h++p://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"


Thanks.

Kind regards,
Manuel Loth
Re: Problem deploying Apache CXF Webservice on Virgo: Cannot resolve XML Schema [message #1053310 is a reply to message #1053282] Fri, 03 May 2013 14:55 Go to previous messageGo to next message
Neil Corbet is currently offline Neil Corbet
Messages: 12
Registered: October 2012
Junior Member
Manuel,

Another observation that I had during my own attempts to get cxf working in VTS is that the cxf-bundle-minimal I am using is throwing the same "error", but the bundle still starts and my bundle that relies on it starts fine.

I agree that it is troubling it relies on aries and gemini.

Hopefully one of us will get some cxf webservices running under VTS.

Neil
Re: Problem deploying Apache CXF Webservice on Virgo: Cannot resolve XML Schema [message #1057755 is a reply to message #1053310] Wed, 08 May 2013 11:12 Go to previous message
Neil Corbet is currently offline Neil Corbet
Messages: 12
Registered: October 2012
Junior Member
Manuel,

I have an update. I upgraded to CXF-DOSGI 1.4. I added the following Aries Blueprint files to my usr directory:


  • org.apache.aries.blueprint-0.3.2
  • org.apache.aries.util_3.0.1
  • org.apache.aries.proxy-0.3.1


These bundles are included with the CXF 1.4 download.Since I am using REST and jax-rs my bundle needs are a little different than yours, but I am sure there are corresponding bundles ( if not just version updates ) for yours. I then added any needed dependencies, also included in CXF-DOSGI 1.4 download, to the usr directory as well.

The NameSpaceService that aries exposes is picked up by CXF and the new schemas validate fine. I no longer get that SAX exception you were getting. It may be a good exercise for you to upgrade and see if it helps your situation at all.

Neil

[Updated on: Thu, 09 May 2013 08:52]

Report message to a moderator

Previous Topic:Virgo 3.6.1 and SpringFramework 3.2.2
Next Topic:Virgo with CXF Web Services
Goto Forum:
  


Current Time: Wed Jul 30 17:26:07 EDT 2014

Powered by FUDForum. Page generated in 0.01897 seconds