cancel
Showing results for 
Search instead for 
Did you mean: 

RemoteException

Former Member
0 Kudos

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??

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

Hi Jan,

Post complete stacktrace please.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

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)

former_member182372
Active Contributor
0 Kudos

Hi Jan,

Post please DebtorProcessorBean.ejbCreate implementation.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

	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.

Former Member
0 Kudos

Your question pointed me in the right direction!

I commented all lines in ejbCreate, and now the test is running fine...!!

So I have to repair that create method.

This is confusing. Why did the error occur on the someValue method and not on previous line - the creation of the object?

former_member182372
Active Contributor
0 Kudos

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.