Here is my ibatis configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<sqlMap resource=
"edu/umich/med/umms/coreyp/dao/ibatis_map/misc.xml"/>
<sqlMap resource=
"edu/umich/med/umms/coreyp/dao/ibatis_map/labs.xml"/>
<sqlMap resource=
"edu/umich/med/umms/coreyp/dao/ibatis_map/lab_contact.xml"/>
</sqlMapConfig>
It works fine for 2.1.5 and doesn't work for 2.1.6 and 2.1.7. What is
wrong with my file?
-Henry
Nathan Maves wrote:
Becaureful what you claim :)
ibatis works perfectly fine with ibatis. If you need proof download
the source of ibatis and run the unit testing for it.
What you are trying to say is that your unit tests are failing. I
can see this but the first line of your error message. This is not
an ibatis class throwing this exception. The problem appears to be
that you have not specified your namespace in the app_beans.xml.
Either specify that or set the namespaces attribute to false in your
sqlmapconfig.
Nathan
On Jan 24, 2006, at 9:16 AM, Henry Lu wrote:
iBatis2.1.7 DOES NOT work with JUnit!!!
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'sqlMapClient' defined in file [C:\devel
\webapps\coreyp\WEB-INF\app_beans.xml]: Initialization of bean
failed; nested exception is
com.ibatis.common.exception.NestedRuntimeException: Error occurred.
Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.
Cause: com.ibatis.common.exception.NestedRuntimeException: Error
parsing XPath '/sqlMapConfig/sqlMap'. Cause:
com.ibatis.common.xml.NodeletException: Error parsing XML. Cause:
org.xml.sax.SAXParseException: Attribute "namespace" is not declared
for element "sqlMap".
Caused by: org.xml.sax.SAXParseException: Attribute "namespace" is
not declared for element "sqlMap".
Caused by: com.ibatis.common.xml.NodeletException: Error parsing
XML. Cause: org.xml.sax.SAXParseException: Attribute "namespace" is
not declared for element "sqlMap".
Caused by: org.xml.sax.SAXParseException: Attribute "namespace" is
not declared for element "sqlMap".
Caused by: com.ibatis.common.exception.NestedRuntimeException: Error
parsing XPath '/sqlMapConfig/sqlMap'. Cause:
com.ibatis.common.xml.NodeletException: Error parsing XML. Cause:
org.xml.sax.SAXParseException: Attribute "namespace" is not declared
for element "sqlMap".
Caused by: org.xml.sax.SAXParseException: Attribute "namespace" is
not declared for element "sqlMap".
Caused by: com.ibatis.common.xml.NodeletException: Error parsing
XML. Cause: org.xml.sax.SAXParseException: Attribute "namespace" is
not declared for element "sqlMap".
Caused by: org.xml.sax.SAXParseException: Attribute "namespace" is
not declared for element "sqlMap".
-Henry
Nathan Maves wrote:
Not sure what the issue it since you have not included any error
messages but you should upgrade your 2.1.6 to 2.1.7.
Nathan
On Jan 24, 2006, at 8:44 AM, Henry Lu wrote:
Bad news! iBatis 2.1.6 doesn't work for Junit test with java 1.5.
When I switched iBatis back to 1.5, it works. Any idea why? in
Fixing? new Version coming out with fixing?
-Henry
Larry Meadors wrote:
I am using, and have built iBATIS with jdk1.5 - unit tests and all.
IIRC, it was pissed about the lack of a xalan impl but once I
put that
in devlib it was happy.
Larry
On 1/23/06, Henry Lu <[EMAIL PROTECTED]> wrote:
I am using Junit test within the eClipse.
-Henry
Nathan Maves wrote:
Your application work because java is backwards compatible. The
build script, which includes the unit tests will not run with java
1.5. I think there are classloader issues that require you to
mess
with the dependancies.
Just to reiterate there are no know issues with using ibatis
on Java
1.5. We have been using it for a while now.
Nathan
On Jan 23, 2006, at 1:04 PM, Henry Lu wrote:
Thanks for your info! Why my application works with jdk 1.5 and
JUnit doesn't with with jdk1.5?
-Henry
Nathan Maves wrote:
If you are asking about the JUnit tests for the ibatis code then
yes and no :)
I have tried it and it will not work. You need to run the unit
tests with 1.4. For now the plans looks like we might try to
migrate to 1.5 when 1.6 comes out. Don't quote me on this
but I
would be a good thing for ibatis.
Nathan
On Jan 23, 2006, at 12:46 PM, Henry Lu wrote:
Is there anyone who are using jdk 1.5 and JUnit test for
ibatis?
-Henry
[EMAIL PROTECTED] wrote:
what about XML?
Cause:
org.xml.sax.SAXParseException: Attribute "namespace" is not
declared for
element "sqlMap".
Caused by: org.xml.sax.SAXParseException: Attribute
"namespace" is not
declared for element "sqlMap".
!!!
Attribute "namespace" is not declared for
element "sqlMap".
C уважением,
Алексей.
mobile: +375-029-708-2168 email:
[EMAIL PROTECTED]
*Henry Lu <[EMAIL PROTECTED]>*
23.01.2006 17:12
Please respond to
[email protected]
To
[email protected]
cc
Subject
Re: junit test
All correct version. Because it works for the application.
ibatis-common-2.jar
ibatis-dao-2.jar
ibatis-sqlmap-2.jar
and spring 1.2.6
[EMAIL PROTECTED] wrote:
Check that you use the correct libraries for spring and
ibatis.
Also check your XML:
Cause:
org.xml.sax.SAXParseException: Attribute "namespace" is not
declared for
element "sqlMap".
Caused by: org.xml.sax.SAXParseException: Attribute
"namespace" is not
declared for element "sqlMap".
C уважением,
Алексей. >
mobile: +375-029-708-2168 > email:
[EMAIL PROTECTED] >
*Henry Lu <[EMAIL PROTECTED]>*
23.01.2006 16:59
Please respond to
[email protected]
> To
[email protected]
cc
> Subject
junit test
>
I go the following error when I did JUnit test:
setUp()----------
org.springframework.beans.factory.BeanCreationException:
E rror
creating
bean with name 'sqlMapClient' defined in file
[C:\devel\webapps\coreyp\WEB-INF\app_beans.xml]:
Initialization of bean
failed; nested exception is
com.ibatis.common.exception.NestedRuntimeException: Error
occurred. > Cause: com.ibatis.common.xml.NodeletException:
Error parsing XML. > Cause:
com.ibatis.common.exception.NestedRuntimeException: Error
parsing
XPath '/sqlMapConfig/sqlMap'. Cause:
com.ibatis.common.xml.NodeletException: Error parsing
XML. Cause:
org.xml.sax.SAXParseException: Attribute "namespace" is not
declared for
element "sqlMap".
Caused by: org.xml.sax.SAXParseException: Attribute
"namespace" is not
declared for element "sqlMap".
However, it works when I run the application.
Here is code for JUNit test:
org.springframework.context.ApplicationContext ctx
= null;
String[] paths = { "/WEB-INF/test/
datasource_beans_test.xml",
"/WEB-INF/authorize-spring.xml",
"/WEB-INF/spring-auth.xml",
"/WEB-INF/app_beans.xml"};
ctx = new FileSystemXmlApplicationContext(paths);
How to make JUnit works?
-Henry