Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplicated definition for: 'identifiedType'

I have a web application where i am using spring 3.0 and oracle's XMLTYPE related jar's com.oracle.xdb which in turn depends on com.oracle.xml.xmlparserv2 , iam sure most of you aware of the exception that you get when these jars are used with spring 3.0 as below,

Caused by: oracle.xml.parser.schema.XSDException: Duplicated definition for: 'identifiedType'

there are some suggestions to use a different parser like xerces, but in our case since we use the xdb dependency, it looks like we cannot change it to use another parser other than com.oracle.xml.xmlparserv2, it was working fine with spring 2.5.6 is there any info on when this would be fixed either by spring/oracle?

like image 276
Aravias Avatar asked Feb 15 '11 15:02

Aravias


2 Answers

Instead of modifying xmlparserv2.jar you can add

-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl

Click here to read a post on Oracle's forums talking about the issue.

like image 70
Shane Avatar answered Sep 28 '22 09:09

Shane


I have identified that the problem is due to the inhability of xmlparserv2 to appropriately parse the xsi:schemaLocation attribute.

I have checked that this works:

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"

While this produces the eror:

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"

The workaround is to remove the use of specific namespaces (such as tx, util..) and replace them by the equivalent definitions using common beans. For example, you can replace <tx:annotation-driven/> with <bean class="org.springframework.transaction.annotation.AnnotationTransactionAttributeSource"/>

like image 26
Pau Giner Avatar answered Sep 28 '22 07:09

Pau Giner