- This topic has 7 replies, 2 voices, and was last updated 18 years, 2 months ago by Riyad Kalla.
-
AuthorPosts
-
jkarthausMemberHi I’m new to Xfire and have some Problems using XFire Client in a RCP Application
When I use the Code with a normal Class everything works fine
public static void main(String[] args) { Service srvcModel = new ObjectServiceFactory().create(com.kampf.webservices.IWhoAmI.class); XFireProxyFactory factory = new XFireProxyFactory(XFireFactory.newInstance().getXFire()); try { IWhoAmI srvc = (IWhoAmI) factory.create(srvcModel, "http://localhost:8080/kampf_soa/services/WhoAmI"); User user = srvc.getUserData(System.getProperty("user.name")); System.out.println(user.getNachname()); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
In my RCP – Application I get a NPE with the same code
Caused by: java.lang.NullPointerException at org.codehaus.xfire.aegis.type.basic.ObjectType.readObject(ObjectType.java:97) at org.codehaus.xfire.aegis.type.collection.MapType.readObject(MapType.java:70) at org.codehaus.xfire.aegis.type.basic.BeanType.readObject(BeanType.java:180) at org.codehaus.xfire.aegis.AegisBindingProvider.readParameter(AegisBindingProvider.java:155) at org.codehaus.xfire.service.binding.AbstractBinding.read(AbstractBinding.java:206) at org.codehaus.xfire.service.binding.WrappedBinding.readMessage(WrappedBinding.java:50) at org.codehaus.xfire.soap.handler.SoapBodyHandler.invoke(SoapBodyHandler.java:42) at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131) at org.codehaus.xfire.client.Client.onReceive(Client.java:382)
Is there a problem with the RCP Classloading mechamism ??
Hope this ios no Off – Topic
Thanks for any suggestions
Riyad KallaMemberMoving to OT > Soft Dev 😉
If the classloader had the problem I would expect a NoClassDefinitionFound or something like that, but getting an NPE… can you show the code for how you are loading the class or what you are doing that is causing this stack trace?
jkarthausMember@support-rkalla wrote:
Moving to OT > Soft Dev 😉
If the classloader had the problem I would expect a NoClassDefinitionFound or something like that, but getting an NPE… can you show the code for how you are loading the class or what you are doing that is causing this stack trace?
OK!
I shedule this simple Jobpackage worker; import org.codehaus.xfire.XFireFactory; import org.codehaus.xfire.client.XFireProxyFactory; import org.codehaus.xfire.service.Service; import org.codehaus.xfire.service.binding.ObjectServiceFactory; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import com.kampf.webservices.IWhoAmI; import com.kampf.webservices.modell.User; public class GetUserDataWorker extends Job { public GetUserDataWorker(String name) { super(name); } public User user = null; protected IStatus run(IProgressMonitor monitor) { monitor.beginTask("Ermittle Benutzer Profil", 100); try { Service srvcModel = new ObjectServiceFactory().create(IWhoAmI.class); monitor.worked(20); XFireProxyFactory factory = new XFireProxyFactory(XFireFactory.newInstance().getXFire()); monitor.worked(20); IWhoAmI srvc = (IWhoAmI) factory.create(srvcModel, "http://localhost:8080/kampf_soa/services/WhoAmI"); monitor.worked(40); user = srvc.getUserData(System.getProperty("user.name")); monitor.worked(20); } catch (Exception e) { e.printStackTrace(); } monitor.done(); return Status.OK_STATUS; } }
All XFire Librarys are in the Plugins Classpath !
Here is my Plugin Manifest
Bundle-ClassPath: lib/antlr-2.7.5H3.jar, lib/asm.jar, lib/asm-attrs.jar, lib/c3p0-0.8.5.2.jar, lib/cglib-2.1.jar, lib/classes12.jar, lib/cleanimports.jar, lib/connector.jar, lib/dom4j-1.6.jar, lib/ehcache-1.1.jar, lib/hibernate3.jar, lib/jaas.jar, lib/jacc-1_0-fr.jar, lib/jaxen-1.1-beta-4.jar, lib/jdbc2_0-stdext.jar, lib/jdom.jar, lib/jgroups-2.2.7.jar, lib/jta.jar, lib/log4j-1.2.9.jar, lib/ojdbc14.jar, lib/oscache-2.1.jar, lib/poi-2.5.1-final-20040804.jar, lib/proxool-0.8.3.jar, lib/standalone_authentification.jar, lib/swarmcache-1.0rc2.jar, lib/xerces-2.6.2.jar, lib/xml-apis.jar, lib/commons-collections-2.1.1.jar, lib/commons-logging-1.0.4.jar, lib/concurrent-1.3.2.jar, bin/, resources/, lib/rmiserver.jar, lib/kampf_soa_client.jar, lib/xfire-all-1.2.1.jar, lib/jaxws-api-2.0.jar, lib/activation-1.1.jar, lib/bcprov-jdk15-133.jar, lib/commons-attributes-api-2.1.jar, lib/commons-beanutils-1.7.0.jar, lib/commons-codec-1.3.jar, lib/commons-discovery-0.2.jar, lib/commons-httpclient-3.0.jar, lib/jaxb-api-2.0.jar, lib/jaxb-impl-2.0.1.jar, lib/jaxb-xjc-2.0.1.jar, lib/jaxen-1.1-beta-9.jar, lib/jdom-1.0.jar, lib/jmock-1.0.1.jar, lib/jsr173_api-1.0.jar, lib/junit-3.8.1.jar, lib/mail-1.4.jar, lib/opensaml-1.0.1.jar, lib/org.mortbay.jetty-5.1.3.jar, lib/saaj-api-1.3.jar, lib/saaj-impl-1.3.jar, lib/servlet-api-2.3.jar, lib/spring-1.2.6.jar, lib/stax-api-1.0.1.jar, lib/stax-utils-snapshot-20040917.jar, lib/wsdl4j-1.5.2.jar, lib/wss4j-1.5.0.jar, lib/wstx-asl-2.9.3.jar, lib/xbean-2.1.0.jar, lib/xbean-spring-2.5.jar, lib/xercesImpl-2.6.2.jar, lib/xfire-jsr181-api-1.0-M1.jar, lib/xml-apis-1.0.b2.jar, lib/XmlSchema-1.0.3.jar, lib/xmlsec-1.3.0.jar,
Riyad KallaMemberOk but which line is throwing the NPE exception above?
jkarthausMemberThis Line
user = srvc.getUserData(System.getProperty("user.name"));
Riyad KallaMemberFirst I would check that your getProperty isn’t returning null, also I’m not sure how the ObjectFactory works, but if it’s returning null, it must document why so you can debug what is wrong.
jkarthausMemberAfter some hours Debugging I found the reason
I use a Properties Object in my POJO and this causes the Problems
I replace the getter and setter with a String Object and everything works !
It seems that Collection Mapping with XFire is more complicatetd ?! – I should read more Documentation
Riyad KallaMemberAhh very cool, either way glad it’s working now.
-
AuthorPosts