Re: JUnit question
I'll give it a whirl...:) David Blevins wrote: > > > On Nov 19, 2008, at 6:32 AM, ericp56 wrote: > >> >> I wasn't paying attention to the package, only the class name. >> Thanks for >> the clarification:) > > No worries. I've often thought it would be neat to add some > functionality that would catch ClassNotFoundExceptions and print the > name of the jar that should be added to the classpath. Wouldn't be > too hard as all we'd have to do is create a maven plugin (or any plain > java code we can run via the maven-ant-plugin at build time) that > squirted the indexes of each jar we depend on into a file that we > include in the openejb-core jar. Then it'd simply be a quick read > through that file to find the jar name to add to the error message. > > Would be a cool contribution if you felt like giving it a whirl :) > > -David > > > -- View this message in context: http://www.nabble.com/JUnit-question-tp20306283p20606400.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: JUnit question
On Nov 19, 2008, at 6:32 AM, ericp56 wrote: I wasn't paying attention to the package, only the class name. Thanks for the clarification:) No worries. I've often thought it would be neat to add some functionality that would catch ClassNotFoundExceptions and print the name of the jar that should be added to the classpath. Wouldn't be too hard as all we'd have to do is create a maven plugin (or any plain java code we can run via the maven-ant-plugin at build time) that squirted the indexes of each jar we depend on into a file that we include in the openejb-core jar. Then it'd simply be a quick read through that file to find the jar name to add to the error message. Would be a cool contribution if you felt like giving it a whirl :) -David
Re: JUnit question
I wasn't paying attention to the package, only the class name. Thanks for the clarification:) -- View this message in context: http://www.nabble.com/JUnit-question-tp20306283p20580964.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: JUnit question
On Nov 5, 2008, at 2:50 PM, ericp56 wrote: That's already included in my classpath via openejb-core-3.0.jar (in Geronimo server). Not sure I follow. The embeddable EJB container functionality for unit testing doesn't use the Geronimo server. Also Geronimo doesn't use commons-dbcp as it has it's own connection management code. You could try something like this in your test case to see what is in our classpath, assuming the Eclipse classloader is a subclass of URLClassLoader (good chance of that). ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); System.out.println("classLoader" + classLoader); System.out.println("classLoader.class" + classLoader.getClass().getName()); if (classLoader instanceof URLClassLoader) { URLClassLoader urlClassLoader = (URLClassLoader) classLoader; URL[] urls = urlClassLoader.getURLs(); for (URL url : urls) { System.out.println("url = " + url.toExternalForm()); } } -David
Re: JUnit question
That's already included in my classpath via openejb-core-3.0.jar (in Geronimo server). -- View this message in context: http://www.nabble.com/JUnit-question-tp20306283p20351506.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: JUnit question
On Nov 4, 2008, at 3:05 PM, ericp56 wrote: org .eclipse .jdt .internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java: 196) Caused by: java.lang.NoClassDefFoundError: org/apache/commons/dbcp/BasicDataSource I'm guessing it's something simple with my configuration... That class is in the commons-dbcp-all jar under the lib/ directory. Definitely add that to your classpath if you haven't. -David
Re: JUnit question
On Wed, Nov 5, 2008 at 12:05 AM, ericp56 <[EMAIL PROTECTED]> wrote: > My current problem is "caused by:" > Caused by: java.lang.NoClassDefFoundError: > org/apache/commons/dbcp/BasicDataSource Add commons-dbcp-*.jar to CLASSPATH and start it over. Jacek -- Jacek Laskowski Notatnik Projektanta Java EE - http://www.JacekLaskowski.pl
Re: JUnit question
Hi David, I'm using a test application to take it one step at a time. I'll eventually tackle that other one. My current problem is "caused by:" Caused by: java.lang.NoClassDefFoundError: org/apache/commons/dbcp/BasicDataSource ScrapTest.Java: @Stateless(name="ScrapTest") public class ScrapTest implements IScrapTest { @PersistenceContext(unitName = "ScrapEjb") private EntityManager entityManager; public String Echo(String EchoString) { // TODO Auto-generated method stub return EchoString; } } ejb-jar.xml: http://java.sun.com/xml/ns/javaee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd";> Scrap Ejb Test ScrapTest SchedulerDB2 javax.sql.DataSource Container Shareable SchedulerDB javax.sql.DataSource Container Shareable persistence.xml SchedulerDB SchedulerDB2 com.abc.ivr.test.Outboundconfiguration
Re: JUnit question
Hi Eric, Can you post the stack trace? -David On Nov 3, 2008, at 8:53 AM, ericp56 wrote: Hello, In Eclipse, I'm able to test a simple EJB with Junit. I'm having problems testing one slightly more complicated. I had to create an ejb-jar.xml file, because the openejb-jar.xml file was not recognized in junit. Now, I am getting this: FATAL - OpenEJB has encountered a fatal error and cannot be started: Assembler failed to build the container system. ... NullPointerException... I'm guessing it's perhaps one of my openejb-jar.xml dependencies is not being loaded, like a console.dbpool resource. Any suggestions on how to resolve it? Thanks, Eric -- View this message in context: http://www.nabble.com/JUnit-question-tp20306283p20306283.html Sent from the OpenEJB User mailing list archive at Nabble.com.