ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "anis" <anis.zoua...@adhoc.ag>
Subject RE: Could not find *.dtd resource
Date Wed, 20 Apr 2005 06:37:08 GMT
Thanks Brandon for your reply
I'm using my own plugin, (under developpement )

The problem is the following: ibatis in the his Resource class, use a the
default classLoader ( of the CurrentThread ) to load *.dtd resources in his
jar file, the default classloader is different than the Plugin's Class
loader witch is responsible of the loading of lib/*.jar of my plugin .
And for this reason it can't reach the *.dtd files in the jars files.

The solution of this pb is to tell ibatis Resource class to use the
classLoader of my plugin : 

ClassLoader classLoader = MyPlugin.class.getClassLoader();
// tell ibatis to use the classLoader of the plugin
com.ibatis.common.resources.Resources.setDefaultClassLoader(classLoader);
// build the ibatis's SqlMapClient
SqlMapClient sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(freader);

Now it works 

I hope this will help other eclipse plugin developers using ibatis.

Kindest regards, 
Anis 

-----Original Message-----
From: Brandon Goodin [mailto:brandon.goodin@gmail.com] 
Sent: mardi 19 avril 2005 23:17
To: ibatis-user-java@incubator.apache.org
Subject: Re: Could not find *.dtd resource

what eclipse plugin are you using?

On 4/19/05, anis <anis.zouaoui@adhoc.ag> wrote:
>  
>  
> 
> Hi, 
> 
> I'm using ibatis with an eclipse plugin and I'm facing this error while
> building the xml map file : 
> 
> com.ibatis.common.exception.NestedRuntimeException: Error
> occurred.  Cause: com.ibatis.common.xml.NodeletException:
> Error parsing XML.  Cause: org.xml.sax.SAXException: java.io.IOException:
> Could not find resource
> com/ibatis/sqlmap/engine/builder/xml/sql-map-config-2.dtd 
> 
> Caused by: org.xml.sax.SAXException: java.io.IOException: Could not find
> resource
> com/ibatis/sqlmap/engine/builder/xml/sql-map-config-2.dtd 
> 
> Caused by: com.ibatis.common.xml.NodeletException: Error
> parsing XML.  Cause: org.xml.sax.SAXException: java.io.IOException: Could
> not find resource
> com/ibatis/sqlmap/engine/builder/xml/sql-map-config-2.dtd 
> 
> Caused by: org.xml.sax.SAXException: java.io.IOException: Could not find
> resource
> com/ibatis/sqlmap/engine/builder/xml/sql-map-config-2.dtd 
> 
>        at
>
com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigPa
rser.java:81)
> 
>        at
>
com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientB
uilder.java:62)
> 
>   
> 
> Using a standalone application it work, but from the plugin it doesn't. 
> 
> Could you please explain to me why the *.dtd are not reachable by the
> SqlMapClientBuilder, ( I checked the dtd location, they exist in the
> ibatis-sqlmap-2.jar file) 
> 
> Kindest regards 
> 
> Anis 
> 
>



Mime
View raw message