ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Could not find resource error
Date Tue, 21 Mar 2006 16:21:03 GMT
Wow!  Great job on figuring this out.  You're so close...

I think the only thing you need to change is on your insert statement:

sqlMap.insert("NAMESPACE.abatorgenerated_insert", se);

Where NAMESPACE is the namespace of the generated SQL Map - you can see it
on the <sqlMap> element in the XML file.  When you enable statement
namespaces, all statement ids must be qualified like this.

Jeff Butler



On 3/21/06, Janluc <htpwraxkvvqcb@mailinator.com> wrote:
>
>
> 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
> !STACK 1
> com.ibatis.sqlmap.client.SqlMapException: There is no statement named
> abatorgenerated_insert in this SqlMap.
>        at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(
> SqlMapExecutorDelegate.java:288)
>        at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(
> SqlMapExecutorDelegate.java:424)
>        at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(
> SqlMapSessionImpl.java:81)
>        at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(
> SqlMapClientImpl.java:58)
>        at fr.grenoble.db.Application.run(Application.java:41)
>        at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(
> PlatformActivator.java:226)
>        at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java
> :376)
>        at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java
> :163)
>        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"
> parameterClass="fr.grenoble.db.model.SystemElement">
>    <!--
>      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,
>      SE_DESCRIPTION)
>    values (#seId:INTEGER#, #seParentId:INTEGER#, #seName:VARCHAR#,
>      #seType:VARCHAR#, #seDescription:VARCHAR#)
> </insert>
>
> 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!
>
> JL
>
>
>
> 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.
>
>

Mime
View raw message