File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes How to invoke EJB 3.0 from a Spring controller? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "How to invoke EJB 3.0 from a Spring controller?" Watch "How to invoke EJB 3.0 from a Spring controller?" New topic
Author

How to invoke EJB 3.0 from a Spring controller?

Mittu Alphs
Greenhorn

Joined: Aug 18, 2010
Posts: 1
Hi,

I am creating a search application using Spring framework in which my spring controller has to invoke an stateless session EJB3.0 which will call the methods to query my 3rd party storage.

My EJB is working fine and I am able to invoke it from a servlet using @EJB annotation. But I am not able to invoke the same using spring controller class instead of servlet
I am using Websphere 6.1 server
Following are the files associated:

1. Session Bean

2 Remote Interface

3. ejb-jar.xml

4. actionBazar-service.xml

5. Spring config file


ERROR
[8/18/10 13:03:02:953 IST] 0000002b ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl initialize FFDC0009I: FFDC opened incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\AppSrv01\logs\ffdc\server1_0000002b_10.08.18_13.03.02_0.txt
[8/18/10 13:03:02:968 IST] 0000002b ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\AppSrv01\logs\ffdc\server1_0000002b_10.08.18_13.03.02_0.txt
[8/18/10 13:03:03:015 IST] 0000002b WebApp E [Servlet Error]-[fedSearch]: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMapping' defined in resource [/WEB-INF/fedSearch-servlet.xml] of ServletContext: Can't resolve reference to bean 'searchController' while setting property 'urlMap[/TestServlet.do]'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'searchController' defined in resource [/WEB-INF/fedSearch-servlet.xml] of ServletContext: Can't resolve reference to bean 'placeBid' while setting property 'placeBid'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'placeBid' defined in resource [/WEB-INF/fedSearch-servlet.xml] of ServletContext: Initialization of bean failed; nested exception is javax.naming.NameNotFoundException: Context: 01HW148604Node02Cell/nodes/01HW148604Node02/servers/server1, name: placeBid: First component in name placeBid not found.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'searchController' defined in resource [/WEB-INF/fedSearch-servlet.xml] of ServletContext: Can't resolve reference to bean 'placeBid' while setting property 'placeBid'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'placeBid' defined in resource [/WEB-INF/fedSearch-servlet.xml] of ServletContext: Initialization of bean failed; nested exception is javax.naming.NameNotFoundException: Context: 01HW148604Node02Cell/nodes/01HW148604Node02/servers/server1, name: placeBid: First component in name placeBid not found.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'placeBid' defined in resource [/WEB-INF/fedSearch-servlet.xml] of ServletContext: Initialization of bean failed; nested exception is javax.naming.NameNotFoundException: Context: 01HW148604Node02Cell/nodes/01HW148604Node02/servers/server1, name: placeBid: First component in name placeBid not found.
javax.naming.NameNotFoundException: Context: 01HW148604Node02Cell/nodes/01HW148604Node02/servers/server1, name: placeBid: First component in name placeBid not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDLmg.org/CosNaming/NamingContext/NotFound:1.0]
at com.ibm.ws.naming.jndicos.CNContextImpl.processNotFoundException(CNContextImpl.java:4846)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1930)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1879)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1562)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1359)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:172)
at javax.naming.InitialContext.lookup(InitialContext.java:363)
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:120)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:85)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:117)
at org.springframework.jndi.AbstractJndiLocator.lookup(AbstractJndiLocator.java:181)
at org.springframework.jndi.AbstractJndiLocator.afterPropertiesSet(AbstractJndiLocator.java:171)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:801)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:249)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:177)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:159)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveReference(AbstractAutowireCapableBeanFactory.java:720)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveValueIfNecessary(AbstractAutowireCapableBeanFactory.java:672)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:614)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:467)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:232)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:177)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:159)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveReference(AbstractAutowireCapableBeanFactory.java:720)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveValueIfNecessary(AbstractAutowireCapableBeanFactory.java:672)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveManagedMap(AbstractAutowireCapableBeanFactory.java:777)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveValueIfNecessary(AbstractAutowireCapableBeanFactory.java:688)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:614)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:467)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:232)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:177)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:159)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:183)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:268)
at org.springframework.web.context.support.XmlWebApplicationContext.refresh(XmlWebApplicationContext.java:131)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:281)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:229)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:199)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:102)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:220)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.init(ServletWrapper.java:328)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:413)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:486)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3440)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:267)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1461)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:118)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
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:195)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDLmg.org/CosNaming/NamingContext/NotFound:1.0
at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_resolve_complete_info(WsnOptimizedNamingImpl.java:575)
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.resolve_complete_info(WsnOptimizedNamingImplBase.java:2225)
at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(_NamingContextStub.java:536)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:4467)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1924)
... 58 more

Please guide me to resolve this

Thanks in advance
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

"Query Test",
Welcome to the ranch ! Please check your Private Messages for an important administrative matter.

You may not be aware yet that you can UseCodeTags when you post some code. I've added them for you. Give it a try next time


[My Blog]
All roads lead to JavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to invoke EJB 3.0 from a Spring controller?