Can't deploy web services with seam in AS 7
bstahmer Sep 15, 2011 8:50 AMHello,
I try to migrate my seam 2 app from Jboss EAP 4.3 to 7.0.1.Final, but when I deploy my app with a web service I get the error you see below. To avoid this error I had to use a soap request handler from seam:
org.jboss.seam.webservice.SOAPRequestHandler
I know two ways to use it: 1. create a standard-jaxws-endpoint-config.xml and put it in META-INF or 2. use the annotation @HandlerChain(file = "soap-handlers.xml").
I tried both but the handler class was never be called. It seems that the annotation and the xml files are ignored. I get no error messages about it.
Has someone an idea what to do?
Björn
13:38:10,762 INFO [org.jboss.wsf.stack.cxf.metadata.MetadataBuilder] (MSC service thread 1-2) Add Service
id=RailwayImportWS
address=http://localhost:8080/App-war/RailwayImportService/RailwayImportService
implementor=com.company.app.webservices.RailwayImportWS
invoker=org.jboss.wsf.stack.cxf.JBossWSInvoker
serviceName={http://webservices.app.company.com/}RailwayImportService
portName={http://webservices.app.company.com/}RailwayImportServicePort
wsdlLocation=null
mtomEnabled=false
13:38:10,762 INFO [org.jboss.wsf.stack.cxf.metadata.MetadataBuilder] (MSC service thread 1-2) Add Service
id=TimeSlotUtilisationWS
address=http://localhost:8080/App-war/TimeSlotUtilisationService/TimeSlotUtilisationService
implementor=com.company.app.webservices.TimeSlotUtilisationWS
invoker=org.jboss.wsf.stack.cxf.JBossWSInvoker
serviceName={http://webservices.app.company.com/}TimeSlotUtilisationService
portName={http://webservices.app.company.com/}TimeSlotUtilisationServicePort
wsdlLocation=null
mtomEnabled=false
13:38:10,763 INFO [org.jboss.ws.common.management.DefaultEndpointRegistry] (MSC service thread 1-2) register: jboss.ws:context=App-war,endpoint=RailwayImportWS
13:38:10,763 INFO [org.jboss.ws.common.management.DefaultEndpointRegistry] (MSC service thread 1-2) register: jboss.ws:context=App-war,endpoint=TimeSlotUtilisationWS
13:38:10,779 INFO [org.jboss.ws.common.management.DefaultEndpointRegistry] (MSC service thread 1-2) remove: jboss.ws:context=App-war,endpoint=RailwayImportWS
13:38:10,780 INFO [org.jboss.ws.common.management.DefaultEndpointRegistry] (MSC service thread 1-2) remove: jboss.ws:context=App-war,endpoint=TimeSlotUtilisationWS
13:38:10,780 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."App-war.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."App-war.war".INSTALL: Failed to process phase INSTALL of deployment "App-war.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_27]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_27]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_27]
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: No application context active
at org.jboss.wsf.stack.cxf.configuration.NonSpringBusHolder.newInstance(NonSpringBusHolder.java:173)
at org.jboss.wsf.stack.cxf.configuration.NonSpringBusHolder.configure(NonSpringBusHolder.java:96)
at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.startDeploymentBus(BusDeploymentAspect.java:109)
at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.start(BusDeploymentAspect.java:132)
at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.internalDeploy(AspectDeploymentProcessor.java:79)
at org.jboss.as.webservices.deployers.TCCLDeploymentProcessor.deploy(TCCLDeploymentProcessor.java:42)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115)
... 5 more
Caused by: java.lang.IllegalStateException: No application context active
at org.jboss.seam.Component.forName(Component.java:1948)
at org.jboss.seam.Component.getInstance(Component.java:2008)
at org.jboss.seam.Component.getInstance(Component.java:1986)
at org.jboss.seam.Component.getInstance(Component.java:1980)
at org.jboss.seam.Component.getInstance(Component.java:1975)
at com.company.app.webservices.RailwayImportWS.<init>(RailwayImportWS.java:20)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [:1.6.0_27]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [:1.6.0_27]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [:1.6.0_27]
at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [:1.6.0_27]
at java.lang.Class.newInstance0(Class.java:355) [:1.6.0_27]
at java.lang.Class.newInstance(Class.java:308) [:1.6.0_27]
at org.jboss.wsf.stack.cxf.configuration.NonSpringBusHolder.newInstance(NonSpringBusHolder.java:169)
... 11 more
My web service class:
package com.company.app.webservices;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.ejb.Stateless;
import javax.jws.HandlerChain;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import org.jboss.seam.Component;
import com.company.app.dao.ReportingDAO;
@Stateless
@WebService(name = "TimeSlotUtilisationService", serviceName = "TimeSlotUtilisationService")
@HandlerChain(file = "soap-handlers.xml")
public class TimeSlotUtilisationWS implements TimeSlotUtilisationWSInt {
ReportingDAO reportingDAO = (ReportingDAO) Component
.getInstance("reportingDAO");
private List<TimeSlotUtilisationResult> generateResult(List<Object[]> result) {
...
return results;
}
@WebMethod
public List<TimeSlotUtilisationResult> getTimeSlotUtilisationWeekly(
@WebParam(name = "fromDate") Date fromDate,
@WebParam(name = "location") int location,
@WebParam(name = "loadingStationNo") int loadingStationNo) {
return generateResult(reportingDAO.getTimeSlotUtilisationWeekly(
fromDate, location, loadingStationNo));
}
}
My standard-jaxws-endpoint-config.xml:
<jaxws-config xmlns="urn:jboss:jaxws-config:2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:javaee="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="urn:jboss:jaxws-config:2.0 jaxws-config_2_0.xsd">
<endpoint-config>
<config-name>Seam WebService Endpoint</config-name>
<pre-handler-chains>
<javaee:handler-chain>
<javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
<javaee:handler>
<javaee:handler-name>SOAP Request Handler</javaee:handler-name>
<javaee:handler-class>org.jboss.seam.webservice.SOAPRequestHandler</javaee:handler-class>
</javaee:handler>
</javaee:handler-chain>
</pre-handler-chains>
</endpoint-config>
</jaxws-config>