on 05-17-2006 3:06 PM
I am trying to call a method on a remote bean, but I am getting a RemoteException: com.sap.engine.services.ejb.exceptions.BaseRemoteException: Exception in method someValue.
public class TestDebtorBol extends TestCase {
DebtorProcessorHome debProcHome;
public void testDebtorsSomeValue() {
try {
Context ctx = null;
Properties props = new Properties();
props.put
Context.PROVIDER_URL, "sapserver:50004");
props.put(
Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
ctx = new InitialContext(props);
debProcHome =
(DebtorProcessorHome)
PortableRemoteObject.narrow(ctx.lookup(
"onguard.com/OnGuardApplication/DebtorProcessorBean"), DebtorProcessorHome.class);
DebtorProcessor debProc = debProcHome.create();
assertEquals("Hi there!", debProc.someValue());
} catch (NamingException e) {
fail("NamingException: " + e.getMessage());
} catch (CreateException e) {
fail("CreateException: " + e.getMessage());
} catch (RemoteException e) {
fail("RemoteException: " + e.getMessage());
}
}
}
The method someValue simply returns a string:
public String someValue() {
// return "Hi there!";
return new String("Hi there!");
}
What is wrong??
Hi Jan,
Post complete stacktrace please.
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Voilá. I cannot make sense of it...
junit.framework.AssertionFailedError: RemoteException: com.sap.engine.services.ejb.exceptions.BaseRemoteException: Exception in method someValue.
at com.onguard.DebtorProcessorObjectImpl10.someValue(DebtorProcessorObjectImpl10.java:312)
at com.onguard.DebtorProcessorObjectImpl10p4_Skel.dispatch(DebtorProcessorObjectImpl10p4_Skel.java:78)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:304)
at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:193)
at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:122)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Caused by: com.sap.engine.services.ejb.exceptions.BaseRuntimeException: Cannot create an instance of the stateless bean.
at com.sap.engine.services.ejb.session.stateless_sp5.BeanFactory.getActiveBean(BeanFactory.java:192)
at com.sap.engine.services.ejb.session.stateless_sp5.StatelessContainerFP.getActiveBean(StatelessContainerFP.java:183)
at com.onguard.DebtorProcessorObjectImpl10.someValue(DebtorProcessorObjectImpl10.java:305)
... 10 more
Caused by: javax.ejb.CreateException: Path to object does not exist at java::comp, the whole lookup name is java::comp/env/OnGuard/DebtorBean.
at com.onguard.DebtorProcessorBean.ejbCreate(DebtorProcessorBean.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sap.engine.services.ejb.session.stateless_sp5.BeanFactory.createObject(BeanFactory.java:113)
at com.sap.engine.services.ejb.util.pool.ContainerPoolImpl.doResizeOneStepUp(ContainerPoolImpl.java:374)
at com.sap.engine.services.ejb.util.pool.ContainerPoolImpl.ensureNotEmpty(ContainerPoolImpl.java:343)
at com.sap.engine.services.ejb.util.pool.ContainerPoolImpl.pop(ContainerPoolImpl.java:291)
at com.sap.engine.services.ejb.session.stateless_sp5.BeanFactory.getActiveBean(BeanFactory.java:188)
... 12 more
; nested exception is:
java.lang.RuntimeException: com.sap.engine.services.ejb.exceptions.BaseRuntimeException: Cannot create an instance of the stateless bean.
at com.sap.engine.services.ejb.session.stateless_sp5.BeanFactory.getActiveBean(BeanFactory.java:192)
at com.sap.engine.services.ejb.session.stateless_sp5.StatelessContainerFP.getActiveBean(StatelessContainerFP.java:183)
at com.onguard.DebtorProcessorObjectImpl10.someValue(DebtorProcessorObjectImpl10.java:305)
at com.onguard.DebtorProcessorObjectImpl10p4_Skel.dispatch(DebtorProcessorObjectImpl10p4_Skel.java:78)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:304)
at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:193)
at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:122)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Caused by: javax.ejb.CreateException: Path to object does not exist at java::comp, the whole lookup name is java::comp/env/OnGuard/DebtorBean.
at com.onguard.DebtorProcessorBean.ejbCreate(DebtorProcessorBean.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sap.engine.services.ejb.session.stateless_sp5.BeanFactory.createObject(BeanFactory.java:113)
at com.sap.engine.services.ejb.util.pool.ContainerPoolImpl.doResizeOneStepUp(ContainerPoolImpl.java:374)
at com.sap.engine.services.ejb.util.pool.ContainerPoolImpl.ensureNotEmpty(ContainerPoolImpl.java:343)
at com.sap.engine.services.ejb.util.pool.ContainerPoolImpl.pop(ContainerPoolImpl.java:291)
at com.sap.engine.services.ejb.session.stateless_sp5.BeanFactory.getActiveBean(BeanFactory.java:188)
... 12 more
at junit.framework.Assert.fail(Assert.java:47)
at TestDebtorBol.testDebtorsSomeValue(TestDebtorBol.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)
public void ejbCreate() throws CreateException {
/* lookup Data Access Layer Class */
try {
Context ctx = new InitialContext();
debHome =
(DebtorLocalHome) ctx.lookup(
"java::comp/env/OnGuard/DebtorBean");
} catch (NamingException e) {
throw new CreateException(e.getMessage());
}
}
Now I'm seeing a double colon... might be the problem...???
But then I'd expected a CreateException.
Hi Jan,
1) Bean`s environment is stored in within JNDI-ENC "java:com/env" (directly or in its subcontexts)
2) Seems like you are using stateless session bean. So, in your case create method of home interface doesn`t cause direct creation of bean instance (and call of newInstance, setSessionContext and ejbCreate methods) despite of getting refernce to component interface.
Best regards, Maksim Rashchynski.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.