Hi,Gert Vanthienen:
Thanks so much for your reply, and I am working on intergrating Axis2 into
JOnAS, and I have met one problem that confused me. I doubt that is a bug in
servicemix jaxb api.
After a careful trace, I find that the cause of that issue is ServiceMix
version and Sun version JAXB API have different logic in one function:
In detail, You can see these two version of ContextFinder.java#find(..) in
This is sun-jaxb api:
static JAXBContext find(String factoryId, String contextPath, ClassLoader
classLoader, Map properties ) throws JAXBException {
// TODO: do we want/need another layer of searching in
$java.home/lib/jaxb.properties like JAXP?
final String jaxbContextFQCN = JAXBContext.class.getName();
// search context path for jaxb.properties first
StringBuilder propFileName;
StringTokenizer packages = new StringTokenizer( contextPath, ":" );
String factoryClassName;
if(!packages.hasMoreTokens())
// no context is specified
throw new
JAXBException(Messages.format(Messages.NO_PACKAGE_IN_CONTEXTPATH));
In this version, if contextPath's value is "", this function will throw an
JAXBException showing Messages.NO_PACKAGE_IN_CONTEXTPATH
Here is serviceMix-jaxb api:
public static JAXBContext find(String contextPath, ClassLoader classLoader,
Map properties) throws JAXBException {
String className = null;
String[] packages = contextPath.split(":");
if (packages == null || packages.length == 0) {
throw new JAXBException("Invalid contextPath");
}
In this version, if contextPath's value is "", the packages variable contains
an element "", then it will not throw the JAXBException.
In our circumstances , our application, the parameter contextPath's value is
"", so this function should throw a JAXBException in Axis2's sun-jaxb api, but
here in servicemix version, it does not throw JAXBException, so the logic
between these two version are different.
Axis2 uses this to determine which methodmarshaller to use, and because this
logic different here, it will select a wrong marshaller and cause a failure if
it uses ServiceMix jaxb-api ...
Can you give me some guide on this issue? Thanks very much!
2009-08-01
xiaoda08
发件人: Gert Vanthienen
发送时间: 2009-08-01 16:14:13
收件人: users
抄送:
主题: Re: A question about org.apache.servicemix.specs.jaxb-api-2.1
Xiao Da,
You have come to exactly the right mailing list, so if you let us know
what issues you're experiencing, we'll gladly help out. The
jaxb-api-2.1 bundle is basically just the JAXB 2.1 packaged in an OSGi
bundle, with one extra feature to help out in finding matching
implementations (described by Guillaume in this blog post --
http://gnodet.blogspot.com/2008/05/jee-specs-in-osgi.html ).
Regards,
Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/
2009/7/31 xiaoda08 <[email protected]>:
> Hi,
>
>
> I am working on JOnAS, and we are trying to use
> org.apache.servicemix.specs.jaxb-api-2.1 instead of sun jaxb api, but it
> seems I find a problem about it, and I want to know who should I contact to
> discuss this problem.
>
> Can anyone help me about this problem ?
>
> Thanks a lot!
>
>
> --Xiao Da
>
>
> 2009-07-30
>
>
>
> xiaoda08
>