JBoss Compatiblity Issue - web-services

We have developed a webservices and it is running fine on tomcat while deploying the same . We are getting below error. Help is much appreciated.
12:15:08,115 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/flagClarity].[filesize]] (http--0.0.0.0-8080-2) Servlet.service() for servlet filesize threw exception: java.lang.AbstractMethodError: gnu.xml.dom.DomDocument.setDocumentURI(Ljava/lang/String;)V
at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:893)
at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:231)
at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:191)
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:92)
at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:204)
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:148)
at org.jboss.wsf.stack.cxf.client.ProviderImpl.createServiceDelegate(ProviderImpl.java:141)
at javax.xml.ws.Service.<init>(Service.java:57) [jboss-jaxws-api_2.2_spec-2.0.0.Final.jar:2.0.0.Final]
at hpd_igcinterface_create.HPDIGCInterfaceCreateService.<init>(HPDIGCInterfaceCreateService.java:47) [classes:]
at com.flag.update.FileSizeServlet.doPost(FileSizeServlet.java:349) [classes:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
at java.lang.Thread.run(Thread.java:680) [rt.jar:1.6.0_71]

Related

JAX-RS (RestEasy) and EJB3 integration in JBoss

I have build a maven project(packaging:war) for learning jax-rs and ejb integration. It has mainly following files:
Stateless Bean
package org.eb.stateless;
import javax.annotation.PostConstruct;
import javax.ejb.Stateless;
#Stateless
public class StatelessBeanDemo
{
#PostConstruct
public void init()
{
System.out.println("I M POST-CONSTRUCT");
}
public void printData()
{
System.out.println("I M Stateless");
}
}
Resource Interface
package org.webservice.rs;
import javax.ejb.Local;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
#Local
#Path("/home")
public interface IHelloWorldService
{
#GET
#Path("/eb/s1")
Response callSL1();
#GET
#Path("/eb/s2")
Response callSL2();
}
Resource
package org.webservice.rs;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.ws.rs.core.Response;
import org.eb.stateless.StatelessBeanDemo;
#Stateless
public class HelloWorldService implements IHelloWorldService
{
#Inject // Use of "Inject"
private StatelessBeanDemo sl; // Always Null
#EJB // Use of "EJB"
private StatelessBeanDemo s2; // Sometime Null, Sometime Not
public Response callSL1()
{
sl.printData();
return Response.status(201).entity("DONE").build();
}
public Response callSL2()
{
s2.printData();
return Response.status(201).entity("DONE").build();
}
}
Web Service Application Path Class
package org.webservice.rs;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.core.Application;
public class RestServiceLocator extends Application
{
public Set<Class<?>> getClasses()
{
Set<Class<?>> s = new HashSet<Class<?>>();
s.add(HelloWorldService.class);
return s;
}
}
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>J2EEDemo</display-name>
<context-param>
<param-name>resteasy.jndi.resources</param-name>
<param-value>java:module/HelloWorldService</param-value>
</context-param>
<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>org.webservice.rs.RestServiceLocator</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
Now when I am hitting url "http://127.0.0.1:8080/J2EEDemo/home/eb/s1", it is ALWAYS throwing following null pointer exception:
13:59:08,695 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/J2EEDemo].[Resteasy]] (http-0.0.0.0-0.0.0.0-8080-2) Servlet.service() for servlet Resteasy threw exception: org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException
at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:340) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:214) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:190) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:540) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.2.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626) [jbossweb-7.0.13.Final.jar:]
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2039) [jbossweb-7.0.13.Final.jar:]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
Caused by: java.lang.NullPointerException
at org.webservice.rs.HelloWorldService.callSL1(HelloWorldService.java:26) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_51]
at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_51]
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525) [resteasy-jaxrs-2.3.2.Final.jar:]
...
What more awkward is when I am hitting "http://127.0.0.1:8080/J2EEDemo/home/eb/s2", It is SOMETIMES working as per my wish (printing "DONE" and executing injected bean method) and sometimes throwing same null pointer exception. I am not able to understand what is happening.
I have solved the problem by adding 'beans.xml' dummy file in WEB-INF (Configuring CDI Application). (Enabling CDI)
But the question is still open. Why http://127.0.0.1:8080/J2EEDemo/home/eb/s2 working occasionally, before adding beans.xml ?

Deploying Jersey web service application in Jboss as 7.1.1 shows webservices in package ws is not supported

I have an issue on deploying my war file ,everything expect the web services are working fine The error log is given below
16:14:08,866 INFO [com.sun.jersey.api.core.PackagesResourceConfig] (MSC service thread 1-1) Scanning for root resource and provider classes in the packages:com.fut.ws
16:14:08,920 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/fut-wager]] (MSC service thread 1-1) StandardWrapper.Throwable:com.sun.jersey.core.spi.scanning.ScannerException: The URI scheme vfs of the URI vfs:/content/fut-wager.war/WEB-INF/classes/com/fut/ws/ is not supported. Package scanning deployment is not supported for such URIs.
Try using a different deployment mechanism such as explicitly declaring root resource and provider classes using an extension of javax.ws.rs.core.Application at com.sun.jersey.core.spi.scanning.PackageNamesScanner.scan(PackageNamesScanner.java:225) [jersey-bundle-1.9.1.jar:1.9.1] at com.sun.jersey.core.spi.scanning.PackageNamesScanner.scan(PackageNamesScanner.java:139) [jersey-bundle-1.9.1.jar:1.9.1] at com.sun.jersey.api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:80) [jersey-bundle-1.9.1.jar:1.9.1] at com.sun.jersey.api.core.PackagesResourceConfig.init(PackagesResourceConfig.java:104) [jersey-bundle-1.9.1.jar:1.9.1] at com.sun.jersey.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:78) [jersey-bundle-1.9.1.jar:1.9.1]
at com.sun.jersey.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:89) [jersey-bundle-1.9.1.jar:1.9.1] at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:700) [jersey-bundle-1.9.1.jar:1.9.1] at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:678) [jersey-bundle-1.9.1.jar:1.9.1] at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:203) [jersey-bundle-1.9.1.jar:1.9.1] at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373) [jersey-bundle-1.9.1.jar:1.9.1] at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556) [jersey-bundle-1.9.1.jar:1.9.1]
at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final] at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_11]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_11]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_11]
16:14:08,974 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/fut-wager]] (MSC service thread 1-1) Servlet /fut-wager threw load() exception: com.sun.jersey.core.spi.scanning.ScannerException: The URI scheme vfs of the URI vfs:/content/fut-wager.war/WEB-INF/classes/com/fut/ws/ is not supported. Package scanning deployment is not supported for such URIs.
Try using a different deployment mechanism such as explicitly declaring root resource and provider classes using an extension of javax.ws.rs.core.Application
at com.sun.jersey.core.spi.scanning.PackageNamesScanner.scan(PackageNamesScanner.java:225) [jersey-bundle-1.9.1.jar:1.9.1]
at com.sun.jersey.core.spi.scanning.PackageNamesScanner.scan(PackageNamesScanner.java:139) [jersey-bundle-1.9.1.jar:1.9.1]
at com.sun.jersey.api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:80) [jersey-bundle-1.9.1.jar:1.9.1]
at com.sun.jersey.api.core.PackagesResourceConfig.init(PackagesResourceConfig.java:104) [jersey-bundle-1.9.1.jar:1.9.1]
at com.sun.jersey.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:78) [jersey-bundle-1.9.1.jar:1.9.1]
at com.sun.jersey.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:89) [jersey-bundle-1.9.1.jar:1.9.1]
at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:700) [jersey-bundle-1.9.1.jar:1.9.1]
at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:678) [jersey-bundle-1.9.1.jar:1.9.1]
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:203) [jersey-bundle-1.9.1.jar:1.9.1]
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373) [jersey-bundle-1.9.1.jar:1.9.1]
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556) [jersey-bundle-1.9.1.jar:1.9.1]
at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_11]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_11]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_11]
16:14:09,038 INFO [org.jboss.web] (MSC service thread 1-1) JBAS018210: Registering web context: /fut-wager
16:14:09,155 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "fut-wager.war"
16:15:00,034 INFO [com.fut.scheduler.MatchScheduler] (org.springframework.scheduling.quartz.SchedulerFactoryBean#0_Worker-9) -- Match expiring scheduler execution started --
16:15:00,037 INFO [com.fut.ws.user.handler.MatchHandlerImpl] (org.springframework.scheduling.quartz.SchedulerFactoryBean#0_Worker-9) --Inside match expiring service--
16:15:00,039 INFO [com.fut.dao.user.MatchDao] (org.springframework.scheduling.quartz.SchedulerFactoryBean#0_Worker-9) --Inside match expiring dao--
16:15:00,313 INFO [com.fut.scheduler.MatchScheduler] (org.springframework.scheduling.quartz.SchedulerFactoryBean#0_Worker-9) -- Match expiring scheduler execution completed --
I got same error and solved using link provided by peeskillet. Here is example :
Web Service Application
package org.webservice.application;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.core.Application;
import org.webservice.rs.HelloWorldService;
public class RSApplication extends Application
{
public Set<Class<?>> getClasses()
{
Set<Class<?>> s = new HashSet<Class<?>>();
s.add(HelloWorldService.class);
return s;
}
}
Resource
package org.webservice.rs;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
#Path("/hello")
public class HelloWorldService
{
#GET
public Response getMsg()
{
String output = "I M Jersey";
return Response.status(200).entity(output).build();
}
}
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>J2EEDemo</display-name>
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>org.webservice.application.RSApplication</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
pom.xml entry for dependency
<dependencies>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.8</version>
</dependency>
</dependencies>
Hit url : http://<HOST>:<PORT>/<CONTEXT>/rest/hello
I also got the same problem. below works for me try it.
Problem: com.sun.jersey.core.spi.scanning.ScannerException: The URI scheme vfs of the URI vfs
`
Solution: Need to change web.xml file
I have created
- package : com.rest.spring
- class : PaymentService
and I have provided those values inside <init-Parm> in the web.xml file. See below:
<servlet>
<servlet-name>jersey-serlvet</servlet-name>
<servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet
</servlet-class>
<init-param>
**<param-name>
com.sun.jersey.config.property.packages
</param-name>
<param-value>com.rest.spring</param-value>**
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
After deploying, I got above error. So the only thing we need to change that is <init param> see below:
**<param-name>
javax.ws.rs.core.Application
</param-name>
<param-value>com.rest.spring</param-value>**
enjoy...

javax.xml.ws.WebServiceException: Unable to create JAXBContext while calling webservice from web application

I am new to Apache CXF and trying to create a Webservices Simulator and Webservices Client from wsdl using apache-cxf-2.7.8.
I created the simulator successfully and is able to hit the simulator webservice from main method client
public static void main(String args[]) throws java.lang.Exception {
URL wsdlURL = new URL("http://localhost:7020/sirius_uwi_simulator2/services/RetrieveTelematicsDataPTEndpoint?wsdl");
GetDataService ss = new GetDataService(wsdlURL, SERVICE_NAME);
GetDataPT port = ss.getRetrieveTelematicsDataPTEndpoint();
However when i try to call the same simulator webservice from my struts application using the client code shown below
public static EnrollmentInformation retrieveTelematicsData(String vin) throws java.lang.Exception {
URL wsdlURL = new URL("http://localhost:7020/sirius_uwi_simulator2/services/RetrieveTelematicsDataPTEndpoint?wsdl");
GetDataService ss = new GetDataService(wsdlURL, SERVICE_NAME);
GetDataPT port = ss.getRetrieveTelematicsDataPTEndpoint();
It is throwing this exception :
ERROR com.sirius.uwi.starss.action.ValidateTermsAndConditionsAction.execute_aroundBody0 - Validating Terms And Conditions Failed
javax.xml.ws.WebServiceException: Unable to create JAXBContext
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:153)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:83)
at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:244)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:687)
at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:675)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:330)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:313)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:295)
at javax.xml.ws.Service.getPort(Service.java:92)
at com.sirius.ws.gettelematicsdata.generated.service.vehicleTelematicsPreferences.retrieveTelematicsData.GetDataService.getRetrieveTelematicsDataPTEndpoint_aroundBody0(GetDataService.java:58)
at com.sirius.ws.gettelematicsdata.generated.service.vehicleTelematicsPreferences.retrieveTelematicsData.GetDataService$AjcClosure1.run(GetDataService.java:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:104)
at com.sirius.ws.gettelematicsdata.generated.service.vehicleTelematicsPreferences.retrieveTelematicsData.GetDataService.getRetrieveTelematicsDataPTEndpoint(GetDataService.java:58)
at com.sirius.uwi.starss.wsclient.GetTelematicsData.retrieveTelematicsData_aroundBody0(GetTelematicsData.java:27)
at com.sirius.uwi.starss.wsclient.GetTelematicsData$AjcClosure1.run(GetTelematicsData.java:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
at com.sirius.uwi.utils.logging.aspect.LogAspect.invoke(LogAspect.java:170)
at com.sirius.uwi.utils.logging.aspect.LogAspect.ajc$inlineAccessMethod$com_sirius_uwi_utils_logging_aspect_LogAspect$com_sirius_uwi_utils_logging_aspect_LogAspect$invoke(LogAspect.java:1)
at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:114)
at com.sirius.uwi.starss.wsclient.GetTelematicsData.retrieveTelematicsData(GetTelematicsData.java:25)
at com.sirius.uwi.starss.action.ValidateTermsAndConditionsAction.simulateTermsAndConditionsValidation(ValidateTermsAndConditionsAction.java:71)
at com.sirius.uwi.starss.action.ValidateTermsAndConditionsAction.execute_aroundBody0(ValidateTermsAndConditionsAction.java:35)
at com.sirius.uwi.starss.action.ValidateTermsAndConditionsAction$AjcClosure1.run(ValidateTermsAndConditionsAction.java:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
at com.sirius.uwi.utils.logging.aspect.LogAspect.invoke(LogAspect.java:170)
at com.sirius.uwi.utils.logging.aspect.LogAspect.ajc$inlineAccessMethod$com_sirius_uwi_utils_logging_aspect_LogAspect$com_sirius_uwi_utils_logging_aspect_LogAspect$invoke(LogAspect.java:1)
at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:114)
at com.sirius.uwi.starss.action.ValidateTermsAndConditionsAction.execute(ValidateTermsAndConditionsAction.java:26)
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:597)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)
at com.opensymphony.xwork2.interceptor.TimerInterceptor.invokeUnderTiming(TimerInterceptor.java:135)
at com.opensymphony.xwork2.interceptor.TimerInterceptor.intercept(TimerInterceptor.java:122)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.sirius.uwi.starss.interceptors.CSRAccessInterceptor.intercept_aroundBody4(CSRAccessInterceptor.java:140)
at com.sirius.uwi.starss.interceptors.CSRAccessInterceptor$AjcClosure5.run(CSRAccessInterceptor.java:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
at com.sirius.uwi.utils.logging.aspect.LogAspect.invoke(LogAspect.java:170)
at com.sirius.uwi.utils.logging.aspect.LogAspect.ajc$inlineAccessMethod$com_sirius_uwi_utils_logging_aspect_LogAspect$com_sirius_uwi_utils_logging_aspect_LogAspect$invoke(LogAspect.java:1)
at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:114)
at com.sirius.uwi.starss.interceptors.CSRAccessInterceptor.intercept(CSRAccessInterceptor.java:77)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.sirius.uwi.starss.interceptors.RemoveAccountFromSessionInterceptor.intercept_aroundBody2(RemoveAccountFromSessionInterceptor.java:52)
at com.sirius.uwi.starss.interceptors.RemoveAccountFromSessionInterceptor$AjcClosure3.run(RemoveAccountFromSessionInterceptor.java:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
at com.sirius.uwi.utils.logging.aspect.LogAspect.invoke(LogAspect.java:170)
at com.sirius.uwi.utils.logging.aspect.LogAspect.ajc$inlineAccessMethod$com_sirius_uwi_utils_logging_aspect_LogAspect$com_sirius_uwi_utils_logging_aspect_LogAspect$invoke(LogAspect.java:1)
at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:114)
at com.sirius.uwi.starss.interceptors.RemoveAccountFromSessionInterceptor.intercept(RemoveAccountFromSessionInterceptor.java:42)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.sirius.uwi.starss.interceptors.MaintenanceModeInterceptor.intercept_aroundBody2(MaintenanceModeInterceptor.java:49)
at com.sirius.uwi.starss.interceptors.MaintenanceModeInterceptor$AjcClosure3.run(MaintenanceModeInterceptor.java:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
at com.sirius.uwi.utils.logging.aspect.LogAspect.invoke(LogAspect.java:170)
at com.sirius.uwi.utils.logging.aspect.LogAspect.ajc$inlineAccessMethod$com_sirius_uwi_utils_logging_aspect_LogAspect$com_sirius_uwi_utils_logging_aspect_LogAspect$invoke(LogAspect.java:1)
at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:114)
at com.sirius.uwi.starss.interceptors.MaintenanceModeInterceptor.intercept(MaintenanceModeInterceptor.java:44)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.sirius.uwi.starss.interceptors.NavigationInterceptor.intercept_aroundBody2(NavigationInterceptor.java:126)
at com.sirius.uwi.starss.interceptors.NavigationInterceptor$AjcClosure3.run(NavigationInterceptor.java:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
at com.sirius.uwi.utils.logging.aspect.LogAspect.invoke(LogAspect.java:170)
at com.sirius.uwi.utils.logging.aspect.LogAspect.ajc$inlineAccessMethod$com_sirius_uwi_utils_logging_aspect_LogAspect$com_sirius_uwi_utils_logging_aspect_LogAspect$invoke(LogAspect.java:1)
at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:114)
at com.sirius.uwi.starss.interceptors.NavigationInterceptor.intercept(NavigationInterceptor.java:48)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.sirius.uwi.commons.web.struts.interceptors.TrimParametersInterceptor.intercept_aroundBody2(TrimParametersInterceptor.java:30)
at com.sirius.uwi.commons.web.struts.interceptors.TrimParametersInterceptor$AjcClosure3.run(TrimParametersInterceptor.java:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:104)
at com.sirius.uwi.commons.web.struts.interceptors.TrimParametersInterceptor.intercept(TrimParametersInterceptor.java:20)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.sirius.uwi.commons.web.filter.LoggingRequestFilter.doFilter_aroundBody4(LoggingRequestFilter.java:57)
at com.sirius.uwi.commons.web.filter.LoggingRequestFilter$AjcClosure5.run(LoggingRequestFilter.java:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:104)
at com.sirius.uwi.commons.web.filter.LoggingRequestFilter.doFilter(LoggingRequestFilter.java:45)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.security.PrivilegedActionException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
javax.xml.bind.JAXBElement does not have a no-arg default constructor.
this problem is related to the following location:
at javax.xml.bind.JAXBElement
at static final javax.xml.bind.JAXBElement com.sirius.ws.gettelematicsdata.generated.schemas.telematics.common.mobileWebHeader.ObjectFactory.createCDIID_aroundBody8(com.sirius.ws.gettelematicsdata.generated.schemas.telematics.common.mobileWebHeader.ObjectFactory,java.lang.String,org.aspectj.lang.JoinPoint)
at com.sirius.ws.gettelematicsdata.generated.schemas.telematics.common.mobileWebHeader.ObjectFactory
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:140)
... 138 more
Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
javax.xml.bind.JAXBElement does not have a no-arg default constructor.
this problem is related to the following location:
at javax.xml.bind.JAXBElement
at static final javax.xml.bind.JAXBElement com.sirius.ws.gettelematicsdata.generated.schemas.telematics.common.mobileWebHeader.ObjectFactory.createCDIID_aroundBody8(com.sirius.ws.gettelematicsdata.generated.schemas.telematics.common.mobileWebHeader.ObjectFactory,java.lang.String,org.aspectj.lang.JoinPoint)
at com.sirius.ws.gettelematicsdata.generated.schemas.telematics.common.mobileWebHeader.ObjectFactory
at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:436)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:277)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1100)
at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:143)
at com.sun.xml.internal.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:95)
at com.sun.xml.internal.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:97)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:148)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:140)
... 140 more
Does anyone have any idea why is this happening? Why does it work when called from main method of client but not from struts based web application. I am guessing it must be related to the jars.
It's not picking up the CXF jars at all. It's using the JDK built in JAX-WS implementation instead. Definitely check classpaths and such.

JBoss AS stop working while sending SOAP messages

I am using JBoss AS 5.0.0.
I start it in "default" configuration with some web services being deployed as a *.ear file.
Client sends SOAP-messages and get valid responses an communicate with server in such way.
But at some time an exception is thrown and the server is responsive no more.
Here is the stacktrace:
17:58:00,546 ERROR [STDERR] 12.09.2012 17:58:00 com.sun.xml.ws.transport.http.servlet.WSServletDelegate doGet
SEVERE: caught throwable
javax.xml.ws.WebServiceException: javax.xml.stream.XMLStreamException
at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:112)
at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:284)
at com.sun.xml.ws.transport.http.HttpAdapter.encodePacket(HttpAdapter.java:339)
at com.sun.xml.ws.transport.http.HttpAdapter.access$100(HttpAdapter.java:93)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:481)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.xml.stream.XMLStreamException
at com.sun.xml.stream.writers.XMLStreamWriterImpl.flush(XMLStreamWriterImpl.java:402)
at com.sun.xml.ws.streaming.XMLStreamWriterUtil.getOutputStream(XMLStreamWriterUtil.java:97)
at com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:319)
at com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:142)
at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:109)
... 31 more
18:02:00,482 ERROR [STDERR] 12.09.2012 18:02:00 com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit handle
SEVERE: Couldn't create SOAP message due to exception: Unable to create StAX reader or writer
com.sun.xml.ws.protocol.soap.MessageCreationException: Couldn't create SOAP message due to exception: Unable to create StAX reader or writer
at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:365)
at com.sun.xml.ws.transport.http.HttpAdapter.decodePacket(HttpAdapter.java:277)
at com.sun.xml.ws.transport.http.HttpAdapter.access$500(HttpAdapter.java:93)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:457)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: com.sun.xml.ws.streaming.XMLReaderException: Unable to create StAX reader or writer
at com.sun.xml.ws.api.streaming.XMLStreamReaderFactory$Zephyr.doCreate(XMLStreamReaderFactory.java:334)
at com.sun.xml.ws.api.streaming.XMLStreamReaderFactory.doCreate(XMLStreamReaderFactory.java:201)
at com.sun.xml.ws.api.streaming.XMLStreamReaderFactory.create(XMLStreamReaderFactory.java:154)
at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:301)
at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:129)
at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:360)
... 30 more
Caused by: javax.xml.stream.XMLStreamException
at com.sun.xml.stream.XMLReaderImpl.setInputSource(XMLReaderImpl.java:197)
at com.sun.xml.stream.XMLReaderImpl.setInputSource(XMLReaderImpl.java:207)
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:597)
at com.sun.xml.ws.api.streaming.XMLStreamReaderFactory$Zephyr.reuse(XMLStreamReaderFactory.java:342)
at com.sun.xml.ws.api.streaming.XMLStreamReaderFactory$Zephyr.doCreate(XMLStreamReaderFactory.java:325)
... 35 more
In what way should I investigate or other advices would be appreciated much.
There was an issue with VM Ware Player settings. As I use VM Ware I should configure network settings. The Network was configured to use unneccessary proxy. And it seems to me some soap messages were lost due to incorrect network connection. After removing this proxy settings an error is not reproduced.

Unable to consume RestFul web service using jersey client

My service side code is implemented using Resteasy
#GET
#Path("/ad-details/{query}")
#Produces("application/json")
public String getAdDetails(#PathParam("query") String id)
{
//Validator v = ESAPI.encoder().encodeForHTML(id);
//String id1 = ;
//System.out.println(ESAPI.encoder().encodeForHTML(ESAPI.encoder().canonicalize(id1)));
String adDetailsResult = "";
System.out.println("reached Service");
AdServiceProvider ad = new AdServiceProviderImpl();
AdDetails details = ad.getAdDetailsById(Long.parseLong(id.trim()));
adDetailsResult = gson.toJson(details);
//System.out.println(adDetailsResult);
//adDetailsResult = ESAPI.encoder().encodeForHTML(ESAPI.encoder().canonicalize(adDetailsResult));
System.out.println(adDetailsResult);
return adDetailsResult;
}
and my client side code consuming this service is using jersey api
and the code is as mentioned below.
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
System.out.println("reached servlet");
response.setContentType("application/json");
String adId = request.getParameter("adId");
System.out.println(adId);
Client client = Client.create();
WebResource wr = client.resource("http://localhost:8080/com.pandora.services/service");
String adDetailsResult = wr.path("ad-details").path(adId).get(String.class);
PrintWriter out = response.getWriter();
out.print(adDetailsResult);
}'`
however when i make a call i am getting the following error
WARN org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher Failed to parse request.
java.lang.IllegalArgumentException: Error parsing media type '*; q=.2'
at com.sun.jersey.core.impl.provider.header.MediaTypeProvider.fromString(MediaTypeProvider.java:80)
at com.sun.jersey.core.impl.provider.header.MediaTypeProvider.fromString(MediaTypeProvider.java:53)
at javax.ws.rs.core.MediaType.valueOf(MediaType.java:173)
at org.jboss.resteasy.util.MediaTypeHelper.parseHeader(MediaTypeHelper.java:204)
at org.jboss.resteasy.plugins.server.servlet.ServletUtil.extractAccepts(ServletUtil.java:119)
at org.jboss.resteasy.plugins.server.servlet.ServletUtil.extractHttpHeaders(ServletUtil.java:82)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:186)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
Caused by: java.text.ParseException: Expected separator '/' instead of ';'
at com.sun.jersey.core.header.reader.HttpHeaderReader.nextSeparator(HttpHeaderReader.java:117)
at com.sun.jersey.core.impl.provider.header.MediaTypeProvider.valueOf(MediaTypeProvider.java:91)
at com.sun.jersey.core.impl.provider.header.MediaTypeProvider.fromString(MediaTypeProvider.java:78)
... 21 more
May 10, 2011 7:14:50 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet Resteasy threw exception
java.lang.NullPointerException
at org.jboss.resteasy.plugins.server.servlet.HttpServletInputMessage.(HttpServletInputMessage.java:60)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.createHttpRequest(HttpServletDispatcher.java:71)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.createResteasyHttpRequest(HttpServletDispatcher.java:60)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:197)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
May 10, 2011 7:14:50 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet AdDetailsServlet threw exception
com.sun.jersey.api.client.UniformInterfaceException: GET http://localhost:8080/com.pandora.services/service/ad-details/1 returned a response status of 500
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:565)
at com.sun.jersey.api.client.WebResource.get(WebResource.java:182)
at com.pandora.client.servlets.AdDetailsServlet.doPost(AdDetailsServlet.java:48)
at com.pandora.client.servlets.AdDetailsServlet.doGet(AdDetailsServlet.java:34)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
where am i making the mistake ??
Thanks
The error message is this:
Error parsing media type '*; q=.2'
Which makes me think I should be looking for problems with some sort of media-type-related header of the request from the client. Perhaps you should specify a MIME type for the response. It looks like you expect the service to return JSON, so how about specifying the Accept header in the request?
Client client = Client.create();
WebResource wr =
client.resource("http://localhost:8080/com.pandora.services/service");
String adDetailsResult = wr.path("ad-details").path(adId)
.accept(MediaType.APPLICATION_JSON).get(String.class);