You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Joel Turkel <Jo...@alumni.brown.edu> on 2008/06/03 23:36:50 UTC

Re: Adding extra classes to the JAXB context

Hi,

Are there any plans to commit this fix? I'm hitting the same issue and would
like to see the fix make it into the product...

Thanks,
Joel Turkel 


larry ruiz wrote:
> 
> I ran into this problem also, but it seems that it doesn't work when you
> only are configuring an jaxws:endpoint and I guess that is the way of
> doing in a servlet container, just configuring the endpoint. I have the
> following for example
> 
> <beans
>     xmlns="http://www.springframework.org/schema/beans"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xmlns:jaxws="http://cxf.apache.org/jaxws"
>     xmlns:http="http://cxf.apache.org/transports/http/configuration"      
>     xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
>     <import resource="classpath:META-INF/cxf/cxf.xml" />
>     <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
>     <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>     <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>     
>     <jaxws:endpoint 
>         id="myEndpoint" 
>         implementor="#myBeanImplementor" 
>         address="/myService">
>         <jaxws:properties>
>             <entry key="jaxb.additionalContextClasses">
>                 <bean class="com.foo.JAXBAdditionalClassesFactoryBean"/>
>             </entry>
>         </jaxws:properties>
>         <jaxws:features>
>             <bean class="org.apache.cxf.feature.LoggingFeature"/>
>         </jaxws:features>            
>     </jaxws:endpoint>
> ....
> </beans>
> 
> 
> and it seems that the class "org.apache.cxf.frontend.jaxws.EndpointImpl"
> is not passing the properties map to the serverFactory.
> so the workaround would be to pass the properties map(you can see it in
> the attached patch, for trunk branch
> http://www.nabble.com/file/p17151972/frontend.jaxws.EndpointImpl_jaxbAdditionalClasses.patch
> frontend.jaxws.EndpointImpl_jaxbAdditionalClasses.patch ), I would
> appreciate your comments, Is this workaround viable or is there a another
> workaround?.
> 
> 
> thanks 
> Larry Ruiz 
> 
> 
> 
> dkulp wrote:
>> 
>> 
>> Hmm....
>> 
>> I'm not sure why that doesn't work.   We have a system tests for this and 
>> that seems to pass fine:
>> https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/
>> https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/resources/extrajaxbclass.xml
>> 
>> That said, you might want to try the latest SNAPSHOTS:
>> http://people.apache.org/repo/m2-snapshot-repository/org/apache/cxf/apache-cxf/2.1-incubator-SNAPSHOT/
>> 
>> I've spent quite a bit of time the last couple days trying to get the 
>> JAXB databinding to detect a more complete list of classes before 
>> creating the context.   It should do a much better job of of finding the 
>> MyObj object and may add it automatically.
>> 
>> We also now support the jaxb.index files.  Thus, if another class in the 
>> package as MyObj IS detected, you can add the jaxb.index file (just one 
>> line with "MyObj", no package name) to the package and it will load 
>> them.
>> 
>> Dan
>> 
>> 
>> 
>> On Friday 27 July 2007 08:52, Julio Arias wrote:
>>> Hi -
>>>
>>> I have a @WebMethod with a signature like this LIst<MyObj> getSomthing
>>> () I'm using Doc/Lit Soap Binding, and MyObj is not been added to my
>>> WSDL, I found issue CXF-340 that says how to add extra classes to
>>> your JAXB context and i did someting like this (see code below) But
>>> it doesn't seem to work either, I debug the endpoint initialization
>>> an the properties are null.
>>>
>>> <jaxws:endpoint id="documentService" address="/DocumentService"
>>> implementor="#documentServiceImpl">
>>> 		<jaxws:inInterceptors>
>>> 			<ref bean="saajInInterceptor"/>
>>> 			<ref bean="WSS4jInInterceptor"/>
>>> 		</jaxws:inInterceptors>
>>> 		<jaxws:properties>
>>> 			<entry key="jaxb.additionalContextClasses">
>>> 				<bean class="com.rbx.lor.ws.utils.ClassArrayFactoryBean">
>>> 					<property name="classNames">
>>> 						<list>
>>> 							<value>com.rbx.lor.ws.soap.model.UserVO</value>
>>> 						</list>
>>> 					</property>
>>> 				</bean>
>>> 			</entry>
>>> 		</jaxws:properties>
>>> 	</jaxws:endpoint>
>>>
>>>
>>>
>>>
>>> Julio Arias
>>> Java Developer
>>> Roundbox Global : enterprise : technology : genius
>>> ---------------------------------------------------------------------
>>> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
>>> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
>>> email: julio.arias@rbxglobal.com | www.rbxglobal.com
>>> ---------------------------------------------------------------------
>> 
>> -- 
>> J. Daniel Kulp
>> Principal Engineer
>> IONA
>> P: 781-902-8727    C: 508-380-7194
>> daniel.kulp@iona.com
>> http://www.dankulp.com/blog
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Adding-extra-classes-to-the-JAXB-context-tp11828639p17634333.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Adding extra classes to the JAXB context

Posted by Daniel Kulp <dk...@apache.org>.
Ok, a fix for this is committed to trunk.   I'll get new snapshots  
deployed shortly.

Dan



On Jun 4, 2008, at 9:50 AM, Daniel Kulp wrote:

>
>
> Just FYI:  sending patches to the mailing lists is not a good way to  
> send them.   They tend to get lost.   Plus, we're not allowed to  
> apply them anyway.  Patches must be submitted through a JIRA bug  
> report and have the "Assign to Apache" check box checked so that we  
> can legally include them.   We don't know the "legal state" of any  
> patches attached to email messages so we're not allowed to apply them.
>
>
> Dan
>
>
>
>
> On Jun 3, 2008, at 5:36 PM, Joel Turkel wrote:
>
>>
>> Hi,
>>
>> Are there any plans to commit this fix? I'm hitting the same issue  
>> and would
>> like to see the fix make it into the product...
>>
>> Thanks,
>> Joel Turkel
>>
>>
>> larry ruiz wrote:
>>>
>>> I ran into this problem also, but it seems that it doesn't work  
>>> when you
>>> only are configuring an jaxws:endpoint and I guess that is the way  
>>> of
>>> doing in a servlet container, just configuring the endpoint. I  
>>> have the
>>> following for example
>>>
>>> <beans
>>>   xmlns="http://www.springframework.org/schema/beans"
>>>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>   xmlns:jaxws="http://cxf.apache.org/jaxws"
>>>   xmlns:http="http://cxf.apache.org/transports/http/configuration"
>>>   xsi:schemaLocation="http://www.springframework.org/schema/beans
>>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>>> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/ 
>>> jaxws.xsd">
>>>   <import resource="classpath:META-INF/cxf/cxf.xml" />
>>>   <import resource="classpath:META-INF/cxf/cxf-extension- 
>>> http.xml" />
>>>   <import resource="classpath:META-INF/cxf/cxf-extension- 
>>> soap.xml" />
>>>   <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>>>
>>>   <jaxws:endpoint
>>>       id="myEndpoint"
>>>       implementor="#myBeanImplementor"
>>>       address="/myService">
>>>       <jaxws:properties>
>>>           <entry key="jaxb.additionalContextClasses">
>>>               <bean  
>>> class="com.foo.JAXBAdditionalClassesFactoryBean"/>
>>>           </entry>
>>>       </jaxws:properties>
>>>       <jaxws:features>
>>>           <bean class="org.apache.cxf.feature.LoggingFeature"/>
>>>       </jaxws:features>
>>>   </jaxws:endpoint>
>>> ....
>>> </beans>
>>>
>>>
>>> and it seems that the class  
>>> "org.apache.cxf.frontend.jaxws.EndpointImpl"
>>> is not passing the properties map to the serverFactory.
>>> so the workaround would be to pass the properties map(you can see  
>>> it in
>>> the attached patch, for trunk branch
>>> http://www.nabble.com/file/p17151972/frontend.jaxws.EndpointImpl_jaxbAdditionalClasses.patch
>>> frontend.jaxws.EndpointImpl_jaxbAdditionalClasses.patch ), I would
>>> appreciate your comments, Is this workaround viable or is there a  
>>> another
>>> workaround?.
>>>
>>>
>>> thanks
>>> Larry Ruiz
>>>
>>>
>>>
>>> dkulp wrote:
>>>>
>>>>
>>>> Hmm....
>>>>
>>>> I'm not sure why that doesn't work.   We have a system tests for  
>>>> this and
>>>> that seems to pass fine:
>>>> https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/
>>>> https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/resources/extrajaxbclass.xml
>>>>
>>>> That said, you might want to try the latest SNAPSHOTS:
>>>> http://people.apache.org/repo/m2-snapshot-repository/org/apache/cxf/apache-cxf/2.1-incubator-SNAPSHOT/
>>>>
>>>> I've spent quite a bit of time the last couple days trying to get  
>>>> the
>>>> JAXB databinding to detect a more complete list of classes before
>>>> creating the context.   It should do a much better job of of  
>>>> finding the
>>>> MyObj object and may add it automatically.
>>>>
>>>> We also now support the jaxb.index files.  Thus, if another class  
>>>> in the
>>>> package as MyObj IS detected, you can add the jaxb.index file  
>>>> (just one
>>>> line with "MyObj", no package name) to the package and it will load
>>>> them.
>>>>
>>>> Dan
>>>>
>>>>
>>>>
>>>> On Friday 27 July 2007 08:52, Julio Arias wrote:
>>>>> Hi -
>>>>>
>>>>> I have a @WebMethod with a signature like this LIst<MyObj>  
>>>>> getSomthing
>>>>> () I'm using Doc/Lit Soap Binding, and MyObj is not been added  
>>>>> to my
>>>>> WSDL, I found issue CXF-340 that says how to add extra classes to
>>>>> your JAXB context and i did someting like this (see code below)  
>>>>> But
>>>>> it doesn't seem to work either, I debug the endpoint  
>>>>> initialization
>>>>> an the properties are null.
>>>>>
>>>>> <jaxws:endpoint id="documentService" address="/DocumentService"
>>>>> implementor="#documentServiceImpl">
>>>>> 		<jaxws:inInterceptors>
>>>>> 			<ref bean="saajInInterceptor"/>
>>>>> 			<ref bean="WSS4jInInterceptor"/>
>>>>> 		</jaxws:inInterceptors>
>>>>> 		<jaxws:properties>
>>>>> 			<entry key="jaxb.additionalContextClasses">
>>>>> 				<bean class="com.rbx.lor.ws.utils.ClassArrayFactoryBean">
>>>>> 					<property name="classNames">
>>>>> 						<list>
>>>>> 							<value>com.rbx.lor.ws.soap.model.UserVO</value>
>>>>> 						</list>
>>>>> 					</property>
>>>>> 				</bean>
>>>>> 			</entry>
>>>>> 		</jaxws:properties>
>>>>> 	</jaxws:endpoint>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Julio Arias
>>>>> Java Developer
>>>>> Roundbox Global : enterprise : technology : genius
>>>>> ---------------------------------------------------------------------
>>>>> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
>>>>> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
>>>>> email: julio.arias@rbxglobal.com | www.rbxglobal.com
>>>>> ---------------------------------------------------------------------
>>>>
>>>> -- 
>>>> J. Daniel Kulp
>>>> Principal Engineer
>>>> IONA
>>>> P: 781-902-8727    C: 508-380-7194
>>>> daniel.kulp@iona.com
>>>> http://www.dankulp.com/blog
>>>>
>>>>
>>>
>>>
>>
>> -- 
>> View this message in context: http://www.nabble.com/Adding-extra-classes-to-the-JAXB-context-tp11828639p17634333.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>
> ---
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>
>
>
>

---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog





Re: Adding extra classes to the JAXB context

Posted by Daniel Kulp <dk...@apache.org>.

Just FYI:  sending patches to the mailing lists is not a good way to  
send them.   They tend to get lost.   Plus, we're not allowed to apply  
them anyway.  Patches must be submitted through a JIRA bug report and  
have the "Assign to Apache" check box checked so that we can legally  
include them.   We don't know the "legal state" of any patches  
attached to email messages so we're not allowed to apply them.


Dan




On Jun 3, 2008, at 5:36 PM, Joel Turkel wrote:

>
> Hi,
>
> Are there any plans to commit this fix? I'm hitting the same issue  
> and would
> like to see the fix make it into the product...
>
> Thanks,
> Joel Turkel
>
>
> larry ruiz wrote:
>>
>> I ran into this problem also, but it seems that it doesn't work  
>> when you
>> only are configuring an jaxws:endpoint and I guess that is the way of
>> doing in a servlet container, just configuring the endpoint. I have  
>> the
>> following for example
>>
>> <beans
>>    xmlns="http://www.springframework.org/schema/beans"
>>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>    xmlns:jaxws="http://cxf.apache.org/jaxws"
>>    xmlns:http="http://cxf.apache.org/transports/http/configuration"
>>    xsi:schemaLocation="http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
>>    <import resource="classpath:META-INF/cxf/cxf.xml" />
>>    <import resource="classpath:META-INF/cxf/cxf-extension- 
>> http.xml" />
>>    <import resource="classpath:META-INF/cxf/cxf-extension- 
>> soap.xml" />
>>    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>>
>>    <jaxws:endpoint
>>        id="myEndpoint"
>>        implementor="#myBeanImplementor"
>>        address="/myService">
>>        <jaxws:properties>
>>            <entry key="jaxb.additionalContextClasses">
>>                <bean  
>> class="com.foo.JAXBAdditionalClassesFactoryBean"/>
>>            </entry>
>>        </jaxws:properties>
>>        <jaxws:features>
>>            <bean class="org.apache.cxf.feature.LoggingFeature"/>
>>        </jaxws:features>
>>    </jaxws:endpoint>
>> ....
>> </beans>
>>
>>
>> and it seems that the class  
>> "org.apache.cxf.frontend.jaxws.EndpointImpl"
>> is not passing the properties map to the serverFactory.
>> so the workaround would be to pass the properties map(you can see  
>> it in
>> the attached patch, for trunk branch
>> http://www.nabble.com/file/p17151972/frontend.jaxws.EndpointImpl_jaxbAdditionalClasses.patch
>> frontend.jaxws.EndpointImpl_jaxbAdditionalClasses.patch ), I would
>> appreciate your comments, Is this workaround viable or is there a  
>> another
>> workaround?.
>>
>>
>> thanks
>> Larry Ruiz
>>
>>
>>
>> dkulp wrote:
>>>
>>>
>>> Hmm....
>>>
>>> I'm not sure why that doesn't work.   We have a system tests for  
>>> this and
>>> that seems to pass fine:
>>> https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/
>>> https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/resources/extrajaxbclass.xml
>>>
>>> That said, you might want to try the latest SNAPSHOTS:
>>> http://people.apache.org/repo/m2-snapshot-repository/org/apache/cxf/apache-cxf/2.1-incubator-SNAPSHOT/
>>>
>>> I've spent quite a bit of time the last couple days trying to get  
>>> the
>>> JAXB databinding to detect a more complete list of classes before
>>> creating the context.   It should do a much better job of of  
>>> finding the
>>> MyObj object and may add it automatically.
>>>
>>> We also now support the jaxb.index files.  Thus, if another class  
>>> in the
>>> package as MyObj IS detected, you can add the jaxb.index file  
>>> (just one
>>> line with "MyObj", no package name) to the package and it will load
>>> them.
>>>
>>> Dan
>>>
>>>
>>>
>>> On Friday 27 July 2007 08:52, Julio Arias wrote:
>>>> Hi -
>>>>
>>>> I have a @WebMethod with a signature like this LIst<MyObj>  
>>>> getSomthing
>>>> () I'm using Doc/Lit Soap Binding, and MyObj is not been added to  
>>>> my
>>>> WSDL, I found issue CXF-340 that says how to add extra classes to
>>>> your JAXB context and i did someting like this (see code below) But
>>>> it doesn't seem to work either, I debug the endpoint initialization
>>>> an the properties are null.
>>>>
>>>> <jaxws:endpoint id="documentService" address="/DocumentService"
>>>> implementor="#documentServiceImpl">
>>>> 		<jaxws:inInterceptors>
>>>> 			<ref bean="saajInInterceptor"/>
>>>> 			<ref bean="WSS4jInInterceptor"/>
>>>> 		</jaxws:inInterceptors>
>>>> 		<jaxws:properties>
>>>> 			<entry key="jaxb.additionalContextClasses">
>>>> 				<bean class="com.rbx.lor.ws.utils.ClassArrayFactoryBean">
>>>> 					<property name="classNames">
>>>> 						<list>
>>>> 							<value>com.rbx.lor.ws.soap.model.UserVO</value>
>>>> 						</list>
>>>> 					</property>
>>>> 				</bean>
>>>> 			</entry>
>>>> 		</jaxws:properties>
>>>> 	</jaxws:endpoint>
>>>>
>>>>
>>>>
>>>>
>>>> Julio Arias
>>>> Java Developer
>>>> Roundbox Global : enterprise : technology : genius
>>>> ---------------------------------------------------------------------
>>>> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
>>>> tel: 404.567.5000 ext. 2001 | cell: 11.506.849.5981
>>>> email: julio.arias@rbxglobal.com | www.rbxglobal.com
>>>> ---------------------------------------------------------------------
>>>
>>> -- 
>>> J. Daniel Kulp
>>> Principal Engineer
>>> IONA
>>> P: 781-902-8727    C: 508-380-7194
>>> daniel.kulp@iona.com
>>> http://www.dankulp.com/blog
>>>
>>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Adding-extra-classes-to-the-JAXB-context-tp11828639p17634333.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>

---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog