[jboss-user] [EJB 3.0] - Re: Embeddable EJB3 Alpha 9 in JUnit

r_q_d do-not-reply at jboss.com
Mon Sep 18 23:20:56 EDT 2006


I am tring to follow tips from http://wiki.jboss.org/wiki/Wiki.jsp?page=EJB3EmbeddedPerformanceTips and I want to run the test case without put all the classes in to jar file, I get following error. My code is followed by the error message. Any body can provide any help? I am using jboss-EJB-3.0_Embeddable_ALPHA_9

Thanks in advance.

Quande.



ERROR 18-09 23:11:43,837 (AbstractController.java:incrementState:440)  -Error installing to Start: name=java:comp/Initializer state=Create
javax.naming.NoInitialContextException: Cannot instantiate class: 
							org.jnp.interfaces.LocalOnlyContextFactory [Root exception is java.lang.ClassNotFoundException: 
							org.jnp.interfaces.LocalOnlyContextFactory]
	at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
	at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
	at javax.naming.InitialContext.init(Unknown Source)
	at javax.naming.InitialContext.(Unknown Source)
	at org.jboss.ejb3.EJB3Util.getInitialContext(EJB3Util.java:95)
	at org.jboss.ejb3.embedded.JavaCompInitializer.start(JavaCompInitializer.java:52)
	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.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:55)
	at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:107)
	at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
	at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:75)
	at org.jboss.kernel.plugins.dependency.LifecycleAction.installAction(LifecycleAction.java:115)
	at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.install(KernelControllerContextAction.java:100)
	at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
	at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:226)
	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:709)
	at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:429)
	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:538)
	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:472)
	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:274)
	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:177)
	at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:291)
	at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:261)
	at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:117)
	at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.deploy(BeanXMLDeployer.java:95)
	at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3StandaloneBootstrap.java:373)
	at com.ehelper.ejb.formsetting.EmbeddedJBossEJB3TestCaseHelper.startupEmbeddedJboss(EmbeddedJBossEJB3TestCaseHelper.java:113)
	at com.ehelper.ejb.formsetting.EmbeddedJBossEJB3TestCaseHelper$1.setUp(EmbeddedJBossEJB3TestCaseHelper.java:88)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:18)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.extensions.TestSetup.run(TestSetup.java:23)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.ClassNotFoundException: 
							org.jnp.interfaces.LocalOnlyContextFactory
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
	... 37 more
ERROR 18-09 23:11:43,868 (AbstractController.java:incrementState:440)  -Error installing to Start: name=TransactionManagerInitializer state=Create
javax.naming.NoInitialContextException: Cannot instantiate class: 
							org.jnp.interfaces.LocalOnlyContextFactory [Root exception is java.lang.ClassNotFoundException: 
							org.jnp.interfaces.LocalOnlyContextFactory]
	at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
	at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
	at javax.naming.InitialContext.init(Unknown Source)
	at javax.naming.InitialContext.(Unknown Source)
	at org.jboss.tm.TransactionManagerInitializer.start(TransactionManagerInitializer.java:108)
	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.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:55)
	at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:107)
	at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
	at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:75)
	at org.jboss.kernel.plugins.dependency.LifecycleAction.installAction(LifecycleAction.java:115)
	at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.install(KernelControllerContextAction.java:100)
	at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
	at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:226)
	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:709)
	at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:429)
	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:538)
	at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:472)
	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:274)
	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:177)
	at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:291)
	at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:261)
	at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:117)
	at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.deploy(BeanXMLDeployer.java:95)
	at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3StandaloneBootstrap.java:373)
	at com.ehelper.ejb.formsetting.EmbeddedJBossEJB3TestCaseHelper.startupEmbeddedJboss(EmbeddedJBossEJB3TestCaseHelper.java:113)
	at com.ehelper.ejb.formsetting.EmbeddedJBossEJB3TestCaseHelper$1.setUp(EmbeddedJBossEJB3TestCaseHelper.java:88)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:18)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.extensions.TestSetup.run(TestSetup.java:23)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.ClassNotFoundException: 
							org.jnp.interfaces.LocalOnlyContextFactory
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
	... 36 more
FATAL 18-09 23:11:43,946 (Log4JLogger.java:fatal:129)  -Failure during bootstrap of Embedded JBoss
java.lang.RuntimeException: java.lang.IllegalArgumentException: Null name
	at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3StandaloneBootstrap.java:386)
	at com.ehelper.ejb.formsetting.EmbeddedJBossEJB3TestCaseHelper.startupEmbeddedJboss(EmbeddedJBossEJB3TestCaseHelper.java:113)
	at com.ehelper.ejb.formsetting.EmbeddedJBossEJB3TestCaseHelper$1.setUp(EmbeddedJBossEJB3TestCaseHelper.java:88)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:18)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.extensions.TestSetup.run(TestSetup.java:23)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.IllegalArgumentException: Null name
	at org.jboss.dependency.plugins.AbstractController.getContext(AbstractController.java:114)
	at org.jboss.kernel.plugins.dependency.AbstractKernelController.getContext(AbstractKernelController.java:94)
	at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.internalValidate(AbstractKernelDeployer.java:229)
	at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.validate(AbstractKernelDeployer.java:161)
	at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3StandaloneBootstrap.java:374)
	... 8 more

Here is my code:

  | import javax.persistence.EntityManager;
  | import javax.transaction.TransactionManager;
  | import junit.framework.Test;
  | import junit.framework.TestCase;
  | import com.ehelper.ejb.formsetting.EmbeddedJBossEJB3TestCaseHelper;
  | 
  | public class EmbeddedEjb3TestCase extends TestCase {
  | 
  | 	public static Test suite() throws Exception {
  | 		return EmbeddedJBossEJB3TestCaseHelper
  | 				.embeddedEjb3TestSuite(EmbeddedEjb3TestCase.class);
  | 	}
  | 
  | 	public void testEntityManager() throws Exception {
  | 		System.out.println("testEntityManager");
  | 		EntityManager em = (EntityManager) EmbeddedJBossEJB3TestCaseHelper.getInitialContext().lookup(
  | 				"java:/EntityManagers/custdb");
  | 		assertNotNull(em);
  | 
  | 		// Obtain JBoss transaction
  | 		TransactionManager tm = (TransactionManager) EmbeddedJBossEJB3TestCaseHelper.getInitialContext()
  | 				.lookup("java:/TransactionManager");
  | 
  | 		tm.begin();
  | 
  | 		Customer cust = new Customer();
  | 		cust.setName("Bill");
  | 		em.persist(cust);
  | 
  | 		assertTrue(cust.getId() > 0);
  | 
  | 		int id = cust.getId();
  | 
  | 		System.out.println("created bill in DB with id: " + id);
  | 
  | 		tm.commit();
  | 
  | 		tm.begin();
  | 		cust = em.find(Customer.class, id);
  | 		assertNotNull(cust);
  | 		tm.commit();
  | 	}
  | 
  | }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3972463#3972463

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3972463



More information about the jboss-user mailing list