Problems with JNDI lookup for java:comp/env/ejb
Hi all,
I'm using OC4J 9.0.3 and I have problems when looking up for the local
EJB context.
I have a SLSB which refers to another SLSB via a JNDI mapping like
shown below. Both services are deployed within one EAR file.
(snippets of ejb-jar.xml and orion-ejb-jar.xml)
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>ServiceABean</ejb-name>
<home>com.coi.ServiceAHome</home>
<remote>com.coi.ServiceA</remote>
<ejb-class>com.coi.ServiceABean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-ref>
<ejb-ref-name>ejb/some/sub/packages/ServiceB</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.coi.ServiceBHome</home>
<remote>com.coi.ServiceB</remote>
</ejb-ref>
</session>
</enterprise-beans>
</ejb-jar>
<orion-ejb-jar>
<enterprise-beans>
<session-deployment location="global/some/sub/packages/ServiceA" name="ServiceABean">
<ejb-ref-mapping name="ejb/some/sub/packages/ServiceB" location="global/some/sub/packages/ServiceB" />
</session-deployment>
</enterprise-beans>
</orion-ejb-jar>
The ApplicationInitialContextFactory will be used (prepared by the container),
so the lookup for ServiceB within a method of ServiceA should work as follows:
public class ServiceABean implements SessionBean
public void someMethod()
InitialContext con = new InitialContext(); // will be of class ApplicationContext
Context localEjbContext = (Context)con.lookup( "java:comp/env/ejb" );
ServiceBHome serviceBHome = (ServiceBHome) PortableRemoteObject.narrow(
localEjbContext.lookup( "some/sub/packages/ServiceB" ),
ServiceBHome.class );
The problem is now, that the lookup for "java:comp/env/ejb" doesn't work
and throws a NameNotFoundException.
To figure out what's actually happening during lookup I debugged a little bit and
tried a few things:
1. A lookup for "java:comp" works fine. It returns an instance of class FlatMapContext
which consists of a hash map which itself contains an entry for "env".
2. So a lookup for "env" on that FlatMapContext also works and returns an instance of SubContext.
3. A lookup for "ejb" using this SubContext causes a NameNotFoundException
with message "java:comp/env/ejb not found".
4. A lookup like con.lookup( "java:comp/env" ) throws also a NameNotFoundException
with message "java:comp/env not found (not inside a J2EE module, for instance a Web-App,
EJB, or Application-Client)".
Does anyone know something about this?
Regards
--thomas
Hi Debu,
Great! 9.0.4 will be released in june/july this year, right? Sorry for my ironical reaction, but does that mean, that I don't have any chance to get my whole stuff running in 9.0.3? I cannot believe that. Isn't there a wordaround I could apply? A setting or whatever to substitute the daft FlatCtx by something else that is implemented according to the spec?
Regards
--thomas
Similar Messages
-
Hi
I am just a starter on WLPortal.
I have created a barebone Application from scratch. I have synchronized it properly
from EBCC to WLP. But When I am trying to access the home page of my application,
I am getting from stack trace -
<Nov 6, 2002 5:37:59 PM IST> <Error> <PortalAppflow> <Could not lookup PortalManagerHome
in the JNDI tree using EJB reference java:comp/env/ejb/PortalManager.
javax.naming.NameNotFoundException: Unable to resolve comp/env/ejb/PortalManager
Resolved: 'comp/env' Unresolved:'ejb' ; remaining name 'PortalManager'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:802)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:209)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:173)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:181)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:181)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:323)
at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:36)
at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:124)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at com.bea.p13n.util.JndiHelper.lookupNarrow(JndiHelper.java:96)
at com.bea.portal.appflow.PortalAppflowHelper.<clinit>(PortalAppflowHelper.java:64)
at com.bea.portal.appflow.servlets.internal.PortalWebflowServlet.init(PortalWebflowServlet.java:78)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:700)
at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:643)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:588)
at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:368)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:215)
at weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:112)
at jsp_servlet.__index._jspService(__index.java:92)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:304)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2459)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2039)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
<Nov 6, 2002 5:37:59 PM IST> <Error> <HTTP> <[WebAppServletContext(19695286,FirstWebApp,/FirstWebApp)]
Servlet failed with Exception
java.lang.NullPointerException:
at com.bea.portal.appflow.PortalAppflowHelper.createPortalManager(PortalAppflowHelper.java:82)
at com.bea.portal.appflow.servlets.internal.PortalWebflowServlet.setupPortalRequest(PortalWebflowServlet.java:187)
at com.bea.portal.appflow.servlets.internal.PortalWebflowServlet.doGet(PortalWebflowServlet.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:215)
at weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:112)
at jsp_servlet.__index._jspService(__index.java:92)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:304)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2459)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2039)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
When I decompiled the class PortalAppflowHelper, I found a static block in it,
which was as under-
static
debug = Debug.getInstance(com.bea.portal.appflow.PortalAppflowHelper.class);
try
if(debug.ON)
debug.out("Looking up PortalManagerHome using EJB reference java:comp/env/ejb/PortalManager");
portalManagerHome = (PortalManagerHome)JndiHelper.lookupNarrow("java:comp/env/ejb/PortalManager",
com.bea.portal.manager.ejb.PortalManagerHome.class);
if(debug.ON)
debug.out("Successfully retrieved PortalManagerHome " + portalManagerHome);
catch(Exception e)
PortalAppflowLogger.errorFindingPortalManagerHome("java:comp/env/ejb/PortalManager",
e);
I have checked the PortalManager's JNDI name on WLConsole. Its ${APPNAME}.BEA_portal.PortalManager.
Should I change it?
When I tried to change it, I started getting other weird errors.
Thanks
Neeraj HansNeeraj -
The Portal framework code (including PortalAppflowHelper) uses ejb
references to find the PortalManager (and other EJBs) from servlets and
taglibs; that is what is signified by the java:comp/env/... name.
Since you built your webapp from scratch (instead of using the portal
wizard), you will need to make sure the you have the appropriate
<ejb-ref> entries in your web.xml, and the corresponding
<ejb-reference-description> entries in your weblogic.xml. By default,
you will need at least mappings for:
- ejb/PortalManager
- ejb/UserManager
- ejb/GroupManager
- ejb/PipelineExecutor
- ejb/EventService
See either the resulting webapp from using the portal wizard or
BEA_HOME/weblogic700/samples/portal/sampleportalDomain/beaApps/sampleportal/sampleportal/WEB-INF
for example syntax.
Greg
Neeraj Hans wrote:
Hi
I am just a starter on WLPortal.
I have created a barebone Application from scratch. I have
synchronized it properly
from EBCC to WLP. But When I am trying to access the home page of my
application,
I am getting from stack trace -
<Nov 6, 2002 5:37:59 PM IST> <Error> <PortalAppflow> <Could not lookup
PortalManagerHome
in the JNDI tree using EJB reference java:comp/env/ejb/PortalManager.
javax.naming.NameNotFoundException: Unable to resolve
comp/env/ejb/PortalManager
Resolved: 'comp/env' Unresolved:'ejb' ; remaining name 'PortalManager'
at <stack trace lines snipped>
When I decompiled the class PortalAppflowHelper, I found a static
block in it,
which was as under-
static
debug =
Debug.getInstance(com.bea.portal.appflow.PortalAppflowHelper.class);
try
if(debug.ON)
debug.out("Looking up PortalManagerHome using EJB
reference java:comp/env/ejb/PortalManager");
portalManagerHome =
(PortalManagerHome)JndiHelper.lookupNarrow("java:comp/env/ejb/PortalManager",
com.bea.portal.manager.ejb.PortalManagerHome.class);
if(debug.ON)
debug.out("Successfully retrieved PortalManagerHome "
+ portalManagerHome);
catch(Exception e)
PortalAppflowLogger.errorFindingPortalManagerHome("java:comp/env/ejb/PortalManager",
e);
I have checked the PortalManager's JNDI name on WLConsole. Its
${APPNAME}.BEA_portal.PortalManager.
Should I change it?
When I tried to change it, I started getting other weird errors.
Thanks
Neeraj Hans -
Help, help! I have a problem:
javax.naming.NameNotFoundException: No object bound for java:comp/env/configuratorDataSource
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:116)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:127)
at javax.naming.InitialContext.lookup(InitialContext.java:355)
at oracle.toplink.jndi.JNDIConnector.connect(Unknown Source)
at oracle.toplink.sessions.DatabaseLogin.connect(Unknown Source)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.connect(Unknown Source)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.connect(Unknown Source)
at oracle.toplink.threetier.ConnectionPool.buildConnection(Unknown Source)
at oracle.toplink.threetier.ConnectionPool.startUp(Unknown Source)
at oracle.toplink.threetier.ServerSession.connect(Unknown Source)
at oracle.toplink.publicinterface.DatabaseSession.login(Unknown Source)
at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(Unknown Source)
at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(Unknown Source)
at com.configurator.datasource.ToplinkClientSessionManager.<init>(ToplinkClientSessionManager.java:18)
at com.configurator.datasource.ToplinkClientSessionManager.getInstance(ToplinkClientSessionManager.java:33
at com.configurator.persistence.PersistenceManagerImpl.<init>(PersistenceManagerImpl.java:16)
at com.configurator.ConfiguratorServiceMediatorImpl.getModelsFromDB(ConfiguratorServiceMediatorImpl.java:3
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:384)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:281)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:319)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:450)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:285)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:653)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:301)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Thread.java:595)
code:
initialContext = new InitialContext();
LocalStatelessREHome localHome = (LocalStatelessREHome)initialContext.lookup("java:comp/env/StatelessREBean");
in web.xml:
<ejb-local-ref>
<ejb-ref-name>StatelessREBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.re.stateless.ejb.LocalStatelessREHome</local-home>
<local>com.re.stateless.ejb.LocalStatelessRE</local>
<ejb-link>StatelessREBean</ejb-link>
</ejb-local-ref>
Any help will be appreciated! Thanks in advance.Try removing the JNDI fully qualified name (i.e. java:comp\env\) Use the name of your bean to lookup.
It worked for me when i used to get a similar exception. -
In case of problems with SAP GUI for Java ...
Hello all,
in case of having problems (errors, ABAP dumps etc.) with SAP GUI for Java, please create an OSS message on component BC-FES-JAV with information described in OSS note 326558
http://www.service.sap.com/~form/sapnet?_FRAME=CONTAINER&_OBJECT=011000358700010521522001.
This makes sure our official support channels get aware of your problem.
Thanks and best regards
Rolf-MartinHello Rolf-Martin,
i don't have access to this website to view the note.
The version of the Suse libc is:
GNU C Library stable release version 2.3.2, by Roland McGrath et al.
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 3.3 20030226 (prerelease) (SuSE Linux).
Compiled on a Linux 2.4.20 system on 2003-03-13.
Best Regards,
Piotr Brostovski -
Problem in Jndi lookup for ITaskService
HI,
I am trying to initiate oracle bpm Human task programatically by using Java remotely.
for this I am using following JNDI lookup for ITaskService.
Hashtable ht = new
Hashtable<IWorkflowServiceClientConstants.CONNECTION_PROPERTY,java.lang.String>();
ht.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ht.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_PROVIDER_URL, "t3://localhost:7001");
ht.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_PRINCIPAL, "username");
ht.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_CREDENTIALS, "password");
Context ctx = new InitialContext(ht);
ITaskService taskService = (ITaskQueryService)ctx.lookup("ejb/bpel/services/workflow/TaskServiceBean");
taskService.initiateTask(task);
It the right approach or not.
Please help.To access human workflow api remotely try using the following code :
Map properties = new HashMap();
properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_PROVIDER_URL, "t3://localhost:8001");
properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_CREDENTIALS, "welcome1");
properties.put(IWorkflowServiceClientConstants.CONNECTION_PROPERTY.EJB_SECURITY_PRINCIPAL, "weblogic");
IWorkflowServiceClient wfSvcClient =
WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.REMOTE_CLIENT, properties, null);
//Get the task query service
ITaskQueryService querySvc = wfSvcClient.getTaskQueryService();
//Login as weblogic
IWorkflowContext ctx = querySvc.authenticate("weblogic","welcome1".toCharArray(),null);
after getting the workflow context, you can call any method like query task list. perform actions etc. just see the api doc.
Regards,
Anshul -
Problem with downloading xdk for java - suggestions?
I am having problems downloading the xdk for java. Could someone please direct me to an alternate site for download?
In Windows, open the Task Manager and, in the Processes tab, close bridge.exe.
http://helpx.adobe.com/creative-suite/kb/error-installation-cannot-continue-bridge.html -
hi,
i created my own Queue and QueueConnectionFactory using the j2eeadmin tool. both objects show up just fine when i run j2eeadmin -listXXX
however when i try to lookup either one of these with the runtime api, i get javax.naming.NameAlreadyBoundException
my client code may not be correct, but here's what i have:
InitialContext jndiContext = new InitialContext();
jndiContext.lookup( name );
where name is the name that object is bound to.
if anyone has any idea what i'm doing wrong, please let me know.
thanks,
mark.u can set jndi name during u deploy the EJB ,for example ,after u start the deploytool ,u have built a group of ejb classes such as sessionbean, remote interface ,home interface ,then deploy them as a ejb,after this u can get the menu about alias ,so set the name when u write ur script to call the ejb ,just give the same name as u wrote just now
-
Problems with Disc Permissions for Java Virtual Machine
hi,
My machine (10.6.6) crashed. I had the spinning beach ball.
Force Quit and On/Off did nothing.
I needed to unplug and remove the battery to restart.
After that, I did Repair Disk Permissions.
It finds a bunch of things for Java Virtual Machine/1.6.0/jdk
It says it fixes it.
But if I reboot and and run Repair Disk Permissions again,
it still finds the same problems.
How do I get it fixed?Hi,
these permission errors are normal. There's nothing to be worried about. If you search around (you did search around first, right?) you'll find that most, if not all, Snow Leopard users see these messages.
HTH.
S. -
Problem with XML Parser For Java V2
Get message:
<Line 5, Column 40>: XSD-2021: (Error) Element not completed: 'doesNotWork'
Parser Exception: Element not completed: 'doesNotWork'
Element 'doesNotWork' is defined the same as 'works' except 'doesNotWork' uses a ref="" rather than defining element inline.
This appears to be a bug in the parser.
XML:
<?xml version ="1.0"?>
<example>
<works anAttribute="something"/>
<doesNotWork anAttribute="something"/>
</example>
Schema:
<?xml version = "1.0" encoding = "UTF-8"?>
<xsd:schema xmlns:xsd = "http://www.w3.org/2000/10/XMLSchema">
<xsd:element name = "example">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="works">
<xsd:complexType>
<xsd:attribute name = "anAttribute" use = "required" type = "xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element ref = "doesNotWork"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name = "doesNotWork">
<xsd:complexType>
<xsd:attribute name = "anAttribute" use = "required" type = "xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>Hi all,
I am getting the same error. Is the schema parser being actively suppported. From replies to problems, it does not seem like it is. Also I am still having problems with 'required', ID attributes etc. Is there comprehensive documentation of what is and what is not supported.
Any help appreciated
Thanks
Venu -
Java:comp/env bound and unbound at the same time
I have a ServiceLocator class which has a method that looks up and caches EJB remote home objects. I am occasionally getting a NameNotFoundException from this method telling me that env is not bound when I try doing a lookup using a JNDI name such as "java:comp/env/ejb/MyEjb". What is so odd is that this lookup is working for other JNDI names under java:comp/env, as well as in other cases when using the same JNDI name which causes the exception. It appears that env is bound in some cases but not in others.
This only occurs when I restart my JBoss server after a client has opened an HttpSession. If I also restart the client then the error doesn't occur. The client is a VB application which calls my JBoss web application's Servlets. I'm using JBoss 4.0.1.
Can anyone give me a suggestion as to where I should look for the problem? Thanks in advance.
--JamesA little more information:
The ServiceLocator is a Singleton object which runs as part of the server, and has its InitalContext bound the first time it's used (this happens in the ServiceLocator Singleton's constructor). The weirdness I'm experiencing is that it completes several lookups successfully before bombing on a lookup which uses the same JNDI name of a lookup that previously worked -- it literally works on one call and then fails on the next. The difference between the times it works and the time it doesn't is that the successful ServiceLocator method invocations originate within Servlets or EJBs and the unsuccessful invokation is made from within a JMX component. Still it's the same ServiceLocator Singleton, with the same internal InitialContext, so it would follow that the InitialContext would never lose a binding, regardless of the type of component that calls the method which does a lookup.
To further illustrate here's the scenario I'm dealing with:
1. The server is started.
2. The client is started.
3. All is well -- the client calls the servlets, which either (a) call the ServiceLocator to get EJBs or (b) invoke JMX services (MBean methods) which call the ServiceLocator to get EJBs.
4. The server is restarted.
5. The client makes a call to a servlet.
6. The servlet makes a call to the ServiceLocator method to get an EJB, and within that EJB the ServiceLocator is again called to get another EJB:
a. Lookup of java:comp/env/ejb/EJBOne is successful
b. Lookup of java:comp/env/ejb/EJBTwo is successful
7. The client calls a method on a JMX service (MBean) which internally uses the ServiceLocator to get an EJB. In this case the lookup fails:
c. Lookup of java:comp/env/ejb/EJBThree fails with the following exception stack trace:
javax.naming.NameNotFoundException: env not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
at org.jnp.server.NamingServer.lookup(NamingServer.java:249)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:544)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:658)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:520)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.mycom.util.ServiceLocator.getRemoteHome(ServiceLocator.java:119)
etc...
7. The client receives the error and calls another servlet to refresh itself. This servlet looks up the same EJB which the JMX service was trying to lookup, and this time the ServiceLocator has no trouble finding it:
b. Lookup of java:comp/env/ejb/EJBThree is successful
In the ServiceLocator's lookup method I have added debug code to show the HashCode of the InitialContext being used, and in fact it is the same InitialContext being used each time.
What I think is happening is that normally in my application when the JMX components invoke ServiceLocator methods these methods are never doing lookups and are always getting objects previously cached by lookups made by previous ServiceLocator method calls made the Servlets or EJBs. In other words the above scenario is the only time a JMX component is invoking a ServiceLocator method in which the requested object isn't already cached and the lookup actually needs to happen. The "java:comp/env" name is somehow not available within the context of JMX, and hence the lookup fails.
So it appears that within the context of normal (non-JMX) components the JNDI name "java:comp/env" is bound to the InitialContext, but within the context of a JMX component the InitialContext temporarily loses this binding. Is this the really case? If so can someone point me to a reference in which this behavior explained?
--James -
Why only j2sdkee1.3 support JNDI lookup "java:comp/env" from remote client?
Hi:
I have been puzzled by this function of j2sdkee1.3.1 support JNDI lookup "java:comp/env" from client. I always think that "java:comp/env" namespace can only be access by the application server self for it is a private namespace. The weblogic and websphere doest support this.
Why?
Regards!
John LeeHi:I'm unable to get JNDI reference object from remote application client with "java:comp/env/ejb/<lookupName>".
The exception says:
Application threw an exception:javax.naming.CommunicationException: Cannot connect to ORB [Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No]
The J2EE server and client are run on different machines, and needs to be like this. There isn't any problem with JSP/Servlet (cause they run/execute on the server itself). How will the client find out the JNDI refernce my mere specification of "java:comp/env/..."?
Am I making a mistake anywhere?
BEA Weblogic & IBM Websphere allows explicitly specifying the server name, while doing JNDI lookup. Is there anything similary for J2EE?
I couldn't find reference for this anywhere in the J2EE tutorial or EJB books.
- Devashish -
Hi:
I have been puzzled by this function of j2sdkee1.3.1 support JNDI lookup "java:comp/env"
from client. I always think that "java:comp/env" namespace can only be access
by the application server self for it is a private namespace. The weblogic and
websphere doest support this.
Why?
Regards!
JohnHi:I'm unable to get JNDI reference object from remote application client with "java:comp/env/ejb/<lookupName>".
The exception says:
Application threw an exception:javax.naming.CommunicationException: Cannot connect to ORB [Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No]
The J2EE server and client are run on different machines, and needs to be like this. There isn't any problem with JSP/Servlet (cause they run/execute on the server itself). How will the client find out the JNDI refernce my mere specification of "java:comp/env/..."?
Am I making a mistake anywhere?
BEA Weblogic & IBM Websphere allows explicitly specifying the server name, while doing JNDI lookup. Is there anything similary for J2EE?
I couldn't find reference for this anywhere in the J2EE tutorial or EJB books.
- Devashish -
2013-06-24 21:16:28,551 [bxapp2.healthnet.com] [ STANDARD] [ ] (l.access.RuleCandidateIterator) INFO - Single candidate rule resolution optimization is enabled
Error retrieving JNDI initial context:
2013-06-24 21:16:28,952 [bxapp2.healthnet.com] [ STANDARD] [ ] ( pegarules.resadap.RAClient) ERROR - Caught exception while looking up Connection Factory with JNDI Name: java:comp/env/eis/PRAdapterConnectionFactory, javax.naming.ServiceUnavailableException [Root exception is java.net.UnknownHostException: Unknown protocol: 'TCP']
javax.naming.ServiceUnavailableException [Root exception is java.net.UnknownHostException: Unknown protocol: 'TCP']
at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:34)
at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:787)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:368)
at weblogic.jndi.Environment.getContext(Environment.java:315)
at weblogic.jndi.Environment.getContext(Environment.java:285)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:175)
at com.pega.pegarules.priv.util.JNDIUtil.getInitialContext(JNDIUtil.java:106)
at com.pega.pegarules.priv.util.JNDIUtil.lookupUsingRealContextClassLoader(JNDIUtil.java:128)
at com.pega.pegarules.resadap.RAClient.init(RAClient.java:102)
at com.pega.pegarules.resadap.RAClient.<init>(RAClient.java:84)
at com.pega.pegarules.resadap.RAClientContainer.get(RAClientContainer.java:47)
at com.pega.pegarules.session.internal.async.BatchUtils.callRAClient(BatchUtils.java:146)
at com.pega.pegarules.integration.engine.internal.services.listener.ListenerWrapper.callRAClient(ListenerWrapper.java:358)
at com.pega.pegarules.integration.engine.internal.services.listener.ListenerWrapper.launchListener(ListenerWrapper.java:233)
at com.pega.pegarules.integration.engine.internal.services.listener.ListenerStateManagerImpl.startOneListener(ListenerStateManagerImpl.java:713)
at com.pega.pegarules.integration.engine.internal.services.listener.ListenerStateManagerImpl.startServiceTypeListeners(ListenerStateManagerImpl.java:464)
at com.pega.pegarules.integration.engine.internal.services.listener.ListenerStateManagerImpl.startListenerType(ListenerStateManagerImpl.java:423)
at com.pega.pegarules.integration.engine.internal.PRIntegrationEngineProviderImpl.initServices(PRIntegrationEngineProviderImpl.java:166)
at com.pega.pegarules.session.internal.mgmt.PREnvironment.initServices(PREnvironment.java:620)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:1043)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:765)
at com.pega.pegarules.session.internal.mgmt.PREnvironment.finishInit(PREnvironment.java:522)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:1043)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:765)
at com.pega.pegarules.session.internal.mgmt.PREnvironment.getThreadAndInitialize(PREnvironment.java:379)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.getThreadAndInitialize(PRSessionProviderImpl.java:1516)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineStartup.initEngine(EngineStartup.java:619)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl._initEngine_privact(EngineImpl.java:165)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl.doStartup(EngineImpl.java:138)
at com.pega.pegarules.session.internal.engineinterface.etier.ejb.EngineBean.doStartup(EngineBean.java:120)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethod(PRBootstrap.java:349)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethodPropagatingThrowable(PRBootstrap.java:390)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethodPropagatingException(PRBootstrap.java:412)
at com.pega.pegarules.internal.etier.ejb.EngineBeanBoot.doStartup(EngineBeanBoot.java:130)
at com.pega.pegarules.internal.etier.ejb.EngineBMT_h449u3_ELOImpl.doStartup(EngineBMT_h449u3_ELOImpl.java:124)
at com.pega.pegarules.web.servlet.WebAppLifeCycleListener._contextInitialized_privact(WebAppLifeCycleListener.java:259)
at com.pega.pegarules.web.servlet.WebAppLifeCycleListener.contextInitialized(WebAppLifeCycleListener.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethod(PRBootstrap.java:349)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethodPropagatingThrowable(PRBootstrap.java:390)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethod(PRBootstrap.java:439)
at com.pega.pegarules.internal.web.servlet.WebAppLifeCycleListenerBoot.contextInitialized(WebAppLifeCycleListenerBoot.java:83)
at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1863)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3126)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1512)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:486)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:1267)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:409)
at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: java.net.UnknownHostException: Unknown protocol: 'TCP'
at weblogic.rjvm.RJVMManager.findOrCreateRemoteInternal(RJVMManager.java:216)
at weblogic.rjvm.RJVMManager.findOrCreate(RJVMManager.java:197)
at weblogic.rjvm.RJVMFinder.findOrCreateRemoteServer(RJVMFinder.java:238)
at weblogic.rjvm.RJVMFinder.findOrCreateInternal(RJVMFinder.java:200)
at weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:170)
at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:153)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:353)
... 94 more
2013-06-24 21:16:28,952 [bxapp2.healthnet.com] [ STANDARD] [ ] (tener.ListenerStateManagerImpl) ERROR - Unexpected exception.
java.lang.NullPointerException
at com.pega.pegarules.session.internal.async.BatchUtils.callRAClient(BatchUtils.java:150)
at com.pega.pegarules.integration.engine.internal.services.listener.ListenerWrapper.callRAClient(ListenerWrapper.java:358)
at com.pega.pegarules.integration.engine.internal.services.listener.ListenerWrapper.launchListener(ListenerWrapper.java:233)
at com.pega.pegarules.integration.engine.internal.services.listener.ListenerStateManagerImpl.startOneListener(ListenerStateManagerImpl.java:713)
at com.pega.pegarules.integration.engine.internal.services.listener.ListenerStateManagerImpl.startServiceTypeListeners(ListenerStateManagerImpl.java:464)
at com.pega.pegarules.integration.engine.internal.services.listener.ListenerStateManagerImpl.startListenerType(ListenerStateManagerImpl.java:423)
at com.pega.pegarules.integration.engine.internal.PRIntegrationEngineProviderImpl.initServices(PRIntegrationEngineProviderImpl.java:166)
at com.pega.pegarules.session.internal.mgmt.PREnvironment.initServices(PREnvironment.java:620)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:1043)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:765)
at com.pega.pegarules.session.internal.mgmt.PREnvironment.finishInit(PREnvironment.java:522)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:1043)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:765)
at com.pega.pegarules.session.internal.mgmt.PREnvironment.getThreadAndInitialize(PREnvironment.java:379)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.getThreadAndInitialize(PRSessionProviderImpl.java:1516)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineStartup.initEngine(EngineStartup.java:619)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl._initEngine_privact(EngineImpl.java:165)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl.doStartup(EngineImpl.java:138)
at com.pega.pegarules.session.internal.engineinterface.etier.ejb.EngineBean.doStartup(EngineBean.java:120)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethod(PRBootstrap.java:349)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethodPropagatingThrowable(PRBootstrap.java:390)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethodPropagatingException(PRBootstrap.java:412)
at com.pega.pegarules.internal.etier.ejb.EngineBeanBoot.doStartup(EngineBeanBoot.java:130)
at com.pega.pegarules.internal.etier.ejb.EngineBMT_h449u3_ELOImpl.doStartup(EngineBMT_h449u3_ELOImpl.java:124)
at com.pega.pegarules.web.servlet.WebAppLifeCycleListener._contextInitialized_privact(WebAppLifeCycleListener.java:259)
at com.pega.pegarules.web.servlet.WebAppLifeCycleListener.contextInitialized(WebAppLifeCycleListener.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethod(PRBootstrap.java:349)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethodPropagatingThrowable(PRBootstrap.java:390)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethod(PRBootstrap.java:439)
at com.pega.pegarules.internal.web.servlet.WebAppLifeCycleListenerBoot.contextInitialized(WebAppLifeCycleListenerBoot.java:83)
at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1863)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3126)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1512)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:486)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:1267)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:409)
at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
2013-06-24 21:16:28,956 [bxapp2.healthnet.com] [ STANDARD] [ ] ( internal.async.Agent) INFO - Agents will be executed via the enterprise tier.
2013-06-24 21:16:28,956 [bxapp2.healthnet.com] [ STANDARD] [ ] ( internal.async.Agent) INFO - Passivation will be done on a per-page basis.
2013-06-24 21:16:30,023 [bxapp2.healthnet.com] [ STANDARD] [ ] ( pegarules.resadap.RAClient) ERROR - Caught exception while looking up Connection Factory with JNDI Name: java:comp/env/eis/PRAdapterConnectionFactory, javax.naming.ServiceUnavailableException [Root exception is java.net.UnknownHostException: Unknown protocol: 'TCP']
javax.naming.ServiceUnavailableException [Root exception is java.net.UnknownHostException: Unknown protocol: 'TCP']
at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:34)
at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:787)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:368)
at weblogic.jndi.Environment.getContext(Environment.java:315)
at weblogic.jndi.Environment.getContext(Environment.java:285)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:175)
at com.pega.pegarules.priv.util.JNDIUtil.getInitialContext(JNDIUtil.java:106)
at com.pega.pegarules.priv.util.JNDIUtil.lookupUsingRealContextClassLoader(JNDIUtil.java:128)
at com.pega.pegarules.resadap.RAClient.init(RAClient.java:102)
at com.pega.pegarules.resadap.RAClient.<init>(RAClient.java:84)
at com.pega.pegarules.resadap.RAClientContainer.get(RAClientContainer.java:47)
at com.pega.pegarules.session.internal.async.BatchUtils.callRAClient(BatchUtils.java:146)
at com.pega.pegarules.monitor.internal.UsageDaemonImpl.initialize(UsageDaemonImpl.java:546)
at com.pega.pegarules.session.internal.async.Agent.start(Agent.java:1400)
at com.pega.pegarules.session.internal.mgmt.PRNodeImpl.startNode(PRNodeImpl.java:1520)
at com.pega.pegarules.session.internal.mgmt.PREnvironment.finishInit(PREnvironment.java:533)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:1043)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:765)
at com.pega.pegarules.session.internal.mgmt.PREnvironment.getThreadAndInitialize(PREnvironment.java:379)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.getThreadAndInitialize(PRSessionProviderImpl.java:1516)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineStartup.initEngine(EngineStartup.java:619)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl._initEngine_privact(EngineImpl.java:165)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl.doStartup(EngineImpl.java:138)
at com.pega.pegarules.session.internal.engineinterface.etier.ejb.EngineBean.doStartup(EngineBean.java:120)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethod(PRBootstrap.java:349)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethodPropagatingThrowable(PRBootstrap.java:390)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethodPropagatingException(PRBootstrap.java:412)
at com.pega.pegarules.internal.etier.ejb.EngineBeanBoot.doStartup(EngineBeanBoot.java:130)
at com.pega.pegarules.internal.etier.ejb.EngineBMT_h449u3_ELOImpl.doStartup(EngineBMT_h449u3_ELOImpl.java:124)
at com.pega.pegarules.web.servlet.WebAppLifeCycleListener._contextInitialized_privact(WebAppLifeCycleListener.java:259)
at com.pega.pegarules.web.servlet.WebAppLifeCycleListener.contextInitialized(WebAppLifeCycleListener.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethod(PRBootstrap.java:349)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethodPropagatingThrowable(PRBootstrap.java:390)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethod(PRBootstrap.java:439)
at com.pega.pegarules.internal.web.servlet.WebAppLifeCycleListenerBoot.contextInitialized(WebAppLifeCycleListenerBoot.java:83)
at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1863)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3126)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1512)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:486)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:1267)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:409)
at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: java.net.UnknownHostException: Unknown protocol: 'TCP'
at weblogic.rjvm.RJVMManager.findOrCreateRemoteInternal(RJVMManager.java:216)
at weblogic.rjvm.RJVMManager.findOrCreate(RJVMManager.java:197)
at weblogic.rjvm.RJVMFinder.findOrCreateRemoteServer(RJVMFinder.java:238)
at weblogic.rjvm.RJVMFinder.findOrCreateInternal(RJVMFinder.java:200)
at weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:170)
at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:153)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:353)
... 84 more
2013-06-24 21:16:30,038 [bxapp2.healthnet.com] [ STANDARD] [ ] ( etier.impl.EngineStartup) ERROR - PegaRULES initialization failed. Server: pg-sbxapp2.healthnet.com
com.pega.pegarules.pub.context.InitializationFailedError: PRNodeImpl init failed
at com.pega.pegarules.session.internal.mgmt.PREnvironment.getThreadAndInitialize(PREnvironment.java:387)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.getThreadAndInitialize(PRSessionProviderImpl.java:1516)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineStartup.initEngine(EngineStartup.java:619)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl._initEngine_privact(EngineImpl.java:165)
at com.pega.pegarules.session.internal.engineinterface.etier.impl.EngineImpl.doStartup(EngineImpl.java:138)
at com.pega.pegarules.session.internal.engineinterface.etier.ejb.EngineBean.doStartup(EngineBean.java:120)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethod(PRBootstrap.java:349)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethodPropagatingThrowable(PRBootstrap.java:390)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethodPropagatingException(PRBootstrap.java:412)
at com.pega.pegarules.internal.etier.ejb.EngineBeanBoot.doStartup(EngineBeanBoot.java:130)
at com.pega.pegarules.internal.etier.ejb.EngineBMT_h449u3_ELOImpl.doStartup(EngineBMT_h449u3_ELOImpl.java:124)
at com.pega.pegarules.web.servlet.WebAppLifeCycleListener._contextInitialized_privact(WebAppLifeCycleListener.java:259)
at com.pega.pegarules.web.servlet.WebAppLifeCycleListener.contextInitialized(WebAppLifeCycleListener.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethod(PRBootstrap.java:349)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethodPropagatingThrowable(PRBootstrap.java:390)
at com.pega.pegarules.internal.bootstrap.PRBootstrap.invokeMethod(PRBootstrap.java:439)
at com.pega.pegarules.internal.web.servlet.WebAppLifeCycleListenerBoot.contextInitialized(WebAppLifeCycleListenerBoot.java:83)
at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1863)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3126)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1512)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:486)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:1267)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:409)
at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: com.pega.pegarules.pub.PRRuntimeException: Method Invocation exception
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:1045)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:765)
at com.pega.pegarules.session.internal.mgmt.PREnvironment.getThreadAndInitialize(PREnvironment.java:379)
... 60 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.pega.pegarules.session.internal.PRSessionProviderImpl.doWithRequestorLocked(PRSessionProviderImpl.java:1043)
... 62 more
Caused by: java.lang.NullPointerException
at com.pega.pegarules.session.internal.async.BatchUtils.callRAClient(BatchUtils.java:150)
at com.pega.pegarules.monitor.internal.UsageDaemonImpl.initialize(UsageDaemonImpl.java:546)
at com.pega.pegarules.session.internal.async.Agent.start(Agent.java:1400)
at com.pega.pegarules.session.internal.mgmt.PRNodeImpl.startNode(PRNodeImpl.java:1520)
at com.pega.pegarules.session.internal.mgmt.PREnvironment.finishInit(PREnvironment.java:533)
... 67 more
2013-06-24 21:16:30,051 [bxapp2.healthnet.com] [ STANDARD] [ ] ( etier.impl.EngineStartup) INFO - PegaRULES initialization failed. Server: pg-sbxapp2.healthnet.com
2013-06-24 21:16:30,164 [bxapp2.healthnet.com] [ STANDARD] [ ] (ervlet.WebAppLifeCycleListener) ERROR - Enterprise tier failed to initialize properly, PegaRULES not available
2013-06-24 21:16:30,190 [bxapp2.healthnet.com] [ STANDARD] [ ] (ervlet.WebAppLifeCycleListener) INFO - Web Tier initialization is complete.
<Jun 24, 2013 9:16:30 PM PDT> <Notice> <Log Management> <BEA-170027> <The Server has established connection with the Domain level Diagnostic Service successfully.>
<Jun 24, 2013 9:16:30 PM PDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN>
<Jun 24, 2013 9:16:30 PM PDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING>
<Jun 24, 2013 9:16:30 PM PDT> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 167.238.162.41:8008 for protocols iiop, t3, ldap, snmp, http.>
<Jun 24, 2013 9:16:30 PM PDT> <Notice> <WebLogicServer> <BEA-000330> <Started WebLogic Managed Server "pegamanaged2" for domain "sbxdomain8" running in Production Mode>
<Jun 24, 2013 9:16:31 PM PDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING>
<Jun 24, 2013 9:16:31 PM PDT> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>Greetings,
javax.naming.NameNotFoundException. Root exception is
org.omg.CosNaming.NamingContextPackage.NotFound
=================
Below is the line of my LoginServlet class which is
referred to in the stack trace - Object object =
context.lookup
( "java:comp/env/ejb/WarehouseClerk" );The root of the naming context is 'java:comp/env' and this is where lookup automatically begins for EJBs and resources. IOW, by specifying "java:comp/env/ejb/WarehouseClerk" as the EJB lookup name the server is actually treating this as "java:comp/env/java:comp/env/ejb/WarehouseClerk". Specify only the ejb context ("ejb/WarehouseClerk") in your lookup and you should be fine.
Any help would be most appreciated.
SeanRegards,
Tony "Vee Schade" Cook -
JNDI lookup for external SessionBean fails
Hello, i have a problem i've been trying to solve all day and would appreciate it if you could help me.
I have an Ear file with an EJB Session Bean(EAR: EigenlijstenEar/EJB: EigenlijstenEJB) which i am attempting to use in a servlet in another web/ear (Web: HagaPortalWeb/EAR: HagaPortalEar). I have read and followed the guidance of http://help.sap.com/saphelp_nw04/helpdata/en/55/29ed5eff965448941c0b42f01b9804/frameset.htm, but to no avail.
The error i get is: com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception during lookup operation of object with name webContainer/applications/hagaziekenhuis.nl/HagaPortalEar/HagaPortalWeb/java:comp/env/ejb/EigenlijstenSessionBean, cannot resolve object reference. [Root exception is com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at EigenlijstenEar, the whole lookup name is localejbs/hagaziekenhuis.nl/EigenlijstenEar/EigenlijstenSessionBean.]
my lookup code in a servlet in HagaPortalWeb:
Context ctx = new InitialContext();
EigenlijstenSessionLocalHome eigenlijstenHome =
(EigenlijstenSessionLocalHome) ctx.lookup(
"java:comp/env/ejb/EigenlijstenSessionBean");
content of my web.xml in HagaPortalWeb:
<ejb-local-ref>
<ejb-ref-name>ejb/EigenlijstenSessionBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>nl.hagaziekenhuis.medisurf.ejbs.eigenlijsten.EigenlijstenSessionLocalHome</local-home>
<local>nl.hagaziekenhuis.medisurf.ejbs.eigenlijsten.EigenlijstenSessionLocal</local>
<ejb-link/>
</ejb-local-ref>
content of my application-j2ee-engine.xml in Ear project HagaPortalEar:
<reference
reference-type="hard">
<reference-target
provider-name="hagaziekenhuis.nl"
target-type="application">EigenlijstenEAR</reference-target>
</reference>HI Arie,
If you are accessing enterprise beans with J2EE clients (servlets, JSP, other enterprise beans, J2EE application clients), do not specify and use this arbitrary JNDI name. Instead, define EJB references in the clientsu2019 deployment descriptors and access the beans using these references. For more information, check the following link
http://help.sap.com/saphelp_nw04/helpdata/en/a0/019b3e25f95f14e10000000a114084/content.htm
if the above does not work try the following:--
Try to lookup the Ejb by its JNDI name given in the EJB-J2ee-engine.xml file if it does not exist there give any valid name and try to lookUp.
or try to lookup the ejb by its default jndi name.
"localejbs/bean name>"
http://help.sap.com/saphelp_nw04/helpdata/en/38/3e5a4201301453e10000000a155106/frameset.htm
in the Above link refer the second option "Lookup from a Non-J2EE Java Application"
Siddharth
Edited by: Siddharth Jain on Aug 22, 2008 7:13 AM -
JNDI Lookup for EJB3 (Bean to Bean)
Hi Forum,
i've search the whole internet and two books but I could not find an answer that pleased me.
I want to get a reference to an EJB3 by JNDI Lookup. With container managed dependency injection everything works fine but I have to do a little more generic way, thats why I want to work with JNDI Lookup.
I have the following situation:
At first I have a stateless bean
@Local
public interface Job {
* run the job
* @return true if the job executed without errors
public boolean run(SchedulerConfig schedulerConfig ,JobContext context);
@Local
public interface AConcreteJobLocal extends Job {
//no more declarations
@Stateless
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class AConcreteJobBean implements AConcreteJobLocal {
//implemented methods goes here | removed for better overview in the post
} This is a typical declaration for a bunch of jobs I have. Every concrete job has it's own bean if it necessary in some way for you to know.
So now I wanted to write a bean which returns me an bean instance via a JNDI lookup
@Stateless
public class JobJNDILookupBean implements JobJNDILookupLocal {
Logger logger = Logger.getLogger(JobJNDILookupBean.class.getName());
public Job getJobBeanFromJNDIName(String jndiName) {
Job job = null;
try {
Context c = new InitialContext();
job = (Job) c.lookup("jndiName");
} catch (NamingException ex) {
Logger.getLogger(JobJNDILookupBean.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalArgumentException ex) {
logger.log(Level.SEVERE, "Bean not found", ex);
return job;
}When I call this method I always get a NameNotFoundException
javax.naming.NameNotFoundException: JNDI_NAME_GOES_HERE not found
at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:111)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.vw.ais.dcl.timer.engine.JobJNDILookup.getJobBeanFromJNDIName(JobJNDILookup.java:46)
at com.vw.ais.dcl.timer.engine.EngineBean.init(EngineBean.java:221)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3986)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:197)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:83)
at $Proxy713.init(Unknown Source)
at com.vw.ais.dcl.timer.SchedulerBean.runEngine(SchedulerBean.java:192)
at com.vw.ais.dcl.timer.SchedulerBean.handleIncomingByTimer(SchedulerBean.java:171)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1067)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:176)
at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2895)
at com.sun.ejb.containers.BaseContainer.callEJBTimeout(BaseContainer.java:2824)
at com.sun.ejb.containers.EJBTimerService.deliverTimeout(EJBTimerService.java:1401)
at com.sun.ejb.containers.EJBTimerService.access$100(EJBTimerService.java:99)
at com.sun.ejb.containers.EJBTimerService$TaskExpiredWork.run(EJBTimerService.java:1952)
at com.sun.ejb.containers.EJBTimerService$TaskExpiredWork.service(EJBTimerService.java:1948)
at com.sun.ejb.containers.util.WorkAdapter.doWork(WorkAdapter.java:75)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)I've tried I guess all combinations for the JNDI_NAME
java:/comp/env/ejb/AConcreteJob
java:/comp/env/ejb/AConcreteJobLocal
java:/comp/env/ejb/AConcreteJobBean
java:/comp/env/AConcreteJob
java:/comp/env/full.package.and.Class.name
this all without java:/comp/env
etc.
The only way it worked was when I added a annotation to the JobJNDILookupBean in this way
@Stateless
*@EJB(name="ejb/AConcreteJob",beanInterface=A.Interface.location)*
public class JobJNDILookupBean implements JobJNDILookupLocal {
}But this is not what I want to do. Thats why my question. How can I lookup a bean without annotate it in the bean which want to look it up???
In other words whats wrong here
@Stateless
public class JobJNDILookupBean implements JobJNDILookupLocal {
Logger logger = Logger.getLogger(JobJNDILookupBean.class.getName());
public Job getJobBeanFromJNDIName(String someJndiName) {
Job job = null;
try {
Context c = new InitialContext();
job = (Job) c.lookup("someJndiName");
} catch (NamingException ex) {
Logger.getLogger(JobJNDILookupBean.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalArgumentException ex) {
logger.log(Level.SEVERE, "Bean not found", ex);
return job;
}I hope you understand my question and more than this I hope some has the answer.Hi Zsom,
Zsom wrote:
One thing you need to keep in mind is that beans aren't instantiated every time you make a call to your EJB. You're right! But because the fact the beans are all stateless it doesn't matter. I don't want to get a new EJB at a lookup. If I get a reference to a bean which was used a million times before it is absolutely ok
Zsom wrote:
You might be gaining some time because the container can create new beans more quickly, but you are also looking up the beans before each call, which in the long run will be even more expensive.Mhm, I don't know if I understand you. Maybe I explain my process a little bit. I have a lot of different jobs in my application (JobDoThis, JobDoThat, JobFoo, JobBar). Every job has a own bean which keeps the business logic. Furthermore I have an job engine which is able to execute jobs which are configured to run and this engine can solve some dependencies (If JobFoo fails don't execute JobBar , and so on). When I build my engine I want to get a reference to a jobBean by jndi lookup which keeps the business logic and then call some method on it. This means that the lookup will only be called when I build a new engine. And because this doesn't happen so often performance is not so important. Furthermore if all jobs all configured to run the application needs sometimes more than 12 hours (depended from the amount of data) for one run (Start to End -> the application has a little script character), that's why performance as I said already is not so important.
Zsom wrote:
But it would be worth making some test, because to me it seems a bit like bad design.Yes it could be, but this was my first thought to instantiate a bean (or get a reference to an existing one) dynamically. I don't like this hard coded dependency injection. I mean it's great If you know at compiletime which beans you need. But because we don't know which beans we need it's a big overhead to inject them all by container and then use only 40 percent of the injected bean because for example only 40 of 100 jobs shall run.
If there is another approach to get a reference dynamically which is better than this then I will try, no problem, but unfortunally I don't see another.
Maybe you are looking for
-
Will we be able to link to a SPECIFIC TRACK in iTunes U?
In planning ahead, this question has come up: Will we, when everything is up and running, be able to link to a SPECIFIC TRACK within a course on our Otis iTunes U site? Or will one only be able to link to the WELCOME page then navigate to the desired
-
Using skype on skype wifi while in Japan for calls...
I am subscribed to us and canada plan here in the U.S. I always call Japanese number from here with skype to go number (U.S. number) and it will charge a couple of cents/minute. If I take my iphone to Japan and call on skype wifi, does it still work
-
I'm having trouble with Diablo 2 and wine
I'm running 64 bit Arch, but running bin32-wine-stable from the AUR so I don't think it's a 64 bit issue. Just thought I'd throw that in there in case there's something I've overlooked. I put the CD in and an autorun prompt pops up, when I click ru
-
Loadbalancing for registered program in one host.
We have a SAP ERP 6.0 system on WAS 7.00, on a Solaris 5.10/Oracle 10.2.0.4 platform. In SM59 we have created an entry of type T for a registered server program. A WebMethods server has a listener based on the same program ID. The connection works. P
-
HI All, Ok, here is our situation. We have 5 locations with domain controllers. All Sites are connected via MPLS. ( I have cut the real names) Ligo is the Main Site with PDC and create the site link to this from each site locations. But i kept t