junit - No EJBContainer provider available: no provider names had been found -
i'm getting following exception on running test case, service class.
javax.ejb.ejbexception: no ejbcontainer provider available: no provider names had been found. @ javax.ejb.embeddable.ejbcontainer.reporterror(ejbcontainer.java:216) @ javax.ejb.embeddable.ejbcontainer.createejbcontainer(ejbcontainer.java:146) @ javax.ejb.embeddable.ejbcontainer.createejbcontainer(ejbcontainer.java:102) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.junit.runners.model.frameworkmethod$1.runreflectivecall(frameworkmethod.java:47) @ org.junit.internal.runners.model.reflectivecallable.run(reflectivecallable.java:12) @ org.junit.runners.model.frameworkmethod.invokeexplosively(frameworkmethod.java:44) @ org.junit.internal.runners.statements.runbefores.evaluate(runbefores.java:24) @ org.junit.internal.runners.statements.runafters.evaluate(runafters.java:27) @ org.junit.runners.parentrunner.run(parentrunner.java:309) @ org.eclipse.jdt.internal.junit4.runner.junit4testreference.run(junit4testreference.java:50) @ org.eclipse.jdt.internal.junit.runner.testexecution.run(testexecution.java:38) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:467) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:683) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.run(remotetestrunner.java:390) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.main(remotetestrunner.java:197)
code:
public class nativeservicetest { static nativeservice nativeservice; private static context ctx; private static ejbcontainer ejbcontainer; @beforeclass public static void setupbeforeclass() throws exception { ejbcontainer = ejbcontainer.createejbcontainer(); ctx = ejbcontainer.getcontext(); } @afterclass public static void teardownafterclass() throws exception { ejbcontainer.close(); } @test public void testgetcustomservice() throws namingexception { gson gson= new gson(); string id = ""; nativeservice converter = (nativeservice) ctx.lookup("java:global/classes/nativeservice"); assertnotnull(converter); gson.fromjson(nativeservice.getcustomservice(id), portlet.class); } }
nativeservice.java
public class nativeservice { @ejb dataservice dataservice; // // }
i'm using jta-data-source
transaction.
Comments
Post a Comment