| Author |
Message |
|
|
Post subject: JNDI EJB3 weblogic 10 - javax.naming.NameNotFoundException
Posted: Jul 26, 2007 - 12:03 AM
|
|
Registered Member

Joined: Jul 24, 2007
Posts: 4
|
|
When I execute the following, i get:
prop.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
prop.put(Context.PROVIDER_URL,"t3://localhost:7001" );
InitialContext ctx = new InitialContext(prop);
MyBeanRemote bean = (MyBeanRemote) ctx.lookup("ejb/MyBeanRemote");
javax.naming.NameNotFoundException: Unable to resolve 'ejb.MyBeanRemote'. Resolved 'ejb' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'ejb.MyBeanRemote'. Resolved 'ejb']; remaining name 'MyBeanRemote'
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:217)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:338)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:252)
at weblogic.jndi.internal.ServerNamingNode_1000_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:379)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:367)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.myeclipseide.ejb3.MyBeanClient.main(MyBeanClient.java:37)
Caused by: javax.naming.NameNotFoundException: Unable to resolve 'ejb.MyBeanRemote'. Resolved 'ejb'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1138)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:251)
at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:171)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:205)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:213)
at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:224)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:479)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:475)
at weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:59)
at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:1016)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:172) |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: JNDI EJB3 weblogic 10 - javax.naming.NameNotFoundExcepti
Posted: Jul 26, 2007 - 03:42 PM
|
|
Registered Member


Joined: Apr 18, 2007
Posts: 8012
|
|
Im sorry but I dont have an idea about whats wrong here. Have you tried looking for a solution on google ? |
_________________ Nipun
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject: RE: JNDI EJB3 weblogic 10 - javax.naming.NameNotFoundExcepti
Posted: Jul 26, 2007 - 07:55 PM
|
|
Registered Member

Joined: Jul 24, 2007
Posts: 4
|
|
The reason it is returning this eror is that Weblogic is not identifying it as an j2EE app. There was a probelm with weblogic and BEA stated to create a new domain.
However, when I used the Managed Deployer from MyEclipse to deploy to a specific Web logic 10 domain, it states that it deployed successfully. When I login into the Weblogic admin console and select the domain and then Deployment, I do not see the J2EE app.
Therefore, I ceated a new project and deployed it manually, but it returns the following error:
Unable to access the selected application.
Exception in AppMerge flows' progression
Exception in AppMerge flows' progression
[J2EE:160120]Error: The module, 'EJBProjectTutorialEJB.jar', is declared either in the application.xml or in the weblogic-application.xml descriptor but cannot be found in the ear file
The application.xml is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
<display-name>EJBProjectTutorial</display-name>
<module id="myeclipse.1185394894765">
<ejb>EJBProjectTutorialEJB.jar</ejb>
</module>
</application> |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: JNDI EJB3 weblogic 10 - javax.naming.NameNotFoundExcepti
Posted: Aug 10, 2007 - 09:54 AM
|
|
Registered Member

Joined: Aug 10, 2007
Posts: 19
|
|
|
|
|
 |
|
|
Post subject: JNDI name
Posted: Oct 02, 2007 - 01:49 PM
|
|
Joined: Sep 25, 2007
Posts: 1
|
|
You should :
1 - Declare the JNDI name on the ejb annotation :
@Stateless(name = "TestBean", mappedName = "TestBean")
public class TestBean implements Test {
...
2 - Use the following JNDI name :
"TestBean#com.ejb.sessions.Test" |
|
|
| |
|
|
|
 |
|
|
Post subject: Re: JNDI name
Posted: Nov 14, 2007 - 03:31 PM
|
|
Registered Member


Joined: Oct 31, 2007
Posts: 9
|
|
| kurzseb wrote: | You should :
1 - Declare the JNDI name on the ejb annotation :
@Stateless(name = "TestBean", mappedName = "TestBean")
public class TestBean implements Test {
...
2 - Use the following JNDI name :
"TestBean#com.ejb.sessions.Test" |
Great, I had the very same problem and this solution worked just fine to me.
Nevertheless, I'd complete the explanation saying that TestBean is the implementation class and Test is the Remote Interface...
Any way, I didn't know this kind of JNDI pattern name. Is it only for WebLogic? I've reading the Oreilly EJB 3.0 (5th ed) and I have read nothing like that...
Thanks for the hint!
Andres |
|
|
| |
|
|
|
 |
|
|
Post subject: Another solution
Posted: Dec 04, 2007 - 04:42 PM
|
|
Registered Member

Joined: Dec 04, 2007
Posts: 27
|
|
There is another solution for this. After doing Reverse engineering from the database to EJB3 components when you are writing EJB3 client, in your client class add a new member variable as "@EJB <yourRemoteClassName> <VariableName>;"
e.g.
@EJB MyHomeService home;
and in your test method do something like:
public void test()
{
home.findById(new Long(1));
}
With this approach you don't have to worry about creating and using InitialContext and doing lookup, Application server would take care of that. |
|
|
| |
|
|
|
 |
|
|
Post subject: What is the default JNDI name (i.e. no mappedName)?
Posted: Mar 20, 2008 - 01:34 AM
|
|
Veteran Member


Joined: Oct 15, 2004
Posts: 1
|
|
That worked for me as well. However, I'm still trying to figure out what the name is for the default case (no "name", no "mappedName" attributes specified in the @Stateless annotation). A default "name" is not that important, but "mappedName" is said to be vendor-specific, so I'd rather avoid it.
The @EJB annotation only works if the client runs within the same container (or even the same EAR?). |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jul 21, 2009 - 10:59 AM
|
|
Joined: Nov 02, 2008
Posts: 3
|
|
I am trying to get a simple Stateless Session bean working on WebLogic 10 MP1 with Seam.
My HelloBean.java code is :
| Code: | @Stateless
@Name("hb")
@JndiName("hb")
public class HelloBean implements HelloBeanLocal {
.....
|
I tried with/without option.
Local Interface:
| Code: | @Local
public interface HelloBeanLocal {
public String sayHello();
|
And in my xhtml, I am trying to access this bean like this:
| Code: | | <h:outputText value="#{hb.sayHello}" />> |
When I try to run this I get the following exception:
| Code: | WARNING: executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@143c677) threw exception
org.jboss.seam.InstantiationException: Could not instantiate Seam component: hb
at org.jboss.seam.Component.newInstance(Component.java:2106)
at org.jboss.seam.Component.getInstance(Component.java:1988)
at org.jboss.seam.Component.getInstance(Component.java:1950)
at org.jboss.seam.Component.getInstance(Component.java:1944)
at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
at org.jboss.el.parser.AstValue.getValue(AstValue.java:63)
at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
at javax.faces.component.UIOutput.getValue(UIOutput.java:173)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:189)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:320)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:200)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:829)
at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:281)
at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)
at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:220)
at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:215)
at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:120)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:810)
at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)
at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:220)
at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:215)
at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:120)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:810)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:884)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:890)
at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:571)
at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:134)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:248)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:510)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3393)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2140)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2046)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
Caused by: javax.naming.NameNotFoundException: Unable to resolve 'hb'. Resolved ''; remaining name 'hb'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1138)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:251)
at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:171)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:205)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:367)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.jboss.seam.Component.instantiateSessionBean(Component.java:1367)
at org.jboss.seam.Component.instantiate(Component.java:1331)
at org.jboss.seam.Component.newInstance(Component.java:2084)
... 75 more |
Kindly help. |
|
|
| |
|
|
|
 |
|
|
Post subject: Re: What is the default JNDI name (i.e. no mappedName)?
Posted: Feb 02, 2010 - 02:20 AM
|
|
Joined: Feb 02, 2010
Posts: 1
|
|
| callatis wrote: | That worked for me as well. However, I'm still trying to figure out what the name is for the default case (no "name", no "mappedName" attributes specified in the @Stateless annotation). A default "name" is not that important, but "mappedName" is said to be vendor-specific, so I'd rather avoid it.
The @EJB annotation only works if the client runs within the same container (or even the same EAR?). |
I had the same doubt. Searching in the console menus, I figured out a way to "see" how weblogic configures the EJB's names when you DON'T set the mappedName in annotations. Maybe it can help you.
It seems that weblogic combines the ear, jar, bean and interface names and register it on JNDI tree as a default EJB name.
to see the JNDI tree, go to the console, and there is a panel called "domain structure" on the left. Below this name there is a tree of menus where the root is the server instance name ( in my case wl_server ). Expand the "Environment" item below and click on "servers". The configured servers will be listed on central panel. In my case, there is only one, "examplesServer". Click on it. A link to "view the JNDI tree" will appear. Click on it and the EJBs names should be in the list.
regards...
niskrivits |
|
|
| |
|
|
|
 |
|
|
Post subject: Re: JNDI EJB3 weblogic 10 - javax.naming.NameNotFoundExcepti
Posted: Mar 11, 2010 - 04:44 AM
|
|
Joined: Mar 11, 2010
Posts: 1
|
|
| raa2001 wrote: | When I execute the following, i get:
prop.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
prop.put(Context.PROVIDER_URL,"t3://localhost:7001" );
InitialContext ctx = new InitialContext(prop);
MyBeanRemote bean = (MyBeanRemote) ctx.lookup("ejb/MyBeanRemote");
javax.naming.NameNotFoundException: Unable to resolve 'ejb.MyBeanRemote'. Resolved 'ejb' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'ejb.MyBeanRemote'. Resolved 'ejb']; remaining name 'MyBeanRemote'
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:217)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:338)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:252)
at weblogic.jndi.internal.ServerNamingNode_1000_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:379)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:367)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.myeclipseide.ejb3.MyBeanClient.main(MyBeanClient.java:37)
Caused by: javax.naming.NameNotFoundException: Unable to resolve 'ejb.MyBeanRemote'. Resolved 'ejb'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1138)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:251)
at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:171)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:205)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:213)
at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:224)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:479)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:475)
at weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:59)
at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:1016)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:172) |
|
|
|
| |
|
|
|
 |
|
|
Post subject: Re: JNDI name
Posted: Jun 11, 2012 - 09:21 PM
|
|
Joined: Jun 11, 2012
Posts: 1
|
|
| kurzseb wrote: | You should :
1 - Declare the JNDI name on the ejb annotation :
@Stateless(name = "TestBean", mappedName = "TestBean")
public class TestBean implements Test {
...
2 - Use the following JNDI name :
"TestBean#com.ejb.sessions.Test" |
Solved my problem. Thanks |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jun 12, 2012 - 06:07 AM
|
|

Joined: Nov 11, 2010
Posts: 2154
|
|
prashantpharate,
Glad that it is solved.
Do let us know if you see any other issues. |
_________________ Swapna
MyEclipse Support
|
| |
|
|
|
 |
|
|