History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XFIRE-583
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Dan Diephouse
Reporter: Andrzej Doyle
Votes: 3
Watchers: 5
Operations

If you were logged in you would be able to see more operations.
XFire

Aegis Inheritance support doesn't work with Collection components

Created: 15/Aug/06 09:00 AM   Updated: 03/Oct/06 10:58 AM
Component/s: Aegis Module
Affects Version/s: 1.2-RC
Fix Version/s: 1.2.1

Time Tracking:
Not Specified

File Attachments: 1. Text File CollectionType.java.patch (1.0 kb)

Environment: Using Java5 annotations and thus Java5TypeCreator.


 Description  « Hide
When attempting to provide concrete implementations of interfaces, as described in the last section of http://xfire.codehaus.org/Aegis+Binding, the service picked up the override types correctly. However, when it comes to writing out the types, a bean that contains a List (say) of the overridden interface wasn't overriding these types correctly. What happened was that the outer bean would call AegisBindingProvider.getWriteType(), passing in the List itself. Since this function doesn't inspect the component type of the list, it wasn't possible at this stage for it to notice the types that should be overridden. So off we go into CollectionType.writeObject(), and here it assumes that the Type of all the elements in the list is the same as the declared type.

This is incorrect; my bean had a List<IDataColumn>, so actual members of the List may be SQLColumns, DataAggregateColumns, etc. What was needed was to call AegisBindingProvider.getWriteType(), passing in each element of the list. As it turns out, the superclass ArrayType already did the right thing with its writeValue() method, so the solution seems to be to defer the actual write to this method. I attach a patch that does this, and worked perfectly for me.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Dan Diephouse - 21/Aug/06 12:06 PM
I'm marking this as a duplicate of XFIRE-545, but I will be applying this patch. Thanks!

Timo Rantalaiho - 04/Sep/06 09:43 AM
I gather from the empty "Fix Version/s" field that this patch did not make it to the 1.2 final?

Dan Diephouse - 04/Sep/06 09:51 AM
This is fixed in SVN right now for 1.2.1. A build is here if you want to test:

http://snapshots.repository.codehaus.org/org/codehaus/xfire/xfire-all/1.2-SNAPSHOT/xfire-all-1.2-20060904.045024-15.jar


Timo Rantalaiho - 04/Sep/06 10:01 AM
Thankyou! 8 minutes is what I'd call excellent response time

I tried the snapshot jar and something has changed, as the previous ClassCastException from CollectionType has changed to this:

2006-09-04 17:57:46,242 [http-8180-Processor4] DEBUG org.codehaus.xfire.handler.HandlerPipeline - Invoking handler org.codehaus.xfire.handler.OutMessageSender i
n phase send
2006-09-04 17:57:46,266 [http-8180-Processor4] ERROR org.codehaus.xfire.service.binding.PostInvocationHandler - java.lang.NullPointerException
2006-09-04 17:57:46,269 [http-8180-Processor4] ERROR org.codehaus.xfire.handler.DefaultFaultHandler - Fault occurred!
java.lang.NullPointerException
        at org.codehaus.xfire.aegis.type.basic.ObjectType.determineType(ObjectType.java:192)
        at org.codehaus.xfire.aegis.type.basic.ObjectType.writeObject(ObjectType.java:165)
        at org.codehaus.xfire.aegis.type.basic.ArrayType.writeValue(ArrayType.java:293)
        at org.codehaus.xfire.aegis.type.collection.CollectionType.writeObject(CollectionType.java:103)
        at org.codehaus.xfire.aegis.type.basic.BeanType.writeObject(BeanType.java:413)
        at org.codehaus.xfire.aegis.AegisBindingProvider.writeParameter(AegisBindingProvider.java:194)
        at org.codehaus.xfire.service.binding.AbstractBinding.writeParameter(AbstractBinding.java:273)
        at org.codehaus.xfire.service.binding.WrappedBinding.writeMessage(WrappedBinding.java:89)
        at org.codehaus.xfire.soap.SoapSerializer.writeMessage(SoapSerializer.java:80)

Dan Diephouse - 04/Sep/06 10:05 AM
Its your lucky day I guess - If you're using java 1.4 - did you configure your collections like the bottom of this page says:

http://xfire.codehaus.org/Mapping+collections

Or are you using Java 5? If they're java5 collections, xfire should figure them out autmotically.


Timo Rantalaiho - 04/Sep/06 10:10 AM
I'm on Java 5 (Sun 1.5.0_07 on Debian Ubuntu), and basic collections mappings have worked all the time. I started with 1.1.1 and only now upgraded to 1.2 when the problem appeared with a new web service method.

Let's see if I can find out what is special about this failing case.


Dan Diephouse - 04/Sep/06 10:13 AM
XFire might be getting confused if you aren't specificying the inner collection's component type. I.e. do you have Collection<Collection> instead of Collection<Collection<Foo>> ?

Behrang Javaherian - 12/Sep/06 02:42 AM
When I try to use this patch I am getting the following excpetion:
Caused by: java.lang.NullPointerException
at org.codehaus.xfire.aegis.type.basic.ObjectType.determineType(ObjectType.java:192)
at org.codehaus.xfire.aegis.type.basic.ObjectType.writeObject(ObjectType.java:165)
at org.codehaus.xfire.aegis.type.basic.ArrayType.writeValue(ArrayType.java:293)
at org.codehaus.xfire.aegis.type.collection.CollectionType.writeObject(CollectionType.java:103)
at org.codehaus.xfire.aegis.type.basic.BeanType.writeObject(BeanType.java:413)
at org.codehaus.xfire.aegis.AegisBindingProvider.writeParameter(AegisBindingProvider.java:201)
at org.codehaus.xfire.service.binding.AbstractBinding.writeParameter(AbstractBinding.java:273)
at org.codehaus.xfire.service.binding.WrappedBinding.writeMessage(WrappedBinding.java:89)
at org.codehaus.xfire.soap.SoapSerializer.writeMessage(SoapSerializer.java:80)
at org.codehaus.xfire.transport.http.HttpChannel.writeWithoutAttachments(HttpChannel.java:56)
at org.codehaus.xfire.transport.http.CommonsHttpMessageSender.getByteArrayRequestEntity(CommonsHttpMessageSender.java:313)
at org.codehaus.xfire.transport.http.CommonsHttpMessageSender.send(CommonsHttpMessageSender.java:251)
at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:123)
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:75)
... 7 more
I am using JDK 1.5 and my bean has definition like this: Collection<Entity> newEntities; with getter and setters. I define the service in spring xml file like this:
<bean name="Saver" class="org.codehaus.xfire.spring.BeanService">
<property name="properties">
<map>
<entry key="writeXsiType">
<value type="java.lang.Boolean">true</value>
</entry>
<entry key="overrideTypesList">
<list>
<value>com.innovit.ice.core.domain.Entity</value>
<value>com.innovit.ice.core.domain.Group</value>
<value>com.innovit.ice.core.domain.User</value>
<value>com.innovit.ice.core.domain.UserGroup</value>
</list>
</entry>
</map>
</property>
<property name="serviceBean" ref="saver"/>
<property name="serviceClass" value="com.innovit.ice.core.dao.ChangeSaver"/>
<property name="name" value="Saver"/>
</bean>

I thing the issue is not solved. As this functionality is necessary for us, please solve the issue ASAP.
Also It would be great if we have same feature for Arrays too.
Cheers
Behrang


realwangx - 26/Sep/06 12:18 AM
I had the same problem as Behrang Javaherian;
I am using JDK 1.5 and xfire1.2.1;my bean has definition like this: Collection<Entity> newEntities;

As the bellow:

http://xfire.codehaus.org/Mapping+collections

Java5 collections, xfire should figure them out autmotically.

but error as bellow:
Caused by: java.lang.NullPointerException
at org.codehaus.xfire.aegis.type.basic.ObjectType.determineType(ObjectType.java:192)
at org.codehaus.xfire.aegis.type.basic.ObjectType.writeObject(ObjectType.java:165)

Now , I have Solved the problem:

like using java 1.4 ,configure collections like:
<mappings>
<mapping>
<method name="getCollection">
<return-type componentType="MyType"/>
</method>
<method name="setList">
<parameter index="1" componentType="MyType"/>
</method>
</mapping>
</mappings>

just do it , then ok;

reference by:
http://xfire.codehaus.org/Mapping+collections

so , i think xfire-aegis is not good supporting for jdk1.5,
not only 1.4 but also 1.5 is need for Mapping configration for collections


James Burton - 28/Sep/06 05:26 AM
I have the same error with 1.2.1 when returning a List from a method with this interface...

@WebMethod
@WebResult(name = "divisions")
public List<Division> getAllDivisions();

I am using java 1.5.0_07, spring 1.2.8 and the jsr181 annotations.

I do not have this error with 1.1.2, which works fine.

Thus I cannot upgrade until this issue is resolved.


James Burton - 28/Sep/06 05:28 AM
Actually, my stack trace is not identical. Here it is, running in tomcat 5.5.17...

[2006-09-28 10:07:01,164] : ERROR : [http-8080-Processor25] : binding.PostInvocationHandler : java.lang.NullPointerException
[2006-09-28 10:07:01,196] : ERROR : [http-8080-Processor25] : handler.DefaultFaultHandler : Fault occurred!
java.lang.NullPointerException
at org.codehaus.xfire.aegis.type.basic.ObjectType.determineType(ObjectType.java:192)
at org.codehaus.xfire.aegis.type.basic.ObjectType.writeObject(ObjectType.java:165)
at org.codehaus.xfire.aegis.type.basic.ArrayType.writeValue(ArrayType.java:293)
at org.codehaus.xfire.aegis.type.collection.CollectionType.writeObject(CollectionType.java:103)
at org.codehaus.xfire.aegis.AegisBindingProvider.writeParameter(AegisBindingProvider.java:201)
at org.codehaus.xfire.service.binding.AbstractBinding.writeParameter(AbstractBinding.java:273)
at org.codehaus.xfire.service.binding.WrappedBinding.writeMessage(WrappedBinding.java:89)
at org.codehaus.xfire.soap.SoapSerializer.writeMessage(SoapSerializer.java:80)
at org.codehaus.xfire.transport.http.HttpChannel.writeWithoutAttachments(HttpChannel.java:56)
at org.codehaus.xfire.transport.http.XFireServletChannel.sendViaServlet(XFireServletChannel.java:84)
at org.codehaus.xfire.transport.http.XFireServletChannel.send(XFireServletChannel.java:43)
at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.service.binding.PostInvocationHandler.invoke(PostInvocationHandler.java:36)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.transport.DefaultEndpoint.onReceive(DefaultEndpoint.java:64)
at org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:38)
at org.codehaus.xfire.transport.http.XFireServletController.invoke(XFireServletController.java:287)
at org.codehaus.xfire.transport.http.XFireServletController.doService(XFireServletController.java:130)
at org.codehaus.xfire.transport.http.XFireServlet.doPost(XFireServlet.java:116)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)


Prashanth Galisukumar - 28/Sep/06 06:35 PM
I have the same stack trace as that of James Burton's.

2006-09-28 18:21:43,180 [TP-Processor3] DEBUG HandlerPipeline - Invoking handler org.codehaus.xfire.soap.handler.SoapActionOutHandler in phase transport
2006-09-28 18:21:43,180 [TP-Processor3] DEBUG HandlerPipeline - Invoking phase send
2006-09-28 18:21:43,180 [TP-Processor3] DEBUG HandlerPipeline - Invoking handler org.codehaus.xfire.handler.OutMessageSender in phase send
2006-09-28 18:21:43,223 [TP-Processor3] ERROR PostInvocationHandler - java.lang.NullPointerException
2006-09-28 18:21:43,227 [TP-Processor3] ERROR DefaultFaultHandler - Fault occurred!
java.lang.NullPointerException
at org.codehaus.xfire.aegis.type.basic.ObjectType.determineType(ObjectType.java:192)
at org.codehaus.xfire.aegis.type.basic.ObjectType.writeObject(ObjectType.java:165)
at org.codehaus.xfire.aegis.type.collection.MapType.writeObject(MapType.java:165)
at org.codehaus.xfire.aegis.type.basic.BeanType.writeObject(BeanType.java:413)
at org.codehaus.xfire.aegis.type.basic.ArrayType.writeValue(ArrayType.java:293)
at org.codehaus.xfire.aegis.type.collection.CollectionType.writeObject(CollectionType.java:103)
at org.codehaus.xfire.aegis.AegisBindingProvider.writeParameter(AegisBindingProvider.java:201)
at org.codehaus.xfire.service.binding.AbstractBinding.writeParameter(AbstractBinding.java:273)
at org.codehaus.xfire.service.binding.WrappedBinding.writeMessage(WrappedBinding.java:89)
at org.codehaus.xfire.soap.SoapSerializer.writeMessage(SoapSerializer.java:80)
at org.codehaus.xfire.transport.http.HttpChannel.writeWithoutAttachments(HttpChannel.java:56)
at org.codehaus.xfire.transport.http.XFireServletChannel.sendViaServlet(XFireServletChannel.java:84)
at org.codehaus.xfire.transport.http.XFireServletChannel.send(XFireServletChannel.java:43)
at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.service.binding.PostInvocationHandler.invoke(PostInvocationHandler.java:36)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.transport.DefaultEndpoint.onReceive(DefaultEndpoint.java:64)
at org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:38)
at org.codehaus.xfire.transport.http.XFireServletController.invoke(XFireServletController.java:287)
at org.codehaus.xfire.transport.http.XFireServletController.doService(XFireServletController.java:130)
at org.codehaus.xfire.transport.http.XFireServlet.doPost(XFireServlet.java:116)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)

I tried defining the mapping explicitly for collection, but that doesnt seem to fix the issue.
Any other alternatives? Do you guys need futher information on my interface and the webservice?


James Burton - 03/Oct/06 10:31 AM
The 1.2.2 release fixed this problem for me.

Thanks!


Prashanth Galisukumar - 03/Oct/06 10:58 AM
James Burton,
Did you have to provide mapping file or just swapping the jars fixed your problem. Can you explain the changes you made inorder to get the collections component working