- This topic has 4 replies, 2 voices, and was last updated 12 years, 9 months ago by
support-swapna.
-
AuthorPosts
-
support-swapnaModeratorhahagal ,
Just like you use other annotations , you can use @EJB too.Please take a look at these links for more information:
http://kaisechen.wordpress.com/2010/07/26/create-ejb-enitiy-bean-example-in-myeclipse-1/
http://www.informit.com/guides/content.aspx?g=java&seqNum=239
http://www.laliluna.de/articles/posts/ejb-3-tutorial-jboss.htmlHope this helps.
hahagalParticipantHi swapna,
I am having problems with the @Resource annotation. The following codes is in session bean. I do not have any ejb-jar.xml or ejb-jar-bnd.xml files. I am using WebSphere 6.1 with ejb feature pack.
@Resource(name="jdbc/Default") private DataSource dataSource; //test connection public Connection getDatasourceConnection() { String _LOC = "[SB_ResourceBean: getDatasourceConnection]"; System.out.println(_LOC + "1.0"); Connection con = null; try { con = dataSource.getConnection(); System.out.println(_LOC + "1.0 datasource " + con); return con; } catch (Exception e) { e.printStackTrace(); return null; } }
[4/19/12 12:49:04:875 SGT] 0000001d ResourceProce E CWNEN0017E: The injection engine cannot resolve the target of the jdbc/Default resource-ref declaration to the associated binding location in the global namespace.
[4/19/12 12:49:04:908 SGT] 0000001d ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl initialize FFDC0009I: FFDC opened incident stream file C:\IBM\WebSphere\AppServer\profiles\AppSrv03\logs\ffdc\server1_0000001d_12.04.19_12.49.04_0.txt
[4/19/12 12:49:04:920 SGT] 0000001d ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\IBM\WebSphere\AppServer\profiles\AppSrv03\logs\ffdc\server1_0000001d_12.04.19_12.49.04_0.txt
[4/19/12 12:49:04:921 SGT] 0000001d InjectionEngi E CWNEN0011E: The injection engine failed to process bindings for the metadata.
[4/19/12 12:49:04:928 SGT] 0000001d ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\IBM\WebSphere\AppServer\profiles\AppSrv03\logs\ffdc\server1_0000001d_12.04.19_12.49.04_1.txt
[4/19/12 12:49:04:931 SGT] 0000001d ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\IBM\WebSphere\AppServer\profiles\AppSrv03\logs\ffdc\server1_0000001d_12.04.19_12.49.04_1.txt
[4/19/12 12:49:04:932 SGT] 0000001d ComponentName E CNTR0125E: Unable to process injection information for class: [class com.belsize.sb.SB_ResourceBean].
[4/19/12 12:49:04:939 SGT] 0000001d ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\IBM\WebSphere\AppServer\profiles\AppSrv03\logs\ffdc\server1_0000001d_12.04.19_12.49.04_2.txt
[4/19/12 12:49:04:941 SGT] 0000001d ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\IBM\WebSphere\AppServer\profiles\AppSrv03\logs\ffdc\server1_0000001d_12.04.19_12.49.04_2.txt
[4/19/12 12:49:04:942 SGT] 0000001d EJBMDOrchestr E CNTR0035E: EJB container caught com.ibm.wsspi.injectionengine.InjectionException: Failed to process bindings for metadata
at com.ibm.ws.injectionengine.InjectionEngineImpl.processBindings(InjectionEngineImpl.java:415)
at com.ibm.ws.injectionengine.InjectionEngineImpl.processInjectionMetaData(InjectionEngineImpl.java:268)
at com.ibm.ws.util.ComponentNameSpaceHelper.populateJavaNameSpace(ComponentNameSpaceHelper.java:920)
at com.ibm.ws.util.ComponentNameSpaceHelper.populateJavaNameSpace(ComponentNameSpaceHelper.java:569)
at com.ibm.ws.metadata.ejb.EJBMDOrchestrator.finishBMDInit(EJBMDOrchestrator.java:1710)
at com.ibm.ws.runtime.component.EJBContainerImpl.finishDeferredBeanMetaData(EJBContainerImpl.java:4831)
at com.ibm.ws.runtime.component.EJBContainerImpl$3.run(EJBContainerImpl.java:4644)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ws.runtime.component.EJBContainerImpl.initializeDeferredEJB(EJBContainerImpl.java:4640)
at com.ibm.ejs.container.HomeOfHomes.getHome(HomeOfHomes.java:392)
at com.ibm.ejs.container.HomeOfHomes.getHome(HomeOfHomes.java:335)
at com.ibm.ejs.container.util.EJBLocalInterfaceObjectFactory.getObjectInstance(EJBLocalInterfaceObjectFactory.java:139)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:316)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:917)
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:191)
at com.ibm.ws.naming.urlbase.UrlContextImpl.processBoundObjectForLookup(UrlContextImpl.java:1775)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1280)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1255)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1307)
at javax.naming.InitialContext.lookup(InitialContext.java:363)
at pagecode.Welcome.getResourceBeanLocal(Welcome.java:36)
at pagecode.Welcome.doWelcome_connectionAction(Welcome.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:127)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:73)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:302)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:419)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:239)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:91)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1146)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:593)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:535)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:764)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:133)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:450)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:508)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:296)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1551)
Caused by: com.ibm.wsspi.injectionengine.InjectionException: The injection engine cannot resolve the target of the jdbc/Default resource-ref declaration to the associated binding location in the global namespace.
at com.ibm.ws.injectionengine.processor.ResourceProcessor.resolve(ResourceProcessor.java:630)
at com.ibm.wsspi.injectionengine.InjectionProcessor.collectInjectionNBindingData(InjectionProcessor.java:641)
at com.ibm.ws.injectionengine.InjectionEngineImpl.processBindings(InjectionEngineImpl.java:406)
… 53 more
and is throwing com.ibm.ejs.container.ContainerException: Failed to initialize BeanMetaData instance; nested exception is:
com.ibm.wsspi.injectionengine.InjectionException: Failed to process bindings for metadata.
hahagalParticipantHi,
Any updates to this issue? I have tried many ways and still can’t get the @Resource to work.
support-swapnaModeratorhahagal ,
I am afraid this is not a MyEclipse issue. I suggest you post to Websphere support forums for better support.
Sorry for inconvenience.
Hope this helps.
-
AuthorPosts