-
Sep 10th, 2008, 11:20 AM
#1
create a simple dao in Spring Aplication Server
Hi all,
I have a problem. I create a small project for Spring Application Server. There is a one dao object. Then i write simple test for this dao and run it. I retrive an error with loggin...
java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
at org.slf4j.LoggerFactory.<clinit>(LoggerFactory.jav a:60)
at org.apache.commons.logging.impl.SLF4JLogFactory.ge tInstance(SLF4JLogFactory.java:155)
at org.apache.commons.logging.impl.SLF4JLogFactory.ge tInstance(SLF4JLogFactory.java:131)
at org.apache.commons.logging.LogFactory.getLog(LogFa ctory.java:203)
at org.springframework.context.support.AbstractApplic ationContext.<init>(AbstractApplicationContext.jav a:146)
at org.springframework.context.support.AbstractRefres hableApplicationContext.<init>(AbstractRefreshable ApplicationContext.java:84)
at org.springframework.context.support.AbstractRefres hableConfigApplicationContext.<init>(AbstractRefre shableConfigApplicationContext.java:59)
at org.springframework.context.support.AbstractXmlApp licationContext.<init>(AbstractXmlApplicationConte xt.java:58)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:136)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:83)
at org.sith.company.db.engine.dao.MessageDAOTest.test AddMessage(MessageDAOTest.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.internal.runners.TestMethodRunner.execut eMethodBody(TestMethodRunner.java:99)
at org.junit.internal.runners.TestMethodRunner.runUnp rotected(TestMethodRunner.java:81)
at org.junit.internal.runners.BeforeAndAfterRunner.ru nProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestMethodRunner.runMet hod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(Te stMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner. invokeTestMethod(TestClassMethodsRunner.java:66)
at org.junit.internal.runners.TestClassMethodsRunner. run(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUn protected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.ru nProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(Tes tClassRunner.java:52)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestR eference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:196)
Caused by: java.lang.ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder
at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)
... 31 more
How i can resolve this fix this problem...?
I see in the semple project from SpringApplicationServer - springtravel, and there i can't find place where create dao bean...
-
Sep 11th, 2008, 08:57 AM
#2
create a simple dao in Spring Aplication Server
Did you properly setup your META-INF/MANIFEST.MF for your bundle ???
it should cover something like:
Import-Packages:
org.slf4j.impl
-
Sep 12th, 2008, 05:58 AM
#3
create a simple dao in Spring Aplication Server
it's not working...
i can't understand how in the example (http://dist.springsource.com/release/SAMPL/spring-travel-1.0.1.RELEASE.zip) creates this bean
-
Sep 12th, 2008, 06:55 AM
#4
create a simple dao in Spring Aplication Server
As far as I know, the JUnit runner in Eclipse doesn't make use of the Bundle Manifest classpath container that the server tools create for you. Do you have the SLF4J impl JAR on your project's 'standard' Java classpath?
-
Sep 12th, 2008, 07:50 AM
#5
create a simple dao in Spring Aplication Server
may be not, but i use eclipse plugin for Application Server, is it doesn't add in classpath this jar, and where is in the example place with init dao bean?
-
Sep 12th, 2008, 10:19 AM
#6
create a simple dao in Spring Aplication Server
The Spring Travel sample uses a JPA-based DAO: JpaHotelSearchAgent. It's marked with a @Repository annotation and is then instantiated via component scanning. Component scanning is enabled in src/main/resources/META-INF/spring/module-context.xml at runtime and in src/test/resources/META-INF/spring/test-jpa-context.xml file during unit testing.
Regards,
Andy
-
Sep 15th, 2008, 03:28 AM
#7
create a simple dao in Spring Aplication Server
o i see, and where in prodaction code use this DAO?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules