I am completely new to camel and jboss fuse and I am facing one problem. I am trying to send a request to my webservice using soapUI.I have used cxf component of apache camel and jaxb in apache camel. In the request there is a tag AuthTimeStamp.
When I am entering
<AuthTimestamp>2009-01-02T11:13:56.745+05:30 </AuthTimestamp>
it is working fine. But when I am entering:
<AuthTimestamp>3-23-190017:00</AuthTimestamp>
it is giving me error. I believe jaxb is doing some kind of validation and my request is failing there. But I don't to return soap fault type error.
I want a proper xml to be returned with proper information. If the request passes to my cxf bean then I can handle the exception make a proper error packet and return it. Similar questions have been asked before but I was not able to find appropriate solution.
Initial part of my camel route:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<!-- Service for gateway is exposed. cxfEndpoint mentioned in EsangamBeanConfig.xml-->
<!-- <to uri="bean:NSDGPortTypeImpl"/> -->
<!-- <simple>${body.getIISMessage()}</simple> -->
<!-- <to uri="bean:iISMessageProcessorID?method=logTransaction(${body})"/>
-->
<!--Here goes IISMessageContext(body) -->
<!--Here goes SubmitDocument(body) -->
<!--Here goes IISMessageContext(body) -->
<camelContext id="eSangamMessagingCamelContext" xmlns="http://camel.apache.org/schema/spring">
<dataFormats>
<jaxb contextPath="in.gov.esangam.eservices.messaging" prettyPrint="true" encoding="UTF-8" id="myJaxb"/>
</dataFormats>
<route id="eSangam Messaging Start">
<from uri="cxf:bean:NSDGPortType"/>
<log message="New Request Arrived at Gateway"/>
Below is the stack trace:
14:47:31,842 | WARN | qtp1545452967-60 | PhaseInterceptorChain | 118 - org.apache.cxf.cxf-core - 3.0.4.redhat-620133 | Interceptor for {http://www.mit.gov.in/eGov/schema/NSDG/wsdl}NSDGPortTypeService#{http://www.mit.gov.in/eGov/schema/NSDG/wsdl}processSubmitDocument has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unmarshalling Error: 3/23/19005:00:00PM
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:908)[132:org.apache.cxf.cxf-rt-databinding-jaxb:3.0.4.redhat-620133]
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:712)[132:org.apache.cxf.cxf-rt-databinding-jaxb:3.0.4.redhat-620133]
at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:176)[132:org.apache.cxf.cxf-rt-databinding-jaxb:3.0.4.redhat-620133]
at org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:194)[131:org.apache.cxf.cxf-rt-wsdl:3.0.4.redhat-620133]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)[118:org.apache.cxf.cxf-core:3.0.4.redhat-620133]
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)[118:org.apache.cxf.cxf-core:3.0.4.redhat-620133]
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:251)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620133]
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620133]
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620133]
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620133]
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620133]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:293)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620133]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:212)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620133]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)[89:org.apache.geronimo.specs.geronimo-servlet_3.0_spec:1.0.0]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:268)[123:org.apache.cxf.cxf-rt-transports-http:3.0.4.redhat-620133]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:69)[101:org.ops4j.pax.web.pax-web-jetty:3.2.3]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:240)[101:org.ops4j.pax.web.pax-web-jetty:3.2.3]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:75)[101:org.ops4j.pax.web.pax-web-jetty:3.2.3]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.Server.handle(Server.java:370)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)[94:org.eclipse.jetty.aggregate.jetty-all-server:8.1.17.v20150415]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_91]
Caused by: javax.xml.bind.UnmarshalException
- with linked exception:
[javax.xml.bind.UnmarshalException: 3/23/19005:00:00PM
- with linked exception:
[java.lang.IllegalArgumentException: 3/23/19005:00:00PM]]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:483)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:417)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:394)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at org.apache.cxf.jaxb.JAXBEncoderDecoder.doUnmarshal(JAXBEncoderDecoder.java:858)[132:org.apache.cxf.cxf-rt-databinding-jaxb:3.0.4.redhat-620133]
at org.apache.cxf.jaxb.JAXBEncoderDecoder.access$100(JAXBEncoderDecoder.java:102)[132:org.apache.cxf.cxf-rt-databinding-jaxb:3.0.4.redhat-620133]
at org.apache.cxf.jaxb.JAXBEncoderDecoder$2.run(JAXBEncoderDecoder.java:897)
at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_91]
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:895)[132:org.apache.cxf.cxf-rt-databinding-jaxb:3.0.4.redhat-620133]
... 40 more
Caused by: javax.xml.bind.UnmarshalException: 3/23/19005:00:00PM
- with linked exception:
[java.lang.IllegalArgumentException: 3/23/19005:00:00PM]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:740)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleError(UnmarshallingContext.java:770)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleError(UnmarshallingContext.java:766)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.handleParseConversionException(Loader.java:275)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.LeafPropertyLoader.text(LeafPropertyLoader.java:69)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.text(UnmarshallingContext.java:589)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.processText(StAXStreamConnector.java:338)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleEndElement(StAXStreamConnector.java:216)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:185)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:415)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
... 46 more
Caused by: javax.xml.bind.UnmarshalException: 3/23/19005:00:00PM
- with linked exception:
[java.lang.IllegalArgumentException: 3/23/19005:00:00PM]
... 56 more
Caused by: java.lang.IllegalArgumentException: 3/23/19005:00:00PM
at org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parseYear(Unknown Source)[:]
at org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parse(Unknown Source)[:]
at org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl.<init>(Unknown Source)[:]
at org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl.newXMLGregorianCalendar(Unknown Source)[:]
at com.sun.xml.bind.DatatypeConverterImpl._parseDateTime(DatatypeConverterImpl.java:378)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$2.parse(RuntimeBuiltinLeafInfoImpl.java:279)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$2.parse(RuntimeBuiltinLeafInfoImpl.java:277)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.FilterTransducer.parse(FilterTransducer.java:84)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.parse(TransducedAccessor.java:245)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
at com.sun.xml.bind.v2.runtime.unmarshaller.LeafPropertyLoader.text(LeafPropertyLoader.java:65)[113:org.apache.servicemix.bundles.jaxb-impl:2.2.11.1]
... 51 more
14:47:31,846 | INFO | qtp1545452967-60 | Soap12FaultOutInterceptor | 134 - org.apache.cxf.cxf-rt-bindings-soap - 3.0.4.redhat-620133 | class org.apache.cxf.binding.soap.interceptor.Soap12FaultOutInterceptor$Soap12FaultOutInterceptorInternalapplication/soap+xml
Related
I according jax-ws API integration jax-ws with Spring ,but I get an exception at my webservice project,here is API site :http://jax-ws-commons.java.net/spring/ ,I have same config xml in my project,but i get an exception is below:
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'handlers' is not allowed to appear in element 'ws:service'.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
who can give me solution?
The example given is wrong and not valid with regard to the schema. handlers is not an attribute, but a nested element. Use it like this:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
xmlns:ws="http://jax-ws.dev.java.net/spring/core"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://jax-ws.dev.java.net/spring/servlet http://jax-ws.dev.java.net/spring/servlet.xsd http://jax-ws.dev.java.net/spring/core http://jax-ws.dev.java.net/spring/core.xsd">
<wss:binding url="/services/demo">
<wss:service>
<ws:service bean="#demoEndpoint">
<ws:handlers>
<ref bean="demoHandler"/>
</ws:handlers>
</ws:service>
</wss:service>
</wss:binding>
</bean>
I am developing a new web service. But I cannot seem to figure out the best way to set up the web service to deploy in jboss as 7.
As per the jboss documentation, here is the web.xml.
<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 http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<servlet>
<servlet-name>testService</servlet-name>
<servlet-class>com.sgb.testService.ws.web.TestService</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>testService</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
As per the jboss docs, it also needs a jboss-cxf.xml for all the configurations for cxf and spring.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:wsa="http://cxf.apache.org/ws/addressing"
xmlns:http="http://cxf.apache.org/transports/http/configuration"
xmlns:sec="http://cxf.apache.org/configuration/security"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd ">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<!-- import spring application context configurations -->
<import resource="classpath:META-INF/spring/applicationContext-ws.xml" />
<jaxws:endpoint id="testService"
implementor="com.sgb.testService.ws.web.TestService"
address="/testService" >
<!--
address="http://localhost:8080/testService">
-->
<jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
<jaxws:invoker>
<bean class="org.jboss.wsf.stack.cxf.InvokerJSE" />
</jaxws:invoker>
</jaxws:endpoint>
And the spring configurations are defined in the ApplicationContext-ws.xml here.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<context:property-placeholder location="classpath*:META-INF/spring/*.properties" />
<!--
import the common configurations from core sub-module
which contains the declarations for Datasource, EntityManagerFactory & PersistanceUnit
-->
<import resource="applicationContext-core.xml" />
<import resource="applicationContext-jpa.xml" />
<!-- setting up multiple packages to scan for components -->
<context:component-scan base-package="com.sgb.testService.ws.service" />
<!-- Declare the Transaction Manager -->
<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<!-- declare transactions as annotation driven -->
<tx:annotation-driven
transaction-manager="transactionManager" />
Does the above look right?
Am I missing anything?
Specific Question:
For deploying a cxf based web service in jboss AS 7, where does the spring beans configuration (ApplicationContext-ws.xml above) need to be defined?
Can someone point me to a recent (2012) example or tutorial. Most of the examples I find online seem to be old and I cannot seem to find a proper tutorial in the jboss or spring websites...
Thank you.
-SGB
EDIT TO ADD:
The error message seems to indicate that while deploying the war file, jboss is attempting to publish the wsdl to JBOSS_HOME/standalone/data/wsdl/TestService.war, but is failing as it cannot find the schema (xsd file). This is a bit strange as bot the schema and wsdl is inside WEB-INF/wsdl/ directory.
where
JBOSS_HOME = C:\Program Files (x86)\Apache Software Foundation\jboss-as-7.1.1.Final\
ERROR MESSAGE:
15:56:09,146 INFO [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-4) Creating Service {http://www.sgb.com/Slm/ES
/TestServiceIdentifier}TestServiceIdentifier from WSDL: WEB-INF/wsdl/TestService.wsdl
15:56:09,238 INFO [org.apache.cxf.endpoint.ServerImpl] (MSC service thread 1-4) Setting the server's publish address to be http://localhost:8080/eucl
id-ws
15:56:09,266 INFO [org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher] (MSC service thread 1-4) WSDL published to: JBOSS_HOME/standalone/data/wsdl/testService-ws.war /TestService.wsdl
15:56:09,270 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."testService-ws.war".INSTA
LL: org.jboss.msc.service.StartException in service jboss.deployment.unit."testService-ws.war".INSTALL: Failed to process phase INSTALL of deployment "eucl
id-ws.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_33]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_33]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_33]
Caused by: java.lang.RuntimeException: Cannot publish wsdl to: JBOSS_HOME\standalone\data\
wsdl\testService-ws.war\TestService.wsdl
at org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher.publishWsdlFiles(WSDLFilePublisher.java:107)
at org.jboss.wsf.stack.cxf.deployment.EndpointImpl.publishContractToFilesystem(EndpointImpl.java:222)
at org.jboss.wsf.stack.cxf.deployment.EndpointImpl.doPublish(EndpointImpl.java:93)
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:239)
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:509)
at org.jboss.wsf.stack.cxf.configuration.NonSpringBusHolder.configure(NonSpringBusHolder.java:117)
at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.startDeploymentBus(BusDeploymentAspect.java:113)
at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.start(BusDeploymentAspect.java:66)
at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:74)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1
.Final]
... 5 more
Caused by: java.io.FileNotFoundException: JBOSS_HOME\standalone\data\wsdl\testService-ws.war\TestServiceIdentifier.xsd (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method) [rt.jar:1.6.0_33]
at java.io.FileInputStream.<init>(FileInputStream.java:120) [rt.jar:1.6.0_33]
at java.io.FileInputStream.<init>(FileInputStream.java:79) [rt.jar:1.6.0_33]
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70) [rt.jar:1.6.0_33]
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161) [rt.jar:1.6.0_33]
at java.net.URL.openStream(URL.java:1010) [rt.jar:1.6.0_33]
at org.jboss.ws.common.utils.AbstractWSDLFilePublisher.publishSchemaImports(AbstractWSDLFilePublisher.java:243)
at org.jboss.ws.common.utils.AbstractWSDLFilePublisher.publishSchemaImports(AbstractWSDLFilePublisher.java:250)
at org.jboss.ws.common.utils.AbstractWSDLFilePublisher.publishSchemaImports(AbstractWSDLFilePublisher.java:250)
at org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher.publishWsdlFiles(WSDLFilePublisher.java:94)
... 14 more
15:56:09,343 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "testService-ws.war" was rolled back with failure
message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"testService-ws.war\".INSTALL" => "org.jboss.msc.service.StartException in service jbos
s.deployment.unit.\"testService-ws.war\".INSTALL: Failed to process phase INSTALL of deployment \"testService-ws.war\""}}
15:56:09,413 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment testService-ws.war in 70ms
15:56:09,414 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."testService-ws.war".INSTALL: org.jboss.msc.service.StartException in serv
ice jboss.deployment.unit."testService-ws.war".INSTALL: Failed to process phase INSTALL of deployment "testService-ws.war"
15:56:09,421 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled ba
ck. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"testService-ws.war\".INSTALL" => "org.jboss.m
sc.service.StartException in service jboss.deployment.unit.\"testService-ws.war\".INSTALL: Failed to process phase INSTALL of deployment \"testService-ws.war\""
}}}}
From the above, the root cause seem to be this:
Caused by: java.io.FileNotFoundException: JBOSS_HOME\standalone\data\wsdl\testService-ws.war\TestServiceIdentifier.xsd (The system cannot find the file specified)
It seems like it is able to find the WSDL, but not the corresponding xsd which it uses which is available in the same directory as WSDL file.
As per this https://issues.jboss.org/browse/JBWS-3532, it might be due to the space in the path of JBOSS_HOME directory. As per a comment by a Richard Opalka in the link above, it looks like it was fixed in a newer build too.
I downloaded the latest nightly of jboss and installed in c:\jboss\ and the problem dis-appeared.
This question already has answers here:
Why does Spring MVC respond with a 404 and report "No mapping found for HTTP request with URI [...] in DispatcherServlet"?
(13 answers)
Closed 6 years ago.
I am trying out a very simple helloworld kind RestFul webservice in the Spring environment and I have been getting "org.springframework.web.servlet.DispatcherServlet noHandlerFound No mapping found for HTTP request with URI [..] in DispatcherServlet with name ..". I have tried various things but nothing is working. So far this is what I have :
web.xml
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>spitter</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spitter</servlet-name>
<url-pattern>/testWs/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spitter-servlet.xml</param-value>
</context-param>
spitter-servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<mvc:annotation-driven />
<context:component-scan base-package="org.resttest.bso" />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
And the Controller class;
package org.resttest.bso;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.ModelMap;
#Controller
#RequestMapping("/partners")
public class PartnerController {
public PartnerController(){
System.out.println("******* From the constructor ***** " );
}
#RequestMapping("method=RequestMethod.GET")
public String getPartner(ModelMap model){
try{
model.addAttribute("message", "Spring 3 MVC Hello World");
System.out.println("******* Test message " );
}catch(Exception ex){
System.out.println("******* Exception thrown ... " + ex.getMessage());
}
return "test";
}
}
And in WEB-INF/views/test.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><%#page
language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<h1>Message : ${message}</h1>
</body>
</html>
When the server starts I also do see this :
[11/28/12 9:24:02:803 EST] 00000013 DefaultAnnota I org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler Mapped URL path [/partners/method=RequestMethod.GET] onto handler 'partnerController'
But when I try to access using url :
localhost:9080/contextRoot/testWs/partners/
I get the error :
[11/28/12 9:31:07:034 EST] 00000044 PageNotFound W org.springframework.web.servlet.DispatcherServlet noHandlerFound No mapping found for HTTP request with URI [/contextRoot/testWs/partners/] in DispatcherServlet with name 'spitter'
Any help is highly appreciated. I have tried several changes based on suggestions on the forums, but nothing seems to work.
Thanks
You have #RequestMapping("method=RequestMethod.GET")
remove the quotes
#RequestMapping(method=RequestMethod.GET)
And it should work.
Remember things while server spring MVC project doing
index.jsp(firslt starting page) should be under WebConent. not under WEB-INF
not under your jsp folder(your jsp pages folder).
Mapping : url pattern is like, if it is in web.xml like /
then "/" this symbol comes at only at in controller class annotation of request
mappin("/**"). no where comes. especially in request at jsp page. there is
request is going to that annatation.
add all jars, like ojdbc14.jar for db.
autowiring is main, how bean id name in configuration file it should same as it is
in your classes.
I'm trying to create a WS, deploy it in Tomcat, inside a webapplication and use a stub to call it.
I'm using this interface as a base for the WSDL:
package com.at.iscrizio.ws.services;
public interface SalutareService {
public String sayciao(String name);
}
and this script to generate the wsdl file, the server and deploy files and the client-side files:
set WSDL_FILE=SalutareService.wsdl
set TO_WSDL=%AXIS2_HOME%/bin/java2wsdl.bat
set TO_JAVA=%AXIS2_HOME%/bin/wsdl2java.bat
set CLASS=com.at.iscrizio.ws.services.SalutareService
set SOAP_ADDR=http://localhost:9090/Iscrizio/services/SalutareServiceEx
call %TO_WSDL% -cp build/classes -o ./wsdl -of %WSDL_FILE% -cn %CLASS% -l %SOAP_ADDR%
call %TO_JAVA% -uri wsdl/%WSDL_FILE% -S generated -o axis -ss -sd -ssi --noWSDL
call %TO_JAVA% -uri wsdl/%WSDL_FILE% -S generated -o axis
This is my WS implementation
package com.at.iscrizio.ws.services;
public class SalutareServiceEx implements SalutareServiceSkeletonInterface {
#Override
public SayciaoResponse sayciao(Sayciao sayciao) {
SayciaoResponse resp = new SayciaoResponse();
resp.set_return("Ciao");
return resp;
}
}
this is my service.xml (a little bit different from the one that the standard axis build.xml generated, just to change the ServiceClass):
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file was auto-generated from WSDL -->
<!-- by the Apache Axis2 version: 1.6.1 Built on : Aug 31, 2011 (12:22:40 CEST) -->
<serviceGroup>
<service name="SalutareServiceEx">
<messageReceivers>
<messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="com.at.iscrizio.ws.services.SalutareServiceMessageReceiverInOut"/>
</messageReceivers>
<parameter name="ServiceClass">com.at.iscrizio.ws.services.SalutareServiceEx</parameter>
<parameter name="useOriginalwsdl">true</parameter>
<parameter name="modifyUserWSDLPortAddress">true</parameter>
<operation name="sayciao" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://services.ws.iscrizio.at.com">
<actionMapping>urn:sayciao</actionMapping>
<outputActionMapping>urn:sayciaoResponse</outputActionMapping>
</operation>
</service>
</serviceGroup>
Inside server-config.wsdd, I have:
<handler name="Trace" type="java:com.at.iscrizio.ws.handler.TraceHandler"/>
<service name="SalutareServiceEx" provider="java:RPC">
<requestFlow>
<handler type="Trace"/>
</requestFlow>
<parameter name="allowedMethods" value="sayciao"/>
<parameter name="scope" value="Request"/>
<parameter name="className" value="com.at.iscrizio.ws.services.SalutareServiceEx"/>
</service>
I'm able to see the page http://localhost:9090/Iscrizio/services/SalutareServiceEx?wsdl
We're almost at the end...With this piece of code, i'm using the stub to call the ws:
SalutareServiceStub stub = new SalutareServiceStub();
SalutareServiceStub.Sayciao param = new SalutareServiceStub.Sayciao();
param.setName("Antonio");
SalutareServiceStub.SayciaoResponse resp = stub.sayciao(param);
System.out.println(resp);
the request pass through my handler (the one defined inside the wsdd), I can see using the remote debug.
Using TCPMon, i saw my request:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns1:sayciao xmlns:ns1="http://services.ws.iscrizio.at.com">
<ns1:name>Antonio</ns1:name>
</ns1:sayciao>
</soapenv:Body>
</soapenv:Envelope>
and the ws response:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance">
<soapenv:Body>
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>soapenv:Sender</soapenv:Value>
<soapenv:Subcode xmlns:ns1="http://www.w3.org/2003/05/soap-rpc">
<soapenv:Value>ns1:BadArguments</soapenv:Value>
</soapenv:Subcode>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en">string</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail>
<ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">anto-note</ns2:hostname>
</soapenv:Detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
This is the stack trace:
Exception in thread "main" org.apache.axis2.AxisFault: string
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at com.at.iscrizio.ws.services.SalutareServiceStub.sayciao(SalutareServiceStub.java:185)
at com.at.iscrizio.ws.client.TestClient.main(TestClient.java:25)
Where is the problem? Excuse me for the huge post, thanks to all
At least you know that it's the server end that had the problem. The req that soapui is generating is different from your orig req? Sounds strange but soapui is usually right. Personally I would debug the server end and try to figure out where it's going wrong eg set some exception breakpoints
when i am trying to deploy bookstore1 web application from Netbeans ( JavaEE5 sample ) , i have changed the persistence.xml file to use hibernate :
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="book" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/jdbc/BookDB</jta-data-source>
<class>com.sun.bookstore.database.Book</class>
</persistence-unit>
</persistence>
and my mysql-ds.xml file is :
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/BookDB</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/bookdb</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password>1234</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
I am getting below error:
[STDOUT] Couldn't create bookstore database bean: null
19:16:53,846 INFO [[/bookstore1]] Marking servlet ShowCartServlet as unavailable
19:16:53,846 ERROR [[ShowCartServlet]] Allocate exception for servlet ShowCartServlet
javax.servlet.UnavailableException: Couldn't get database.
at com.sun.bookstore1.servlets.ShowCartServlet.init(ShowCartServlet.java:39)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
19:17:17,534 INFO [[ShowCartServlet]] Servlet ShowCartServlet is currently unavailable
Can you please let me know where i am making wrong...
JBoss 4.0.x is not a JavaEE5 appserver, it's much too old - it only supports J2EE 1.4
This may not be the problem (it's impossible to tell from the info you've given us), but there's no point continuing with the JavaEE5 sample and JBoss 4.0.x, it just won't work.
You either need to use the J2EE 1.4 sample app, or upgrade your JBoss (to version 5 or 6).