• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

spring and ejb integration

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to integrate spring3.0 with ejb3.0. below is the setup i have and using weblogic server 10.3
Interface, bean are in separate ejb project. controller, spring config file are in spring project

interface:
@Local
public interface TestBeanLocal {}

bean:
@Stateless(mappedName="HelloWorld")
public class TestBean implements TestBeanLocal {}

spring controller:
@Controller
@RequestMapping("/welcome")
public class WelcomeController {
@EJB
private TestBean testBean;
}

In spring config file:
<jee:jndi-lookup id="testBean" jndi-name="HelloWorld"/>

I am getting below exception:
javax.naming.NameNotFoundException: Unable to resolve 'HelloWorld'. Resolved ''; remaining name 'HelloWorld'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:252)
at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)

Any help would be appreciated.
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not completely sure since I haven't used this before... but...

Try changing the jndi-name in your config to -



There's also a tag specific to stateless session beans - jee:local-slsb - but I think it needs a business interface to be defined for your bean, and I don't see one in the supplied code.

 
neil johnson
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried the way Nathan has posted but of no use.

one error i found in my code is:
In my controller i was using TestBean class ref instead of TestBeanLocal ref. now i changed it to below in Controller

@EJB
private TestBean testBean;


I even tried the below in spring config file.
<jee:local-slsb id="testBeanLocal" jndi-name="HelloWorld"
business-interface="com.test.TestBeanLocal" />

But no luck.
Can somebody please help me in resolving this.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that when you map a bean to JNDI using "mappedName", the JNDI name is container dependent, so it might not be "HelloWorld". It sometimes uses the class name as well. I have no experience in weblogic, but if you have a kind of admin console where you can check the JNDI naming tree, check it.

In which package is TestBean ? Just for fun, try "HelloWorld/xxx.TestBean", or "HelloWorld#xxx.TestBean", where xxx is the package name.
 
neil johnson
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Christophe,

I tried the way you have suggested but no luck.

I tried with HelloWorld#com.test.TestBeanLocal as JNDI but of no use.

My doubt is am i missing to configure in any xml file like in web.xml
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic