Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

EJBs cannot return null when used in Model?

Hi,

hopefully this question is in the right place.

I´ve spent now a few days on tracking a single problem. I am trying to create an web dynpro application with the functionality contained in EJBs. One of my methods in a stateless SessionBean returns an object or null. This SessionBean is bound via model binding to the context of a component controller. Everything works fine as along as the method call returns an object, but if it does not (which is the usual case) the application throws an empty exception without any description. Thanks to this forum i checked the defaultTrace log and found this information:

[EXCEPTION]
 {0}#1#java.lang.NullPointerException
	at com.sap.tc.webdynpro.model.ejb.model.EJBGenericModelClassExecutable.setPropertiesForModelClass(EJBGenericModelClassExecutable.java:429)
	at com.sap.tc.webdynpro.model.ejb.model.EJBGenericModelClassExecutable.fillReturnParameterToMc(EJBGenericModelClassExecutable.java:634)
	at com.sap.tc.webdynpro.model.ejb.model.EJBGenericModelClassExecutable.execute(EJBGenericModelClassExecutable.java:135)
	at com.test.testprog.testprogwebdynpro.main.Main.doLogin(Main.java:243)
	at com.test.testprog.testprogwebdynpro.main.wdp.InternalMain.doLogin(InternalMain.java:213)
	at com.test.testprog.testprogwebdynpro.main.LoginView.onActionButtonEinloggen(LoginView.java:189)
	at com.test.testprog.testprogwebdynpro.main.wdp.InternalLoginView.wdInvokeEventHandler(InternalLoginView.java:139)
	at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:131)
	at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:72)
	at com.sap.tc.webdynpro.clientserver.phases.ProcessingEventPhase.doHandleActionEvent(ProcessingEventPhase.java:156)
	at com.sap.tc.webdynpro.clientserver.phases.ProcessingEventPhase.execute(ProcessingEventPhase.java:91)
	at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequestPartly(WindowPhaseModel.java:161)
	at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doProcessRequest(WindowPhaseModel.java:109)
	at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:96)
	at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:469)
	at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:52)
	at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.doExecute(ClientApplication.java:1431)
	at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.doProcessing(ClientApplication.java:1251)
	at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.delegateToApplicationDoProcessing(AbstractExecutionContextDispatcher.java:158)
	at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.DispatchHandlerForAppProcessing.doService(DispatchHandlerForAppProcessing.java:35)
	at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.AbstractDispatchHandler.service(AbstractDispatchHandler.java:116)
	at com.sap.engine.services.servlets_jsp.server.deploy.impl.module.IRequestDispatcherImpl.dispatch(IRequestDispatcherImpl.java:93)
	at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.ExecutionContextDispatcher.dispatchToApplicationDoProcessing(ExecutionContextDispatcher.java:114)
	at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.dispatch(AbstractExecutionContextDispatcher.java:81)
	at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.dispatch(ApplicationSession.java:507)
	at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.dispatch(ApplicationSession.java:527)
	at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doApplicationProcessingStandalone(ApplicationSession.java:458)
	at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:249)
	at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:699)
	at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:231)
	at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:231)
	at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.delegateToRequestManager(AbstractExecutionContextDispatcher.java:205)
	at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.DispatchHandlerForRequestManager.doService(DispatchHandlerForRequestManager.java:38)
	at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.AbstractDispatchHandler.service(AbstractDispatchHandler.java:116)
	at com.sap.engine.services.servlets_jsp.server.deploy.impl.module.IRequestDispatcherImpl.dispatch(IRequestDispatcherImpl.java:93)
	at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.ExecutionContextDispatcher.dispatchToRequestManager(ExecutionContextDispatcher.java:140)
	at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.dispatch(AbstractExecutionContextDispatcher.java:93)
	at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.dispatch(AbstractExecutionContextDispatcher.java:105)
	at com.sap.tc.webdynpro.serverimpl.core.AbstractDispatcherServlet.doContent(AbstractDispatcherServlet.java:87)
	at com.sap.tc.webdynpro.serverimpl.core.AbstractDispatcherServlet.doPost(AbstractDispatcherServlet.java:61)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:66)
	at com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:32)
	at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:431)
	at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:289)
	at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
	at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:376)
	at com.sap.engine.services.servlets_jsp.filters.ServletSelector.process(ServletSelector.java:85)
	at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
	at com.sap.engine.services.servlets_jsp.filters.ApplicationSelector.process(ApplicationSelector.java:160)
	at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
	at com.sap.engine.services.httpserver.filters.WebContainerInvoker.process(WebContainerInvoker.java:67)
	at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
	at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
	at com.sap.engine.services.httpserver.filters.ResponseLogWriter.process(ResponseLogWriter.java:60)
	at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
	at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
	at com.sap.engine.services.httpserver.filters.DefineHostFilter.process(DefineHostFilter.java:27)
	at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
	at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
	at com.sap.engine.services.httpserver.filters.MonitoringFilter.process(MonitoringFilter.java:29)
	at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
	at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:71)
	at com.sap.engine.services.httpserver.server.Processor.chainedRequest(Processor.java:309)
	at com.sap.engine.services.httpserver.server.Processor$FCAProcessorThread.run(Processor.java:222)
	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:152)
	at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:247)

The request has the cardinality 1..1, the response 0..1 and the return value 1..1. The last one cannot be changed.

Is that correct that an EJB method call must return an valid object or do i have to change something in order to allow the return of null? Or is this a bug?

Thanks for any answer in advance

Not what you were looking for? View more on this topic or Ask a question