Hi All,
I have been trying to run services on tomcat using xfire and spring for
a couple of weeks
now and I've been having some pretty fundamental problems. One of my
services/beans is
very simple. It simply accepts string arguments and returns a string
value. Like this,
public interface ServiceProviderServiceInterface {
public void setTestServiceValue(String username, String value);
public String getTestServiceValue(String username);
}
I can use the set and get methods from a remote client with no problem,
so I know
that my setup is sound. However, when I try to use other types of
binding or more
'exotic' arguments for my POJOs I run into problems.
In one of my other services/beans, I (attempt to) use a message binding.
My interface
looks like,
public interface IdentityProviderServiceInterface {
public XMLStreamReader invoke(XMLStreamReader reader);
}
(From here: http://xfire.codehaus.org/Message+Binding)
When I attempt to invoke this bean remotely using the default binding
provider I
get the fault: "Illegal argument. interface
javax.xml.stream.XMLStreamReader is not
visible from class loader", which is pretty much what I get from any
object argument
that (I'm guessing) is not in java.lang or a basic type.
Since I want to use a message binding anyhow, I can choose to ignore
this and move
on, but then I get a different set of problems. Firstly, I can't
generate a WSDL anymore,
and get the following exception when I go to the usual '?wsdl' URL,
java.lang.NullPointerException
org.codehaus.xfire.wsdl11.builder.WSDLBuilder.writeParameters(WSDLBuilder.java:567)
org.codehaus.xfire.wsdl11.builder.WSDLBuilder.createInputParts(WSDLBuilder.java:548)
org.codehaus.xfire.wsdl11.builder.WSDLBuilder.createInputMessage(WSDLBuilder.java:373)
org.codehaus.xfire.wsdl11.builder.WSDLBuilder.createAbstractInterface(WSDLBuilder.java:234)
org.codehaus.xfire.wsdl11.builder.WSDLBuilder.write(WSDLBuilder.java:161)
org.codehaus.xfire.wsdl11.builder.WSDLBuilderAdapter.write(WSDLBuilderAdapter.java:40)
org.codehaus.xfire.DefaultXFire.generateWSDL(DefaultXFire.java:104)
org.codehaus.xfire.transport.http.XFireServletController.generateWSDL(XFireServletController.java:380)
org.codehaus.xfire.transport.http.XFireServletController.doService(XFireServletController.java:125)
org.codehaus.xfire.spring.remoting.XFireServletControllerAdapter.handleRequest(XFireServletControllerAdapter.java:67)
org.codehaus.xfire.spring.remoting.XFireExporter.handleRequest(XFireExporter.java:48)
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:858)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:431)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
This is surely a bug, since it is probably throwing a
NullPointerException reading a parameter
that is not required. (Either way, throwing a NullPointerException at
this point is pretty poor.)
Again, I can choose to ignore this and simply contact it from my client.
My client uses the following
code,
ObjectServiceFactory serviceFactory = new
ObjectServiceFactory(new MessageBindingProvider());
serviceFactory.setStyle("message");
Service serviceModel =
serviceFactory.create(IdentityProviderServiceInterface.class);
String serviceUrl = "http://someurl/";
try {
idClient = (IdentityProviderServiceInterface)
factory.create(serviceModel, serviceUrl);
} catch (Exception e) {
e.printStackTrace();
}
idClient.invoke(AnXmlStreamReaderFromAFileInputStream);
In this case, the following fault is returned to my client,
org.codehaus.xfire.XFireRuntimeException: Could not invoke service..
Nested exception is org.codehaus.xfire.fault.XFireFault: AOP
configuration seems to be invalid: tried calling method [public abstract
javax.xml.stream.XMLStreamReader
my.class.IdentityProviderServiceInterface.invoke(javax.xml.stream.XMLStreamReader)]
on target [EMAIL PROTECTED];
nested exception is java.lang.IllegalArgumentException: object is not an
instance of declaring class
org.codehaus.xfire.fault.XFireFault: AOP configuration seems to be
invalid: tried calling method [public abstract
javax.xml.stream.XMLStreamReader
org.tssg.opaals.ip.IdentityProviderServiceInterface.invoke(javax.xml.stream.XMLStreamReader)]
on target [EMAIL PROTECTED];
nested exception is java.lang.IllegalArgumentException: object is not an
instance of declaring class
at
org.codehaus.xfire.fault.Soap11FaultSerializer.readMessage(Soap11FaultSerializer.java:31)
at
org.codehaus.xfire.fault.SoapFaultSerializer.readMessage(SoapFaultSerializer.java:28)
at
org.codehaus.xfire.soap.handler.ReadHeadersHandler.checkForFault(ReadHeadersHandler.java:111)
at
org.codehaus.xfire.soap.handler.ReadHeadersHandler.invoke(ReadHeadersHandler.java:67)
at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.client.Client.onReceive(Client.java:406)
at
org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:139)
at
org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
at
org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
at org.codehaus.xfire.client.Client.invoke(Client.java:336)
at
org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
at $Proxy0.invoke(Unknown Source)
My config is,
<bean id="identityProviderService"
class="org.codehaus.xfire.spring.remoting.XFireExporter">
<property name="serviceFactory">
<!--<ref bean="xfire.serviceFactory"/>-->
<ref bean="messageServiceFactory"/>
</property>
<property name="xfire">
<ref bean="xfire"/>
</property>
<property name="serviceBean">
<!-- Add the name of your Spring bean here -->
<ref bean="identityProviderService"/>
</property>
<property name="serviceClass">
<!-- Add the full package name of your implementation bean
class -->
<value>my.package.IdentityProviderServiceInterface</value>
</property>
</bean>
<bean id="messageServiceFactory"
class="org.codehaus.xfire.service.binding.ObjectServiceFactory">
<constructor-arg index="0" ref="xfire.transportManager" />
<constructor-arg index="1" ref="xfire.messageBindingProvider" />
<property name="style" value="message" />
<property name="use" value="literal" />
</bean>
I get the same problems whether I use the spring syntax, as above, or
whether I use a
services.xml with the xfire 'service' syntax, as Zdenek posted to my
last mail. Mixing
and matching versions of spring and xfire jars have not helped. I was
running on a
tomcat based Soapod 0.2 container, but trying the above on a fresh
tomcat 5.5
install with spring and xfire jars freshly installed gives the same
problems.
For what it's worth, I'm currently using Tomcat 5.5.25, Spring 2.0.7,
Xfire 1.2.6. I
have the following jars in my shared/lib,
XmlSchema-1.1.jar jaxen-ASL-1.1.txt stax-api-1.0.1.jar
activation-1.1.jar jdom-1.0.jar wsdl4j-1.6.1.jar
aopalliance.jar jetty-6.1.2rc0.jar wstx-asl-3.2.0.jar
commons-beanutils.jar jetty-util-6.1.2rc0.jar xbean-spring-2.8.jar
commons-codec-1.3.jar junit-3.8.1.jar xercesImpl-2.6.2.jar
commons-httpclient-3.0.jar mail-1.4.jar xfire-all-1.2.6.jar
commons-logging-1.0.4.jar servlet-api-2.3.jar
jaxen-1.1-beta-9.jar spring.jar
(I tried using Spring 1.2.9 too, but with no luck. Is there a good
combination?)
I would appreciate any comments at all on these problems, because as far
as I'm
concerned I have tried everything, and xfire/spring on tomcat simply
does not work,
or at least it doesn't work as I imagine it should.
In particular, any information on the 'not visible from the classloader'
fault, or
the problem with my message binding setup would be very much appreciated.
Regards,
mark
--
Mark McLaughlin
Telecommunications Software & Systems Group,
ArcLabs Research & Innovation Centre,
Waterford Institute of Technology,
Carriganore, Co Waterford,
Ireland.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email