ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Janluc <htpwraxkvv...@mailinator.com>
Subject Re: Could not find resource error
Date Tue, 21 Mar 2006 16:05:31 GMT

Thanks Jeff, following your suggestions I investigated those arcane
classloader issues and I came up with a partially satisfactory solution.

Let me try to explain what I was trying to do:
First I "bundled" all iBatis jars and the MySQL J/Connector jar into an
Eclipse plugin, by using the "New Plugin from Existing Jars" wizard. I
called it org.apache.ibatis.
Then I created my sample RCP test application to test the iBatis connection
and normal db activities, I called it fr.grenoble.db. In this plugin I
generated all the abator artifacts: the sqlmaps, the java classes and the
dao classes.
After that, in this db plugin I created a simple Application.java whose only
job is to insert a row in a table of the database.

But initially I kept getting those "resource not found errors" during
runtime, so, after your suggestion, and digging into the documentation, I
found that I would've probably needed to use some "buddy classloading"
spells. So I added the line:

Eclipse-BuddyPolicy: registered

into the MANIFEST.MF of the org.apache.ibatis "plugin", and the line:

Eclipse-RegisterBuddy: org.apache.ibatis

into the MANIFEST.MF of the fr.grenoble.db plugin.

By doing that, the "resource not found" issue seemed to be solved.

But now, I get another error: when I try to use the 

sqlMap.insert("abatorgenerated_insert", se);

in my Application.java class, I get this error message:

!ENTRY org.eclipse.osgi 2006-03-21 16:46:38.87
!MESSAGE Application error
com.ibatis.sqlmap.client.SqlMapException: There is no statement named
abatorgenerated_insert in this SqlMap.
	at fr.grenoble.db.Application.run(Application.java:41)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
	at org.eclipse.core.launcher.Main.run(Main.java:973)
	at org.eclipse.core.launcher.Main.main(Main.java:948)

However, I can see that statement in the system_element_SqlMap.xml file:

  <insert id="abatorgenerated_insert"
      WARNING - This element is automatically generated by Abator for
iBATIS, do not modify.
      This element was generated on Tue Mar 21 16:45:59 CET 2006.
    insert into system_element (SE_ID, SE_PARENT_ID, SE_NAME, SE_TYPE, 
    values (#seId:INTEGER#, #seParentId:INTEGER#, #seName:VARCHAR#, 
      #seType:VARCHAR#, #seDescription:VARCHAR#) 

I searched in the archive for similar errors and I found that I must use the 
useStatementNamespaces="true" in my SqlMapConfig.xml, which I do, but I
still get the same error.

Any clue?

Thanks again!


Jeff Butler-2 wrote:
> I don't completely follow what you're trying to do, but there's obviously
> some classloader confusion.
> Eclipse plugins run in their own class loaders.  The plugin classloader
> does
> not contain workspace classes in its path, so plugins cannot see workspace
> classes.  My guess is that you are getting caught up in some of that
> confusion.
View this message in context: http://www.nabble.com/Could-not-find-resource-error-t1310881.html#a3515034
Sent from the iBATIS - User - Java forum at Nabble.com.

View raw message