You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by PAC Kieffer Guillaume <Gu...@panalpina.com> on 2012/07/09 10:43:10 UTC

IBM JDK XMLSchemaFactory

Hi,

I am facing a problem using Servicemix with IBM JDK for XSD validation. 
The environment is the following: IBM JDK 1.6.0 64b; ServiceMix 4.4.1

The following exception is raised while trying to locate a xsd file within a CAMEL route:

org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: validator://myxsd-1.0.xsd due to: http://www.w3.org/2001/XMLSchema
..
Caused by: java.lang.IllegalArgumentException: http://www.w3.org/2001/XMLSchema
        at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:194)

I already had issues with the IBM default jaxp properties and Servicemix; They were solved by updating the SMX etc/system.properties with a new javax.xml.transform.TransformerFactory value..

After some googling I saw a similar issue but only on Java 5 (:O) that could be solved by updating the SchemaFactory property for the XMLSchema namespace with the following: 
javax.xml.validation.SchemaFactory:http\://www.w3.org/2001/XMLSchema=com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory
I tried this option, but no change, the exception is still there. Note that the default property used by IBM JDK is:
javax.xml.validation.SchemaFactory:http\://www.w3.org/2001/XMLSchema=org.apache.xerces.jaxp.validation.XMLSchemaFactory

On my local environment (Windows and Oracle JDK) no issue at all...

Thanks to share your experience :)

Regards,
Guillaume.


RE: IBM JDK XMLSchemaFactory

Posted by PAC Kieffer Guillaume <Gu...@panalpina.com>.
Hi Freeman,

Effectively the com.sun package had little chance to be found on an IBM JDK..

- Launching the command packages:exports |grep org.apache.xerces.jaxp.validation did not show any xerces package!

1) I then installed 
<dependency>
	<groupId>org.apache.servicemix.bundles</groupId>
	<artifactId>org.apache.servicemix.bundles.xerces</artifactId>
	<version>2.10.0_1</version>
</dependency>
            
2) and updated the system.properties of the child instance with 
javax.xml.validation.SchemaFactory:http\://www.w3.org/2001/XMLSchema=com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory

3) and added explicitly the org.apache.xerces.jaxp.validation to the Import-Package of the Manifest.

All of those points were necessary to start the bundle correctly (ok maybe not the 2nd point as it's IBM JRE default value)

Thanks for your help and useful advices!! :)

Regards,
Guillaume.

-----Original Message-----
From: Freeman Fang [mailto:freeman.fang@gmail.com] 
Sent: Tuesday, July 10, 2012 01:41
To: users@servicemix.apache.org
Subject: Re: IBM JDK XMLSchemaFactory

Hi,

On IBM JDK there's no package like  
com.sun.org.apache.xerces.internal.jaxp.validation, so you shouldn't use
javax.xml.validation.SchemaFactory:http\://www.w3.org/2001/XMLSchema=com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory
you should use
javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema=org.apache.xerces.jaxp.validation.XMLSchemaFactory
instead.

Also, you can  add Package-Import org.apache.xerces.jaxp.validation to  
your customer bundle to see if it helps.
Also, you can use
packages:exports |grep org.apache.xerces.jaxp.validation
from the SMX console to see if the package  
org.apache.xerces.jaxp.validation is available from OSGi container.

Freeman
On 2012-7-9, at 下午4:43, PAC Kieffer Guillaume wrote:

> Hi,
>
> I am facing a problem using Servicemix with IBM JDK for XSD  
> validation.
> The environment is the following: IBM JDK 1.6.0 64b; ServiceMix 4.4.1
>
> The following exception is raised while trying to locate a xsd file  
> within a CAMEL route:
>
> org.apache.camel.ResolveEndpointFailedException: Failed to resolve  
> endpoint: validator://myxsd-1.0.xsd due to: http://www.w3.org/2001/XMLSchema
> ..
> Caused by: java.lang.IllegalArgumentException: http://www.w3.org/2001/XMLSchema
>        at  
> javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:194)
>
> I already had issues with the IBM default jaxp properties and  
> Servicemix; They were solved by updating the SMX etc/ 
> system.properties with a new javax.xml.transform.TransformerFactory  
> value..
>
> After some googling I saw a similar issue but only on Java 5 (:O)  
> that could be solved by updating the SchemaFactory property for the  
> XMLSchema namespace with the following:
> javax.xml.validation.SchemaFactory:http\://www.w3.org/2001/XMLSchema=com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory
> I tried this option, but no change, the exception is still there.  
> Note that the default property used by IBM JDK is:
> javax.xml.validation.SchemaFactory:http\://www.w3.org/2001/XMLSchema=org.apache.xerces.jaxp.validation.XMLSchemaFactory
>
> On my local environment (Windows and Oracle JDK) no issue at all...
>
> Thanks to share your experience :)
>
> Regards,
> Guillaume.
>

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042











Re: IBM JDK XMLSchemaFactory

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

On IBM JDK there's no package like  
com.sun.org.apache.xerces.internal.jaxp.validation, so you shouldn't use
javax.xml.validation.SchemaFactory:http\://www.w3.org/2001/XMLSchema=com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory
you should use
javax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema=org.apache.xerces.jaxp.validation.XMLSchemaFactory
instead.

Also, you can  add Package-Import org.apache.xerces.jaxp.validation to  
your customer bundle to see if it helps.
Also, you can use
packages:exports |grep org.apache.xerces.jaxp.validation
from the SMX console to see if the package  
org.apache.xerces.jaxp.validation is available from OSGi container.

Freeman
On 2012-7-9, at 下午4:43, PAC Kieffer Guillaume wrote:

> Hi,
>
> I am facing a problem using Servicemix with IBM JDK for XSD  
> validation.
> The environment is the following: IBM JDK 1.6.0 64b; ServiceMix 4.4.1
>
> The following exception is raised while trying to locate a xsd file  
> within a CAMEL route:
>
> org.apache.camel.ResolveEndpointFailedException: Failed to resolve  
> endpoint: validator://myxsd-1.0.xsd due to: http://www.w3.org/2001/XMLSchema
> ..
> Caused by: java.lang.IllegalArgumentException: http://www.w3.org/2001/XMLSchema
>        at  
> javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:194)
>
> I already had issues with the IBM default jaxp properties and  
> Servicemix; They were solved by updating the SMX etc/ 
> system.properties with a new javax.xml.transform.TransformerFactory  
> value..
>
> After some googling I saw a similar issue but only on Java 5 (:O)  
> that could be solved by updating the SchemaFactory property for the  
> XMLSchema namespace with the following:
> javax.xml.validation.SchemaFactory:http\://www.w3.org/2001/XMLSchema=com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory
> I tried this option, but no change, the exception is still there.  
> Note that the default property used by IBM JDK is:
> javax.xml.validation.SchemaFactory:http\://www.w3.org/2001/XMLSchema=org.apache.xerces.jaxp.validation.XMLSchemaFactory
>
> On my local environment (Windows and Oracle JDK) no issue at all...
>
> Thanks to share your experience :)
>
> Regards,
> Guillaume.
>

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042