Calling EJB method
Hi All,
I have never worked with EJBs so I am kind of stuck with one problem.
I have to make use of one existing EJB project through my external standard java class. The existing EJB project makes use of some other packages which are also EJB projects and I am not allowed to change any functionality of the EJB project but to use them as it is.
I am just initilizing the class object of the EJB project and calling its method. Within the EJB project there is a method which is calling another method of another EJB class.
The problem is that I dont see this other EJB class object getting initilized first and then calling its method as it happens in a normal scenario, hence when that method gets called i get a null pointer execption.
Let me give you some idea by posting some code snippet.
@WebService(targetNamespace = "http://www.ttt.de/ota")
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.BARE)
// standard EJB3 annotations
@Local(AMSAgencyWSPortType.class)
@Stateless
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
// jboss propriatary annotations
@WebContext(transportGuarantee = "NONE", secureWSDLAccess = false)
public class AMSProfileServiceBean extends AbstractProfileBuilder implements AMSAgencyWSPortType
private static Log log = LogFactory.getLog(AMSMappingServiceBean.class);
@EJB(mappedName = "PotsdamProfileService/local")
private PotsdamProfileService profileService;
private Security security;
@EJB
private OTAProfileBuilder otaProfileBuilder;
@Override
public OTATTProfileReadRS otaTTReadRQ(Holder<Security> wsseHeader, OTATTReadRQ request)
security = wsseHeader.value;
BigDecimal requestVersion = request.getVersion();
OTATTProfileReadRS otaProfileReadRS = new OTATTProfileReadRS();
otaProfileReadRS.setVersion(requestVersion);
PotsdamInstanceKey profileIntanceKey;
try
profileIntanceKey = getKeyHandler(requestVersion).buildUserKey(wsseHeader);
PotsdamInstance userInstance = loadProfileFromPotsdam(profileIntanceKey);
private PotsdamInstance loadProfileFromPotsdam(PotsdamInstanceKey userCredentials) throws PotsdamException
PotsdamInstance potsdamInstance = null;
try{
Holder<com.ttt.potsdam.common.messages.Security> wsseHeader = buildWsseHeader(security);
ProfileResponse potsdamInstanceRS = profileService.loadProfile(wsseHeader, userCredentials);
...I get an error message before the sequence reaches loadProfile(..), which in my sense is due to the fact that 'profileService' never was initilized in the EJB project.
profileService is object of another EJB project, which looks somethign like this:
@Stateless
@LocalBinding(jndiBinding = "PotsdamProfileService/local")
// jboss 4.2
@org.jboss.annotation.ejb.LocalBinding(jndiBinding = "PotsdamProfileService/local")
public class PotsdamProfileServiceBean implements PotsdamProfileService {
private static Log log = LogFactory.getLog(PotsdamProfileServiceBean.class);
@EJB
private CacheProfileService cacheProfileService;
@EJB(mappedName = "/PersistenceUnitsManagerBean/local")
private PersistenceUnitsManager persistenceUnitsManager;
@EJB
private PotsdamService potsdamService;
public ProfileResponse loadProfile(Holder<Security> wsseHeader,
PotsdamInstanceKey cacheInstanceKey) {
log.debug("inside loadProfile");
...Now I am calling the main EJB like this:
PotsdamotaTTReadRQ();
public OTATTProfileReadRS PotsdamotaTTReadRQ()
AMSProfileServiceBean a = new AMSProfileServiceBean();
Holder<Security> wsseHeader = new Holder<Security>();
OTATTProfileReadRS response = a.otaTTReadRQ(wsseHeader, request);
return response;
}So my confusion is how can I make use of profileService.loadProfile(wsseHeader, userCredentials); ??
I tried to initilize: PotsdamProfileServiceBean profileService = new PotsdamProfileServiceBean();but I get jndi binding and lots of other exception.
Please help.
Edited by: 925515 on 04.07.2012 06:40
Thanks for your pointer. Could you please help me out with a small code snippet example?
I want to make use of this existing bean (AMSProfileServiceBean ):
@WebService(targetNamespace = "http://www.ttt.de/ota")
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.BARE)
// standard EJB3 annotations
@Local(AMSAgencyWSPortType.class)
@Stateless
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
// jboss propriatary annotations
@WebContext(transportGuarantee = "NONE", secureWSDLAccess = false)
public class AMSProfileServiceBean extends AbstractProfileBuilder implements AMSAgencyWSPortType
private static Log log = LogFactory.getLog(AMSMappingServiceBean.class);
@EJB(mappedName = "PotsdamProfileService/local")
private PotsdamProfileService profileService;
private Security security;
@EJB
private OTAProfileBuilder otaProfileBuilder;
@EJB
private OTAProfileUpdater otaProfileUpdater;
@Override
public OTATTProfileReadRS otaTTReadRQ(Holder<Security> wsseHeader, OTATTReadRQ request)
...in my soap-connector :
@WebServiceProvider(wsdlLocation = "WEB-INF/wsdl/PotsdamAMSAgencyWS.wsdl", targetNamespace = "http://www.ttt.de/ota", serviceName = "PotsdamAMSAgencyWS", portName = "PotsdamAMSAgencyWSPortType")
@ServiceMode(value = Service.Mode.MESSAGE)
public class PotsdamAgencyWSProvider extends WSProvider implements Provider<SOAPMessage>
@Resource
WebServiceContext wsCtx;
...A small example would be really appreciated.
Thanks.
Similar Messages
-
Urgent - calling EJB methods from thread
Dear all
I am aware of EJB spec that does not permit developer managed threads within EJB components. However, I need to call EJB methods from my own thread. Hence, it there any way to to call EJB methods from developer managed thread ?? If yes, please advice me, thanks in advance and your help will be appriciated.
Hava a nice dayYou can call EJB's from your threads. Your thread will act as the client and the call will to EJB will be same as any other client invoking EJB's. Hope I understand your question !.
-
Webflow InputProcessor calling EJBs, how bad is it?
Hi,
Portal 7 docs say:
"Input Processors should not call Enterprise JavaBeans (EJBs)
or attempt to access a database. All such logic should be implemented in Pipeline
Components."
Well, I'm building some presentation logic inside an IP. That logic requires
access to User Profile and Rules EJBs. There is no business logic what so ever,
it is just that my presentation logic depends on user and rule info which requires
EJB calls.
Am I doing something wrong? Am I violating BEA's guidelines?Anon,
Am I violating BEA's guidelines?It is just a guideline when edocs says to invoke EJBs and JDBC only from pipelines.
It is not a hard rule. As you point out, there are some good use cases for putting
such code into IPs.
There is a philosophical reason for this guideline. Code that interacts with your
persistance layer/business logic will most often need to be reused in other parts
of your system. Piplines are designed to be built of smaller reusable chunks of
code (PipelineComponents), whereas Inputprocessors are intended to be write once/use
once pieces of code that are tied directly to the presentation format.
There is a sound technical reason for this guideline as well. Consider a case
in which your IP makes 3 EJB calls and 2 database queries. Unless you manually
create an encompassing transaction, your 5 operations will not be ACID, and in
the worst case will have the performance penalty of creating and committing 5
separate transactions. A pipeline can be made transactional, which eliminates
this issue. If your IP is calling EJB methods that don't require a transaction,
then you should be okay.
Hope this helps,
PJL
"MAD" <[email protected]> wrote:
>
Hi,
Portal 7 docs say:
"Input Processors should not call Enterprise JavaBeans (EJBs)
or attempt to access a database. All such logic should be implemented
in Pipeline
Components."
Well, I'm building some presentation logic inside an IP. That logic
requires
access to User Profile and Rules EJBs. There is no business logic what
so ever,
it is just that my presentation logic depends on user and rule info which
requires
EJB calls.
Am I doing something wrong? Am I violating BEA's guidelines? -
Human Task Events's Validation Callback Errored out while using EJB method
Hi All,
We are using weblogic version 10.3.5. and Jdev 11.1.1.5.0
In our BPM Process we have human tasks,in human task Events,we are using Validation Callback to save and get some information.To save and get information we are ejb.
1)We have created one BaseTaskValidator.java which implements ITaskValidationCallback.
2)we have override the validateTaskOperation() method in BaseTaskValidator.java
3)We have created one more TaskReminderService.java extends BaseTaskValidator
4)In TaskReminderService.java,when we trying to get information from Database with help of EJB we are getting the below error.
[2012-10-14T21:05:47.610+05:30] [soa_server1] [ERROR] [] [oracle.soa.services.workflow.task] [tid: [ACTIVE].ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: Amar.Kant] [ecid: 1416ca41dee3590b:5c59d6e4:13a59f6159b:-8000-0000000000021e0b,0] [APP: soa-infra] [composite_name: ARCN] [component_name: CNRequestTask] [component_instance_id: 204583] [composite_instance_id: 1470009] <.> Error in invoking task validation callbacks.[[
Error in invoking task validation Java callback com.atc.arcn.callbacks.BaseTaskValidator.performCallbacks for task 204583. The task is associated with workflow default/ARCN!1.0/CNRequestTask.
Make sure that the task validation callback class is specified correctly without any errors. The class name should be fully qualified. Also make sure that the class and its dependencies are available in the classpath.
ORABPEL-30099
Error in invoking task validation callbacks.
Error in invoking task validation Java callback com.atc.arcn.callbacks.BaseTaskValidator.performCallbacks for task 204583. The task is associated with workflow default/ARCN!1.0/CNRequestTask.
Make sure that the task validation callback class is specified correctly without any errors. The class name should be fully qualified. Also make sure that the class and its dependencies are available in the classpath.
at oracle.bpel.services.workflow.task.impl.TaskValidationCallbackInvoker.executeJavaCallback(TaskValidationCallbackInvoker.java:195)
at oracle.bpel.services.workflow.task.impl.TaskValidationCallbackInvoker.performCallbacks(TaskValidationCallbackInvoker.java:104)
at oracle.bpel.services.workflow.task.impl.TaskService.initiateTask(TaskService.java:1190)
at oracle.bpel.services.workflow.task.impl.TaskService.initiateTask(TaskService.java:666)
at oracle.bpel.services.workflow.task.impl.TaskService.initiateTask(TaskService.java:614)
at sun.reflect.GeneratedMethodAccessor4268.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at oracle.bpel.services.workflow.common.WorkflowServiceCacheEventAdvice.invoke(WorkflowServiceCacheEventAdvice.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at oracle.bpel.services.workflow.test.workflow.ExceptionTestCaseBuilder.invoke(ExceptionTestCaseBuilder.java:155)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at oracle.bpel.services.common.dms.MethodEventAspect.invoke(MethodEventAspect.java:70)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at oracle.bpel.services.common.dms.MethodPhaseEventAspect.invoke(MethodPhaseEventAspect.java:82)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy250.initiateTask(Unknown Source)
at oracle.bpel.services.workflow.task.ejb.TaskServiceBean.initiateTask(TaskServiceBean.java:70)
at sun.reflect.GeneratedMethodAccessor4267.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy280.createProcessInstanceTask(Unknown Source)
at oracle.bpm.services.instancemanagement.ejb.InstanceManagementServiceBean_sqa2w0_IInstanceManagementServiceRemoteImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
at oracle.bpm.services.instancemanagement.ejb.InstanceManagementServiceBean_sqa2w0_IInstanceManagementServiceRemoteImpl.createProcessInstanceTask(Unknown Source)
at oracle.bpm.services.instancemanagement.ejb.InstanceManagementServiceBean_sqa2w0_IInstanceManagementServiceRemoteImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:345)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
at oracle.bpm.services.instancemanagement.ejb.InstanceManagementServiceBean_sqa2w0_IInstanceManagementServiceRemoteImpl_1035_WLStub.createProcessInstanceTask(Unknown Source)
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:597)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:85)
at $Proxy404.createProcessInstanceTask(Unknown Source)
at oracle.bpm.papi.ora.util.ApplicationExecution11G.beginExecution(ApplicationExecution11G.java:50)
at fuego.papi.utils.ApplicationExecution.beginExecution(ApplicationExecution.java:29)
at oracle.bpm.workspace.model.common.ExecutionBean.handleExternalInstanceExecution(ExecutionBean.java:171)
at oracle.bpm.workspace.model.application.ApplicationBean.execute(ApplicationBean.java:148)
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:597)
at com.sun.el.parser.AstValue.invoke(Unknown Source)
at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
at org.apache.myfaces.trinidad.component.UIXCollection.broadcast(UIXCollection.java:148)
at org.apache.myfaces.trinidad.component.UIXTable.broadcast(UIXTable.java:279)
at oracle.adf.view.rich.component.UIXTable.broadcast(UIXTable.java:145)
at oracle.adf.view.rich.component.rich.data.RichTable.broadcast(RichTable.java:402)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:902)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:313)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:186)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.help.web.rich.OHWFilter.doFilter(Unknown Source)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:175)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.lang.reflect.InvocationTargetException
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:597)
at oracle.bpel.services.workflow.task.impl.TaskValidationCallbackInvoker.executeJavaCallback(TaskValidationCallbackInvoker.java:191)
... 344 more
Caused by: java.lang.NullPointerException
at com.atc.arcn.util.TaskReminderService.getTaskDetails(TaskReminderService.java:72)
at com.atc.arcn.util.TaskReminderService.setReminderDuration(TaskReminderService.java:64)
at com.atc.arcn.util.TaskReminderService.setReminderDuration(TaskReminderService.java:56)
at com.atc.arcn.callbacks.BaseTaskValidator.processInitiate(BaseTaskValidator.java:96)
at com.atc.arcn.callbacks.BaseTaskValidator.validateTaskOperation(BaseTaskValidator.java:52)
... 349 more
Please help on this issue.It is little bit urgent for us to resolve.
Thanks in advanced.Thanks for reply Ravi.
The NullPointerException is beacuse of JNDI problem,we resolved that issue.We are able to create the ejb instance but with that instance when we are trying to call ejb method,we are getting the below error in console and the BPM instance is not getting created.
We are able to create the instance of the EJB Bean.But when we try to call the method of EJB Bean(getTaskDetailsByTaskName(taskName)),the BPM instance is not getting created from BPM workspace.If we comment the code for the method of EJB Bean(getTaskDetailsByTaskName(taskName)) able to create the instance from BPM workspace.When we checked the log file this error,it is
Caused by: fuego.papi.exception.CannotCreateInstanceException: Cannot create instance in process 'default/ARCN!1.0*/ARCN'.
at oracle.bpm.papi.ora.helper.ExceptionHelper.wrapException(ExceptionHelper.java:58)
at oracle.bpm.papi.ora.util.ApplicationExecution11G.beginExecution(ApplicationExecution11G.java:56)
at fuego.papi.utils.ApplicationExecution.beginExecution(ApplicationExecution.java:29)
at oracle.bpm.workspace.model.common.ExecutionBean.handleExternalInstanceExecution(ExecutionBean.java:171)
... 102 more
Caused by: BPM-70204
Exception
exception.70204.type: error
exception.70204.severity: 2
exception.70204.name: Error creating process instance.
exception.70204.description: Error creating instance for target process default/ARCN!1.0*/ARCN.
exception.70204.fix: Verify server log to find the problem cause.
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:205)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:345)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
at oracle.bpm.services.instancemanagement.ejb.InstanceManagementServiceBean_sqa2w0_IInstanceManagementServiceRemoteImpl_1035_WLStub.createProcessInstanceTask(Unknown Source)
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:597)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:85)
at $Proxy407.createProcessInstanceTask(Unknown Source)
at oracle.bpm.papi.ora.util.ApplicationExecution11G.beginExecution(ApplicationExecution11G.java:50)
... 104 more
Could you please suggest me on this issue.
Thanks,
Narasimha -
Error while calling a method on Bean (EJB 3.0)
I am getting an error while calling a method on EJB. I am using EJB3.0 and my bean is getting properly deployed(i am sure b'cos i can see the successfullly deployed message). Can any body help me
Error is -->
Error while destroying resource :An I/O error has occured while flushing the output - Exception: java.io.IOException: An established connection was aborted by the software in your host machine
Stack Trace:
java.io.IOException: An established connection was aborted by the software in your host machine
at sun.nio.ch.SocketDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:33)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)
at sun.nio.ch.IOUtil.write(IOUtil.java:75)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:302)
at com.sun.enterprise.server.ss.provider.ASOutputStream.write(ASOutputStream.java:138)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at org.postgresql.PG_Stream.flush(PG_Stream.java:352)
at org.postgresql.core.QueryExecutor.sendQuery(QueryExecutor.java:159)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:70)
at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:482)
at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:461)
at org.postgresql.jdbc1.AbstractJdbc1Connection.rollback(AbstractJdbc1Connection.java:1031)
at org.postgresql.jdbc2.optional.PooledConnectionImpl$ConnectionHandler.invoke(PooledConnectionImpl.java:223)
at $Proxy34.close(Unknown Source)
at com.sun.gjc.spi.ManagedConnection.destroy(ManagedConnection.java:274)
at com.sun.enterprise.resource.LocalTxConnectorAllocator.destroyResource(LocalTxConnectorAllocator.java:103)
at com.sun.enterprise.resource.AbstractResourcePool.destroyResource(AbstractResourcePool.java:603)
at com.sun.enterprise.resource.AbstractResourcePool.resourceErrorOccurred(AbstractResourcePool.java:713)
at com.sun.enterprise.resource.PoolManagerImpl.putbackResourceToPool(PoolManagerImpl.java:424)
at com.sun.enterprise.resource.PoolManagerImpl.resourceClosed(PoolManagerImpl.java:393)
at com.sun.enterprise.resource.LocalTxConnectionEventListener.connectionClosed(LocalTxConnectionEventListener.java:69)
at com.sun.gjc.spi.ManagedConnection.connectionClosed(ManagedConnection.java:618)
at com.sun.gjc.spi.ConnectionHolder.close(ConnectionHolder.java:163)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.closeDatasourceConnection(DatabaseAccessor.java:379)
at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.closeConnection(DatasourceAccessor.java:367)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.closeConnection(DatabaseAccessor.java:402)
at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.afterJTSTransaction(DatasourceAccessor.java:100)
at oracle.toplink.essentials.threetier.ClientSession.afterTransaction(ClientSession.java:104)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.afterTransaction(UnitOfWorkImpl.java:1816)
at oracle.toplink.essentials.transaction.AbstractSynchronizationListener.afterCompletion(AbstractSynchronizationListener.java:161)
at oracle.toplink.essentials.transaction.JTASynchronizationListener.afterCompletion(JTASynchronizationListener.java:87)
at com.sun.ejb.containers.ContainerSynchronization.afterCompletion(ContainerSynchronization.java:174)
at com.sun.enterprise.distributedtx.J2EETransaction.commit(J2EETransaction.java:467)
at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:357)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3653)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:197)
at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:110)
at $Proxy84.addDepartment(Unknown Source)
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:585)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:650)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:193)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1705)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1565)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:947)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:178)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:717)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:473)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1270)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:479)
End of Stack Trace
|#]
RAR5035:Unexpected exception while destroying resource. To get exception stack, please change log level to FINE.
EJB5018: An exception was thrown during an ejb invocation on [DepartmentSessionBean]
javax.ejb.EJBException: Unable to complete container-managed transaction.; nested exception is: javax.transaction.SystemException
javax.transaction.SystemException
at com.sun.enterprise.distributedtx.J2EETransaction.commit(J2EETransaction.java:452)
at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:357)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3653)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:197)
at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:110)
at $Proxy84.addDepartment(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)Means theres an error in XML/ABAP conversion probably due a syntax error...
Regards
Juan -
How to call a EJB method from Session bean method
Hi all,
I'm new to J2EE programming. I have a simple doubt .
I have already created a lookup method for EJB bean in Session bean .
My question is how to call a method of an ENTITY bean (say insertRow) from SESSION bean method(Say invoke_insertRow) .
Please provide me an example code .
Thanks in advance.InitialContext ctx = new InitialContext();
GeneralEditor editor = (GeneralEditor) ctx
.lookup("GeneralEditorBean/remote");
GeneralService service = (GeneralService) ctx
.lookup("GeneralServiceBean/remote");
LanMu lm = new LanMu();
lm.setName("shdfkhsad");
editor.add(lm); -
Hi
I am getting below error while calling a stateless EJB method. There is some validation checks while performing ejb's modify() method and a RuntimeException is thrown in case of validation failure.The modify() method internally calls other stateless ejb as well.
The problem I'm facing is, instead of getting the expected RuntimeException in the Servlet, i am getting RemoteException. I am using WLS 9 MP1, all participating ejbs are stateless and i am using default transaction attributes(Supports) for these ejbs.
The interesting part is, at the ejb layer RuntimeException is thrown as expected, but this exception changed to RemoteException at the servlet's end where i am catching the ejb call exceptions.
I am new to WLS, please suggest/help me out of this exception.
Any help is truly appreciated.
java.rmi.RemoteException: EJB Exception: ; nested exception is: java.lang.RuntimeException:
at weblogic.ejb.container.internal.EJBRuntimeUtils.throwRemoteException(EJBRuntimeUtils.java:95)
at weblogic.ejb.container.internal.BaseEJBObject.handleSystemException(BaseEJBObject.java:713)
at weblogic.ejb.container.internal.BaseEJBObject.handleSystemException(BaseEJBObject.java:681)
at weblogic.ejb.container.internal.BaseEJBObject.postInvoke1(BaseEJBObject.java:447)
at weblogic.ejb.container.internal.StatelessEJBObject.postInvoke1(StatelessEJBObject.java:72)
at weblogic.ejb.container.internal.BaseEJBObject.postInvokeTxRetry(BaseEJBObject.java:374)
at com.mycomp.base.BaseController_8x2e52_EOImpl.modify(BaseController_8x2e52_EOImpl.java:149)
at com.mycomp.webgui.servlet.FrontComponent.service(FrontComponent.java:207)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:223)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3245)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2003)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1909)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1359)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
Thanks!
Edited by: user10721298 on Feb 23, 2009 4:16 AMHi,
If i don't misunderstand, you are using the RuntimeException as an application exception, right?
Have you annotated it or denoted it in deployment descriptor?
Thanks,
Amy -
Problem calling a method in a servlet witch returns remote ejb
Hi, I have a problem combining servlets ands ejbs, I expose my problem :
What I have :
1 . I have a User table into a SGBD with two attributes login and pass.
2 . I have a UserBean linked to User table with a remote interface
3 . I have a stateless UserSessionBean with a remote interface
4 . I have a UserServlet linked to a jsp page which allows me to add users
5 . I use Jboss
What is working ?
1 - I have a method newUser implemented in my UserSessionBean :
public class UserSessionBean implements SessionBean {
private SessionContext sessionContext;
private UserRemoteHome userRemoteHome;
public void ejbCreate() throws CreateException {
// Initialize UserRemoteHome
// Method to add a new user
public UserRemote newUser(String login, String password) {
UserRemote newUser = null;
try {
newUser = userRemoteHome.create(login, password);
} catch (RemoteException ex) {
System.err.println("Error: " + ex);
} catch (CreateException ex) {
System.err.println("Error: " + ex);
return newUser;
}2 - When I test this method with a simple client it works perfectly :
public class TestEJB {
public static void main(String[] args) {
Context initialCtx;
try {
// Create JNDI context
// Context initialization
// Narrow UserSessionHome
// Create UserSession
UserSession session = sessionHome.create();
// Test create
UserRemote newUser = session.newUser("pierre", "hemici");
if (newUser != null) {
System.out.println(newUser.printMe());
} catch (Exception e) {
System.err.println("Error: " + e);
e.printStackTrace();
Result : I got the newUser printed on STDOUT and I check in the User table (in the SGBD) if the new user has been created.
What I want ?
I want to call the newUser method from the UserServlet and use the RemoteUser returned by the method.
What I do ?
The jsp :
1 - I have a jsp page where a get information about the new user to create
2 - I put the login parameter and the password parameter into the request
3 - I call the UserServlet when the button "add" is pressed on the jsp page.
The Servlet :
1 - I have a method doInsert which call the newUser method :
public class UserServlet extends HttpServlet {
private static final String CONTENT_TYPE = "text/html";
// EJB Context
InitialContext ejbCtx;
// Session bean
UserSession userSession;
public void init() throws ServletException {
try {
// Open JNDI context (the same as TestClient context)
// Get UserSession Home
// Create UserSession
userSession = userSessionHome.create();
} catch (NamingException ex) {
System.out.println("Error: " + ex);
} catch (RemoteException ex) {
System.out.println("Error: " + ex);
} catch (CreateException ex) {
System.out.println("Error: " + ex);
protected void service(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, IOException {
* Does insertion of the new user in the database.
public void doInsert(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, IOException {
try {
// Get parameters to create the newUser
String login = req.getParameter("login");
String password = req.getParameter("password");
// Create the newUser
System.out.println("Calling newUser before");
UserRemote user = userSession.newUser(login, password);
System.out.println("Calling newUser after");
} catch (Exception e) {
// Clean up resources
public void destroy() {
Result :
When I run my jsp page and click on the "add" button, I got the message "Calling newUser before" printed in STDOUT and the error message :
ERROR [[userservlet]] Servlet.service() for servlet userservlet threw exception
javax.servlet.ServletException: loader constraints violated when linking javax/ejb/Handle class
at noumea.user.UserServlet.service(UserServlet.java:112)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:534)
Constat :
I checked into my SGBD and the new user has been created.
The error appears only when the method return Remote ejbs, if I return simples objects (Strings, int..) it works.
What can I do to resolve this problem ?
Thank you."Why do you want to servlet to gain access to another EJB through the stateless session bean. Why cant the servlet call it directly ?"
Because I want to access to the informations included in the entity bean UserBean (which is remote).
You said that it is a bad design, but how can I access to my UserBean ejbs from the session bean if I don't do that ?
For example I want a List of all users to be seen in a jsp page :
1 - I call the method getUserList which returnsan ArrayList of UserRemote.
2 - I iterate over the ArrayList to get the users parameters to be seen.
As the other example (newUser), when I do
ArrayList users = (ArrayList) userSession.getUserList(); with the simple client it works, but in the servlet I got the same error.
But, if I call directly the findAll method (as you'are saying) in the servlet
ArrayList users = (ArrayList) userRemoteHome.findAll(); it works...
I think that if my servlet calls directly entity ejbs, I don't need UserSession bean anymore. Is that right ?
I precise that my design is this :
jsp -> servlet -> session bean -> entity bean -> sgbd
Is that a bad design ? Do I need the session bean anymore ?
Thank you. -
Getting error while calling ejb business methods from servlet
Hi
Iam getting error when i try to call a ejb method from servlet.Error is
"com.netscape.server.eb.UncheckedException: unchecked exception nested exception is:java.lang.NullPointerException".
I build the application and deployed it successfully.Iam using IAS 6.O with windows NT 4.0.
This is just a method which takes values from database and return as an array of bean to servlet.
Any help on this.Thanks ShankHi
I was using the session bean.Your suggestion helped me a lot.Perfect.
I debug my program and found that from ejbCreate()exception is getting.
I was getting the datasource object thro ejb create() initialisation.
Somehow the look up jndi which i mentioned was not interpretting from ejb-jar.xml ias-ejb-jar.xml and datasource ref .Due to this iam getting jndi Namenotfound exception which in turns to null pointer as datasource is getting null.
when i hardcoded in the ejb the the jndi name for datasource it is working fine.Bit worried all the existing ejbs working with the xml referenced datasource and jndi,but when i added a new ejb with same properties it is failing to get the jndi name.
Piece of code from ias-ejb-jar.xml
<resource-ref>
<res-ref-name>myDataSource</res-ref-name>
<jndi-name>jdbc/nb/myData</jndi-name>
</resource-ref>
Piece of code from ejb-jar.xml
<resource-ref>
<res-ref-name>myDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Thanks a lot meka -
EJB 3.1 @Asynchronous and calling other methods from within
Hey all,
I am helping a friend set up a test framework, and I've turned him on to using JEE6 for the task. I am decently familiar with entity beans, session beans, and such. One of the new features is @Asynchronous, allowing a method to be ran on a separate thread. The test framework generally needs to spawn potentially 1000's of threads to simulate multiple users at once. Originally I was doing this using the Executor classes, but I've since learned that for some reason, spawning your own threads within a JEE container is "not allowed" or bad to do. I honestly don't quite know why this is.. from what I've read the main concern is that the container maintains threads and your own threads could mess up the container somehow. I can only guess that this might be possible if your threads use the container services in some way.. but if anyone could enlighten me on the details as to why this is bad, that would be great.
None the less, EJB 3.1 adds the async capability and I am now looking to use this. From my servlet I use @EJB to access the session bean, and call an async method. My servlet returns right away as it should. From the async method I do some work and using an entity bean store results, so I don't need to return a Future object. In fact, my ejb then makes an HttpClient call to another servlet to notify it that the result is ready.
My main question though, is if it's ok to call other methods from the async method that are not declared @Asynchronous. I presume it is ok, as the @Asynchronous just enables the container to spawn a thread to execute that method in. But I can't dig up any limitations on the code within an async method.. whether or not it has restrictions on the container services, is there anything wrong with using HttpClient to make a request from the method.. and making calls to helper methods within the bean that are not async.
Thanks.851827 wrote:
Hey all,.. from what I've read the main concern is that the container maintains threads and your own threads could mess up the container somehow. I can only guess that this might be possible if your threads use the container services in some way.. but if anyone could enlighten me on the details as to why this is bad, that would be great.
Yes since the EE spec delegated thread management to conatiners, the container might assume that some info is available in the thread context that you may not have made available to your threads.
Also threading is a technical implementation detail and the drive with the EE spec is that you should concentrate on business requirements and let the container do the plumbing part.
If you were managing your own threads spawned from EJBs, you'd have to be managing your EJBs' lifecycle as well. This would just add to more plumbing code by the developer and typically requires writting platform specific routines which the containers already do anyway.
>
None the less, EJB 3.1 adds the async capability and I am now looking to use this. From my servlet I use @EJB to access the session bean, and call an async method. My servlet returns right away as it should. From the async method I do some work and using an entity bean store results, so I don't need to return a Future object. In fact, my ejb then makes an HttpClient call to another servlet to notify it that the result is ready.
My main question though, is if it's ok to call other methods from the async method that are not declared @Asynchronous. I presume it is ok, as the @Asynchronous just enables the container to spawn a thread to execute that method in. But I can't dig up any limitations on the code within an async method.. whether or not it has restrictions on the container services, is there anything wrong with using HttpClient to make a request from the method.. and making calls to helper methods within the bean that are not async.
Thanks.If you want to be asynchronous without caring about a return value then just use MDBs.
The async methods have no restrictions on container services and there is nothing wrong with calling other non async methods. Once the async method is reached those annotations don't matter anyway (unless if you call thhose methods from a new reference of the EJB that you look up) as they only make sense in a client context.
Why do you need to make the call to the servlet from the EJB? Makes it difficult to know who is the client here. Better use the Future objects and let the initial caller delegate to the other client components as needed. -
Call the method of a ejb??
hi!
I get EJB refrence ,How can I call the method of it?(I use the stand-alone application client)
code:
import javax.naming.*;
//import javax.naming.InitialContext;
import javax.rmi.*;
import java.util.*;
//import hello.*;
public class jndi {
public static void main(String[] args) {
try {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
env.put(Context.PROVIDER_URL, "iiop://localhost:3000");
Context initctx = new InitialContext(env);
Object objref = initctx.lookup("HelloEJB");
the method I want to call
} catch (Exception ex) {
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
Because it is the stand-alone .I can not to convert the objref:
HelloHome helloHome =(HelloHome)objref;
what can I do???It still can work.
Tere is a ClassCastException.
And the the class name of the objref is "com.sun.corba.se.internal.iiop.CDRInputStream_1_0$1".
but my EJB is named HelloEJB.
Is the object which I want to call???? -
Can an EJB method return processing results to its calling program?
Hi there,
I have an EJB method which does JDBC connection to a UDB. I want the ResultSet to be returned to JSP so I can format them in the page itself. I got an ClassCastException at the return statement. Could anybody point out what I might be missing?
Thanks a lot.
AndyHere is the code related:
try
Context jndi = AuditPublicService.getContext();
Object obj = jndi.lookup(AuditInterface.ALIAS);
AuditHome auditHome =
(AuditHome) PortableRemoteObject.narrow(obj, AuditHome.class);
Audit audit = auditHome.create();
this.rs = (ResultSet) audit.read();
catch (Throwable t)
System.out.println("Test.read():failed." + t.toString());
t.printStackTrace();
and this is what I got:
Test.read():failed.java.lang.ClassCastException
java.lang.ClassCastException
P.S. When I track down to the return statement(return rs) in the audit.read(), I can see that the rs is exactly what I want, but failed when the EJB stub tries to cast it to Serializable. I tried to implements java.io.Serializable in both the calling class and the EJB. it didn't work. -
Finding extra info on caller of ejb method
Is there any way to find out more information about the caller of an EJB
method. I know you can get the principal from the context, as well as the
protocol, etc. But what I am looking for is something like the equivalent
of getRemoteAddr() from the web side. I'd like to find out the IP address,
machine name, etc., from the caller. Does anyone know if this information
is readily available somewhere in one of the existing classes, or would
something have to be home grown to do this?
Thanks in advance,
ChrisIs there any way to find out more information about the caller of an EJB
method. I know you can get the principal from the context, as well as the
protocol, etc. But what I am looking for is something like the equivalent
of getRemoteAddr() from the web side. I'd like to find out the IP address,
machine name, etc., from the caller. Does anyone know if this information
is readily available somewhere in one of the existing classes, or would
something have to be home grown to do this?
Thanks in advance,
Chris -
SQLPLUS How to call ejb remote method in the sql plus.i am getting problem to intiallize the initial context.
hi chidambaresh,
you could have sent this to me directly.
the Enumeration si an interface and so the object we get during the runtime is basically an object of some implementation of this interface.
the Enumeration you get from HAshtable is actually Serializable.
but the Enumeration you actually get from Vector (this is actaully an inner class of Vector viz., Vector$1) is not serializable. that is what the error you are getting.
regards
Srinivasan.R
(VAMSOFT) -
Calling EJB 3.0 Stateless Session Bean
Dear all,
I created a stateless session bean with a hello world method on it. Now i want to call the method from a BeanDecorator class, through a getter metod. When i use the jndi lookup in my getter, i can call the helloWorld method without a problem. However, when i dont use the jndi lookup, and only use the @EJB annotation, i always get a nullpointer.
This is working:
InitialContext ic = new InitialContext();
test = (TestLocal)ic.lookup("test.be/ear~bd/LOCAL/TestBean/"+TestLocal.class.getName());
test.helloWorld()
This gives nullpointer:
@EJB
private TestLocal test;
test.helloWorld();
What is the correct way to consume session beans without having to explicitly code the jndi lookup?
Kind regards.Hi,
any annotation like this can be used only in "managed classes" like Session Beans, Servlets etc. Managed classes are those classes managed by the J2EE server. Managed here means, lifetime controlled by server.
You can find this in J2EE specification.
Frank
Maybe you are looking for
-
Could someone please advise on my current problem? Apparantly I can no longer download tones to my phone or account to be used as such since the tones are being downloaded as songs that cannot be transferred or placed in the tones area for the phone
-
Mini displayport to HDMI adapter? or cable?
which would be a better connection for macbook pro to HDTV, a mini displayport to HDMI adapter with cable? or a mini displayport to HDMI cable??
-
My iPod won't sync any songs or videos that are in the iTunes Library.
I have an iPod classic [80 GB] and it does not, recently since I updated the iTunes to the newest version, for whatever reason iTunes will not be able to sync music or any of the music videos I have giving me a error message [Like rite now it told me
-
How to enable New Schema in existing EUL
Hi, We have a single EUL and recently, we have created a new schema. Could anyone direct me as to how I could see this schema listed down along with the rest of the schemas in my selection? Do I need to login as EUL_MANAGER and do a refresh? We have
-
IDOC Invoices and EDI Invoices
Hi Gurus, Please help me in understanding the flow of IDOC Invoices and EDI Invoices. What is the purpose of using IDOC and EDI? How it works? Please revert asap. Thank You