Hi,
Servicemix basically is an OSGi container, it just leverage pax-web to
play the role as a war container, the important thing for porting
from normal war container(such as Tomcat) to the pax-web is that you
need OSGi-fy your war, basically you need add OSGi metadata header to
the war MANIFEST.MF file, you can take a look at [1] and other docs
from pax-web wiki to get more details about how to use pax-web.
For the Import-Package part of the war MANIFEST.MF, I suggest you
should have the following
javax.jws,
javax.wsdl,
javax.xml.namespace,
META-INF.cxf,
META-INF.cxf.osgi,
org.apache.cxf.bus,
org.apache.cxf.bus.spring,
org.apache.cxf.bus.resource,
org.apache.cxf.configuration.spring,
org.apache.cxf.resource,
org.apache.cxf.transport.http,
org.apache.cxf.annotations,
org.apache.servicemix.util,
org.springframework.beans.factory.config,
org.springframework.aop,
org.springframework.aop.config,
org.springframework.aop.scope,
org.springframework.aop.framework,
net.sf.cglib.proxy,
org.aopalliance.aop,
net.sf.cglib.core,
net.sf.cglib.reflect
[1]http://team.ops4j.org/wiki/display/paxweb/OSGi-fy+your+WAR
Freeman
On 2011-9-8, at 上午4:26, Barry Hathaway wrote:
I have a service that I have running in a CXF/Tomcat environment
that I would
like to port to ServiceMix. The Spring bean for the service is
defined as:
<bean id="sadlServiceProvider" scope="session" class="com.....">
<aop:scoped-proxy/>
</bean>
In the web.xml file I have defined a RequestContextListener so that
Spring gets
control and creates the bean.
To move it to ServiceMix I have installed all of the required
bundles and made sure
org.apache.cxf.transport.http was included in the service. The
problem is when I
try to invoke any of the methods on the service I get the exception
below.
Any ideas?
Thanks in advance.
Barry Hathaway
org.apache.cxf.interceptor.Fault: No Scope registered for scope
'session'
at
org
.apache
.cxf
.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:
155)[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
at
org
.apache
.cxf
.jaxws
.AbstractJAXWSMethodInvoker
.createFault(AbstractJAXWSMethodInvoker.java:86)
[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
at
org
.apache
.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:121)
[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
at
org
.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:
61)[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
at
org
.apache
.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75)
[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
at org.apache.cxf.interceptor.ServiceInvokerInterceptor
$1.run(ServiceInvokerInterceptor.java:58)[123:org.apache.cxf.bundle:
2.4.1.fuse-00-43]
at java.util.concurrent.Executors
$RunnableAdapter.call(Executors.java:441)[:1.6.0_25]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:
303)[:1.6.0_25]
at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:
1.6.0_25]
at
org
.apache
.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:
37)[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
at
org
.apache
.cxf
.interceptor
.ServiceInvokerInterceptor
.handleMessage(ServiceInvokerInterceptor.java:106)
[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
at
org
.apache
.cxf
.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:
263)[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
at
org
.apache
.cxf
.transport
.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
at
org
.apache
.cxf
.transport
.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:
206)[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
at
org
.apache
.cxf
.transport
.servlet.ServletController.invokeDestination(ServletController.java:
218)[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
at
org
.apache
.cxf
.transport.servlet.ServletController.invoke(ServletController.java:
200)[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
at
org
.apache
.cxf
.transport
.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:113)
[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
at
org
.apache
.cxf
.transport
.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:
184)[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
at
org
.apache
.cxf
.transport
.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:107)
[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
[169:org.apache.geronimo.specs.geronimo-servlet_3.0_spec:1.0]
at
org
.apache
.cxf
.transport
.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:163)
[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
at
org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:
538)[110:org.eclipse.jetty.servlet:7.4.1.v20110513]
at
org
.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:
478)[110:org.eclipse.jetty.servlet:7.4.1.v20110513]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle
(HttpServiceServletHandler.java:70)[162:org.ops4j.pax.web.pax-web-
jetty:1.0.3]
at
org
.eclipse
.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
[109:org.eclipse.jetty.server:7.4.1.v20110513]
at
org
.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:
517)[112:org.eclipse.jetty.security:7.4.1.v20110513]
at
org
.eclipse
.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:
225)[109:org.eclipse.jetty.server:7.4.1.v20110513]
at
org
.eclipse
.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:
937)[109:org.eclipse.jetty.server:7.4.1.v20110513]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle
(HttpServiceContext.java:116)[162:org.ops4j.pax.web.pax-web-jetty:
1.0.3]
at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:
406)[110:org.eclipse.jetty.servlet:7.4.1.v20110513]
at
org
.eclipse
.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
[109:org.eclipse.jetty.server:7.4.1.v20110513]
at
org
.eclipse
.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:871)
[109:org.eclipse.jetty.server:7.4.1.v20110513]
at
org
.eclipse
.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
[109:org.eclipse.jetty.server:7.4.1.v20110513]
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle
(JettyServerHandlerCollection.java:72)[162:org.ops4j.pax.web.pax-web-
jetty:1.0.3]
at
org
.eclipse
.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
[109:org.eclipse.jetty.server:7.4.1.v20110513]
at org.eclipse.jetty.server.Server.handle(Server.java:346)
[109:org.eclipse.jetty.server:7.4.1.v20110513]
at
org
.eclipse
.jetty.server.HttpConnection.handleRequest(HttpConnection.java:589)
[109:org.eclipse.jetty.server:7.4.1.v20110513]
at org.eclipse.jetty.server.HttpConnection
$RequestHandler.content(HttpConnection.java:1065)
[109:org.eclipse.jetty.server:7.4.1.v20110513]
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:
823)[107:org.eclipse.jetty.http:7.4.1.v20110513]
at
org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:220)
[107:org.eclipse.jetty.http:7.4.1.v20110513]
at
org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:
411)[109:org.eclipse.jetty.server:7.4.1.v20110513]
at
org
.eclipse
.jetty
.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:531)
[111:org.eclipse.jetty.io:7.4.1.v20110513]
at org.eclipse.jetty.io.nio.SelectChannelEndPoint
$1.run(SelectChannelEndPoint.java:40)[111:org.eclipse.jetty.io:
7.4.1.v20110513]
at org.eclipse.jetty.util.thread.QueuedThreadPool
$3.run(QueuedThreadPool.java:529)[114:org.eclipse.jetty.util:
7.4.1.v20110513]
at java.lang.Thread.run(Thread.java:662)[:1.6.0_25]
Caused by: java.lang.IllegalStateException: No Scope registered for
scope 'session'
at
org
.springframework
.beans
.factory
.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at
org
.springframework
.beans
.factory
.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at
org
.springframework
.aop
.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:
33)
at org.springframework.aop.framework.Cglib2AopProxy
$DynamicAdvisedInterceptor.getTarget(Cglib2AopProxy.java:653)
[74:org.springframework.aop:3.0.5.RELEASE]
at org.springframework.aop.framework.Cglib2AopProxy
$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:604)
[74:org.springframework.aop:3.0.5.RELEASE]
at
com.ge.research.sadl.sadlserver.cxf.provider.SadlServiceProvider$
$EnhancerByCGLIB$$cb9694d2.getClassName(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:
1.6.0_25]
at
sun
.reflect
.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:
1.6.0_25]
at
sun
.reflect
.DelegatingMethodAccessorImpl
.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_25]
at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_25]
at
org
.apache
.cxf
.service
.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
at
org
.apache
.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
[123:org.apache.cxf.bundle:2.4.1.fuse-00-43]
... 42 more
---------------------------------------------
Freeman Fang
FuseSource
Email:[email protected]
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com