[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
EJB 3.0 @Resource error.  XML
Forum Index » J2EE Application Development
Author Message
intruderX

1 cup a day
[Avatar]

Joined: 08/28/2008 00:20:10
Messages: 26
Offline

We are using RAD 7 + Websphere 7 app server and I was trying to use @Resource annotation to call a datasource from my EJB. when I used,

ic = new InitialContext();
dataSource=(DataSource)ic.lookup("jdbc/UPM");

it works fine!

but when I use,

@Resource(name="jdbc/UPMDbDs")
private DataSource dataSource;

it doesn't work. Should I do something more to use @Resource annotation and What can I do for this?

Error is:

[5/17/10 9:26:54:343 IST] 0000001e InjectionProc E CWNEN0044E: A resource reference binding could not be found for the jdbc/UPM resource reference, defined for the Inventory component.
[5/17/10 9:26:54:390 IST] 0000001e InjectionEngi E CWNEN0011E: The injection engine failed to process bindings for the metadata.
[5/17/10 9:26:54:406 IST] 0000001e ComponentName E CNTR0125E: Unable to process injection information for class: [class org.sampath.pos.ejb.dbaccess.Inventory].
[5/17/10 9:26:54:406 IST] 0000001e 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:48
at com.ibm.ws.injectionengine.InjectionEngineImpl.processInjectionMetaData(InjectionEngineImpl.java:285)
at com.ibm.ws.util.ComponentNameSpaceHelper.populateJavaNameSpace(ComponentNameSpaceHelper.java:806)
at com.ibm.ws.util.ComponentNameSpaceHelper.populateJavaNameSpace(ComponentNameSpaceHelper.java:519)
at com.ibm.ws.metadata.ejb.EJBMDOrchestrator.finishBMDInit(EJBMDOrchestrator.java:1842)
at com.ibm.ws.runtime.component.EJBContainerImpl.finishDeferredBeanMetaData(EJBContainerImpl.java:5034)
at com.ibm.ws.runtime.component.EJBContainerImpl.initializeDeferredEJB(EJBContainerImpl.java:4832)
at com.ibm.ejs.container.HomeOfHomes$1.run(HomeOfHomes.java:404)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:11
at com.ibm.ejs.container.HomeOfHomes.getHome(HomeOfHomes.java:401)
at com.ibm.ejs.container.HomeOfHomes.getHome(HomeOfHomes.java:337)
at com.ibm.ejs.container.util.EJBLocalInterfaceObjectFactory.getObjectInstance(EJBLocalInterfaceObjectFactory.java:137)
at javax.naming.spi.NamingManager.getObjectInstanceByFactoryInReference(Unknown Source)
at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:920)
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:175)
at com.ibm.ws.naming.urlbase.UrlContextImpl.processBoundObjectForLookup(UrlContextImpl.java:1736)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1249)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1276)
at com.ibm.etools.utc.servlet.JNDILookupServlet.lookup(JNDILookupServlet.java:7
at com.ibm.etools.utc.servlet.JNDILookupServlet.doGet(JNDILookupServlet.java:33)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:71
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1443)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:790)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:325)
at com.ibm.etools.utc.servlet.Authenticator.doAuthentication(Authenticator.java:87)
at com.ibm.etools.utc.servlet.Authenticator.doGet(Authenticator.java:42)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:71
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1443)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:790)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3610)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:274)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:926)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
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:13
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)

Thanks!

This message was edited 1 time. Last update was at 05/16/2010 21:59:25

[Email]
stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 849
Location: Superior, CO, USA
Offline

Do you need to name the resource something like "java:comp/env/jdbc/UPMDbDs"? I never get it straight when to use the "long" name or the "short" name.

Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
 
Forum Index » J2EE Application Development
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2011 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle