JNDI InitialContext problem:
Hi,
I have problem with to get look up the JDBC Factory.
I have given code below which have been working fine in Sneak Preview SPS11. But It giving some error in SPS14.
code:
Hashtable env = new Hashtable();
env.put("domain", "true");
Context initctx = new com.sapportals.portal.prt.jndisupport.InitialContext(env);
Object obj = initctx.lookup("deployedAdapters/JDBCFactory/shareable/JDBCFactory");
Error:
#com.sap.security.core.policy.PolicyInfoManagerImpl.copyApplicationConfiguration
#Administrator#974####22d400d023ba11dbbd2a00127991cc99
#SAPEngine_Application_Thread[impl:3]_32##0#0#Error#1#/System/Security/WS/SecurityProtocol
#Java###An error occured while copying configurations for application .
Reason: sap.com/LDAPTestEAR#com.sap.engine.frame.core.configuration.NameNotFoundException
#Error##Plain###Processing HTTP request to servlet [LDAPTest] finished with error. <b>The error is: java.lang.NoClassDefFoundError: EDU/oswego/cs/dl/util/concurrent/ConcurrentReaderHashMap</b>
at com.sapportals.portal.prt.jndisupport.util.MemoryHierarchicalContext.prepare(MemoryHierarchicalContext.java:43)
at com.sapportals.portal.prt.jndisupport.util.AbstractHierarchicalContext.<init>(AbstractHierarchicalContext.java:53)
at com.sapportals.portal.prt.jndisupport.util.AbstractHierarchicalContext.<init>(AbstractHierarchicalContext.java:33)
at com.sapportals.portal.prt.jndisupport.util.MemoryHierarchicalContext.<init>(MemoryHierarchicalContext.java:28)
at com.sapportals.portal.prt.jndisupport.JNDISupport.<init>(JNDISupport.java:32)
at com.sapportals.portal.prt.jndisupport.JNDISupport.getInstance(JNDISupport.java:71)
at com.sapportals.portal.prt.jndisupport.NamingManager.findContextFactory(NamingManager.java:164)
at com.sapportals.portal.prt.jndisupport.NamingManager.getInitialContext(NamingManager.java:41)
at com.sapportals.portal.prt.jndisupport.InitialContext.getDefaultInitCtx(InitialContext.java:39)
at com.sapportals.portal.prt.jndisupport.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:59)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.hcl.heiam.LDAPTest.doGet(LDAPTest.java:32)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
Regards,
Krishna.
Hi Amrendra,
I had set clssapath.
This is server classpath.
JAVA_HOME = D:\j2sdk1.4.2_09
CLASSPATH = %CLASSPATH%;%JAVA_HOME%\lib
I have checked as CLASSPATH = %CLASSPATH%;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\jre\lib\rt.jar;
But, same error is coming.
thanks for reply.
Regards,
Krishna.
Similar Messages
-
I have developed a small application that uses a session bean, that sets and gets a message.
If a run the application inside JBuilderX it works just find, but when a create a jar file, only the interface shows up, but the application doesn't communicate with the session bean. I've checked that the application server was running (I'm using JBoss 3.2.5).
The jar file contains all the .class files of my project and the jar files that are in the client directory of JBoss.
I have found that the problem is that the client cannot access the jndi service.
The client code is:
public void initialize() {
try {
Context context = getInitialContext();
Object ref = context.lookup("BeanSesion1");
beanSesion1Home = (BeanSesion1Home) PortableRemoteObject.narrow(ref, BeanSesion1Home.class);
catch(NamingException e) {
e.printStackTrace();
private Context getInitialContext() throws NamingException {
Hashtable environment = new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
environment.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
environment.put(Context.PROVIDER_URL, "jnp://localhost:1099");
return new InitialContext(environment);
The exception NamingException is thrown. It seems that the client cannot found "org.jnp.interfaces.NamingContextFactory", "org.jboss.naming:org.jnp.interfaces" and "jnp://localhost:1099"
(I'm running JBoss server in the same machine I intend to run the client)
I have also tried not to set an initial context with properties. Instead I wrote a jndi.properties file that contains the following
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=jnp://localhost:1099
and put it in the application classpath (for example C:\JBUILDERX\JDK1.4\bin\java -classpath "C:\JBuilderX\proyects\BeanSession\classes;c:\tmp;" beansession.Application
(jndi.properties is in c:\tmp)
This didn't work either.
Does anybody know where the problem is?
thanksYou need to have the foolowing file in your classpath too:
c:\jboss-3.2.?\client\jbossall-client.jar -
Hello Experts,
I have a little problem with my Java programm:
Test remote = null;
* try {*
// Create a new intial context, which loads from jndi.properties file.
* Context ctx = new InitialContext();*
* System.out.println("Context:" + ctx);*
// Look up the home interface using the JNDI name.
// This JNDI lookup returns a reference to an EJBHome instance.
* TestHome home = (TestHome) ctx.lookup("sap.com/TestWorldEar/TestBean");*
* System.out.println("TestHome:" + home);*
// Create a session object.
* remote = home.create();*
* System.out.println("Remote:" + remote);*
// Invoke the remote EJB methods, test and debug.
* System.out.println("Result:" + remote.getWert());*
* } catch (Exception e) {*
* System.out.println("Exception: " + e.getLocalizedMessage());*
I always get the following error and I don't know how to solve the problem.
Exception: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
I hope anybody of you can help me solving this problem.
Additional information:
The Java program is running on a XI (Netweaver 7.0).
I want to get information from a deployed EJB. The Bean still works.
Thank you for your answers in advance!!!
Greetings, AlexanderHi,
this Exception is thrown after this result: Context:javax.naming.InitialContext@cdfc9c and before the lookup.
The complete Stack Trace is:
Exception thrown [Mon Aug 11 10:48:10,187]:Exception thrown by application running in JCo Server
com.sap.engine.services.rfcengine.RFCException: Bean ZEJB_TEST_ZUGRIFF not found
at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:123)
at com.sap.engine.services.rfcengine.RFCJCOServer.handleRequest(RFCJCOServer.java:156)
at com.sap.mw.jco.JCO$Server.dispatchRequest(JCO.java:7701)
at com.sap.mw.jco.MiddlewareJRfc$Server.dispatchRequest(MiddlewareJRfc.java:2376)
at com.sap.mw.jco.MiddlewareJRfc$Server.listen(MiddlewareJRfc.java:1700)
at com.sap.mw.jco.JCO$Server.listen(JCO.java:8061)
at com.sap.mw.jco.JCO$Server.work(JCO.java:8181)
at com.sap.mw.jco.JCO$Server.loop(JCO.java:8128)
at com.sap.mw.jco.JCO$Server.run(JCO.java:8044)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Caused by: com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of ZEJB_TEST_ZUGRIFF.
at com.sap.engine.services.jndi.implserver.ServerContextImpl.lookup(ServerContextImpl.java:649)
at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:344)
at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:639)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:115)
... 12 more -
JNDI Lookup Problem (General Problem)
hi all,
i am newbie on bea products, but i have some experience on java technologies, how i fount on bea documentations and forums many people has the same problem like this, can anybody help us (me)?
problem: how is it possible to write simple client for j2ee server application? i found some posts about jndi lookup, and fount about j2ee client, but is there any doc or example how to write this j2ee client ???
i worked with many application servers and i have no problem with them (JBoss, Sun App Server, IBM Websophere, Oracle AS etc.)
some people told about jndi tree on Web Logic Server Administration console , i found this tree i my session beans looks like :
Binding Name:
TimestenExampleTimestenExample_jarInsertSubscriberBean_InsertSubscriber
Class:
test.InsertSubscriberBean_o7jk9u_InsertSubscriberImpl_1000_WLStub
why is so strange name for class or binding name ????
my session bean name is : InsertSubscriber
and it's implementation : InsertSubscriberBean
how i can lookup from client ?????
can anybody show me code snippet ???
my client looks like :
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NameClassPair;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import org.hibernate.property.Dom4jAccessor.ElementGetter;
public class Client {
public static void main(String[] args) {
Context ctx = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://192.9.200.222:7001");
try {
ctx = new InitialContext(ht);
InsertSubscriber usagefasade = (InsertSubscriber) ctx
.lookup("java:comp/InsertSubscriber");
} catch (NamingException e) {
e.printStackTrace();
} finally {
try {
ctx.close();
} catch (Exception e) {
e.printStackTrace();
}can anybody show me what is there incorrect ????
oo yes and i have weblogic.jar file into my client classpath.Hi,
Your EJB client looks fine.
You should use the JNDI name of your ejb while doing the lookup. i.e :
InsertSubscriber usagefasade = (InsertSubscriber) ctx.lookup("..use JNDI name of EJB...");
You can use the JNDI name of the EJB that you see in the JNDI tree of weblogic. [don't use Binding Name or Class name]. you can also specify the JNDI name by "jndi-name" attribute in weblogic-ejb-jar.xml.
for more info:
http://e-docs.bea.com/wls/docs81/ejb/ejb11.html
Thanks,
Qumar Hussain -
Hi,
I have a client Java application accessing a session EJB in a remote JBoss J2EE server. I'm using JWS 1.2 to deploy my application but when I do a JNDI lookup to get access the the remote's object home interface I get this error:
"Need to specify class name in environment or system property, or as an applet parameter, or in an application resorce file: java.naming.factory.initial"
All the jar files are signed and the JNPL file contains <all-permissions/>. This is the code that triggers the exception
jndiContext = new InitialContext();
homeRMIReference = jndiContext.lookup(C_SERVICE_NAME);
Any help would be appreciated.
Thanks in advance,
RafaelHi,
I've finally found the origin of the problem.
1. JNDI uses a minimum set of properties during initialization phase:
java.naming.factory.initial
java.naming.factory.url.pkgs
java.naming.provider.url
Therefore these properties must be set in the <resource> topic of the JNLP file. The value of these properties is defined in the jndi.properties file that you can find in jbossjmx.ant.jar (within the jboss/client directory)
2. You have to add the JBoss files to your bundle. For doing so I've unjared all the .jar files within the jboss/client directory; afterwards I have jared them in a single file "jboss.jar" and I've signed the file. I've added jboss.jar to the <resource> tag within the JNLP file (Note that I've added all the jboss files just to do quick check but usually you will have to add only those files you need (it doesn't make sense to deploy all JBoss files in each client application)
I hope this helps,
Rafael -
EJB3: JNDI connection problem managed server
Hi all,
In a JUnit test, I tried to look up a Session EJB from a remote managed server:
Hashtable<String, String> props = new Hashtable<String, String>();
props.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
props.put(javax.naming.Context.PROVIDER_URL, "t3://server1.ux.yucom.es:1751");
props.put(javax.naming.Context.SECURITY_PRINCIPAL, "userName");
props.put(javax.naming.Context.SECURITY_CREDENTIALS, "pwd");
props.put(weblogic.jndi.WLContext.ALLOW_EXTERNAL_APP_LOOKUP, "true");
InitialContext context = new InitialContext(props);
Command command = (Command) context.lookup(jndiName);
But the code already fails while instantiating the InitialContext, because of a connection problem:
Caused by: java.net.ConnectException: t3://server1.ux.yucom.es:1751: Destination unreachable; nested exception is:
java.net.ConnectException: Connection timed out: connect; No available router to destination
at weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:203)
at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:153)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:352)
... 34 more
Caused by: java.rmi.ConnectException: Destination unreachable; nested exception is:
java.net.ConnectException: Connection timed out: connect; No available router to destination
at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:464)
at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:315)
at weblogic.rjvm.RJVMManager.findOrCreateRemoteInternal(RJVMManager.java:251)
at weblogic.rjvm.RJVMManager.findOrCreate(RJVMManager.java:194)
at weblogic.rjvm.RJVMFinder.findOrCreateRemoteServer(RJVMFinder.java:225)
at weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:188)
... 36 more
I'm able to connect to the the Admin server... In this case I receive a javax.naming.NameNotFoundException, obviously, since the remote EJB is only targetted on the managed server and not on the admin.
This is confirmed by following little test on the command line:
java -cp %WL_HOME%\server\lib\weblogic.jar weblogic.Admin -url t3://server1.ux.yucom.es:1700 -username <user> -password <pwd> PING
=> OK, packets received
java -cp %WL_HOME%\server\lib\weblogic.jar weblogic.Admin -url t3://server1.ux.yucom.es:1751 -username <user> -password <pwd> PING
=> Failure:
Failed to connect to server1.ux.yucom.es:1751: Destination unreachable; nested exception is:
java.net.ConnectException: Connection timed out: connect; No available router to destination
Does anyone has an idea why the connection to the managed server fails??
Is it a configuration problem in WebLogic?
Thx a lot!
Wim.Hi,
Are you able to Remotely Access any Simple Web Application deployed on "server1.ux.yucom.es:1751".
Example: http://server1.ux.yucom.es:1751/TestApp/index.jsp
If NOT: Means Some where there is a problem with the Port...Just for testing Try Changin Manged Server port to Default HTTP Port (80).
If Yes: Then there are chances that Your Box is not allowing any t3-Protocol Traffic on 1751 Port. Just for Testing Enable HTTP Tunneling on this Server from Admin Console
AdminConsole --> Home-->Summary Of Servers --->ManagedServer1 ---> Protocol (Tab) ---> HTTP (SubTab) --->Enable Tunneling (Check This Check Box) Save the changes.
And then After restarting your Server ... Try to ping your Server using:
java -cp %WL_HOME%\server\lib\weblogic.jar weblogic.Admin -url http://server1.ux.yucom.es:1751 -username <user> -password <pwd> PING
In the Above command Use HTTP protocol instead of T3. If Now u are able to Ping the Server means Your Port 1751 was not allowing any other Protocol except HTTP.
Thanks
Jay SenSharma
http://middlewaremagic.com/weblogic (Middleware magic Is Here) -
Under a stress test load over around 100 users we seem to be able to hang
the WLS 5.1 SP6 server after only a few minutes. A thread dump shows all
execute threads waiting on the initialContext method, where we are
attempting to contact the JNDI service on another WLS 5.1 SP6 server.
Reducing the code down to a simple JSP doing nothing more than constructing
the initialContext and then closing it shows the same problem!
JDK : Sun 1_3_0
Anybody seem this or have any idea? Also have tried using a cached context
but then the problem seems to move to the EJB lookup or business method
invoke. Most strange but rather a show stopper for the scale we are looking
for from the application.Will try to get a copy but I'm off site right now and don't have a copy to
hand. Of the execute threads all had stalled on Object.wait() with the chain
starting from either an initialContext() construction or lookup() method.
Reading around the JNDI Context I get the feeling (a) the service is
syncronised (b) should be called sparingly. In the case we are working with
the Provider_URL is another host.
Rob Woollen <[email protected]> wrote in message
news:[email protected]..
Can you post the thread dump?
-- Rob
Tony Symons wrote:
Under a stress test load over around 100 users we seem to be able to
hang
the WLS 5.1 SP6 server after only a few minutes. A thread dump shows all
execute threads waiting on the initialContext method, where we are
attempting to contact the JNDI service on another WLS 5.1 SP6 server.
Reducing the code down to a simple JSP doing nothing more thanconstructing
the initialContext and then closing it shows the same problem!
JDK : Sun 1_3_0
Anybody seem this or have any idea? Also have tried using a cachedcontext
but then the problem seems to move to the EJB lookup or business method
invoke. Most strange but rather a show stopper for the scale we arelooking
for from the application.--
Coming Soon: Building J2EE Applications & BEA WebLogic Server
by Michael Girdley, Rob Woollen, and Sandra Emerson
http://learnweblogic.com -
JMS JNDI configurtaration problem
IHAC where we are connecting PeopleSoft Integration Broker. Unfortunately PIB doesn't support LDAP for JNDI (go figure). So I have to use a .bindings file.
Problem is, when I run the HelloWorldMessageJNDI I get the following error:
Using file:///tmp/mq for Context.PROVIDER_URL
Looking up Connection Factory object with lookup name: CSoutboundQCF Connection Factory object found.
Looking up Queue object with lookup name: CSoutboundQ Failed to lookup Queue object.
Please make sure you have created the Queue object using the command:
imqobjmgr -i add_q.props
The exception details:
javax.naming.NameNotFoundException: CSoutboundQ
at com.sun.jndi.fscontext.RefFSContext.getObjectFromBindings(RefFSContext.java:400)
at com.sun.jndi.fscontext.RefFSContext.lookupObject(RefFSContext.java:327)
at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
at javax.naming.InitialContext.lookup(Unknown Source)
at HelloWorldMessageJNDI.<init>(HelloWorldMessageJNDI.java:187)
at HelloWorldMessageJNDI.main(HelloWorldMessageJNDI.java:120)It's looks almost as the same as my problem in web app., when I forgot wrote tags <resource-env-ref in web.xml..
e.g. web.xml
<resource-env-ref>
<resource-env-ref-name>jms/MainQueue</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
</resource-env-ref>
<resource-ref>
<res-ref-name>jms/MainQueueConnectionFactory</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
</resource-ref>
.... -
Leak in default jndi InitialContext
WebLogic Build: 4.5.1 Service Pack 7 02/16/2000 15:17:50 #63218
OS: both solaris and windows.
There appears to be a leak when creating the default jndi initial context
from multiple
threads. As a quick demonstration of this problem, the following code from a
JSP served by the Weblogic server:
<HTML>
<HEAD>
<TITLE>Debug</TITLE>
<%@ page import="javax.naming.InitialContext" %>
</HEAD>
<BODY>
<H1>Debug</H1>
<%
for (int i=0; i<100; i++) {
Thread t = new Thread() {
public void run() {
try { new InitialContext(); } catch (Exception ex)
{ex.printStackTrace(); }
private byte buf[] = new byte[100000];
t.start();
try { t.join(); } catch (Exception ex) {ex.printStackTrace();}
t = null;
System.gc();
out.println("Avail mem is "+Runtime.getRuntime().freeMemory());
out.println("<br>");
%>
</BODY>
</HTML>
Returns a steadily diminishing amount of memory
Avail mem is 43085112
Avail mem is 43059888
Avail mem is 42959488
Avail mem is 42858992
Avail mem is 42758496
Avail mem is 42658000
Avail mem is 42557504
Avail mem is 42457008
Avail mem is 42354288
Avail mem is 42256016
The memory never gets gc'ed, and eventually Bad Things(TM) happen.
Has anyone encountered this behaviour? Workarounds? Patches?
Thanks,
-kb-
PS: Apologies to the very helpful support folks at Weblogic -- I just sent
them a separate email, but this is
turning into a critical last-minute problem, so instead of waiting, I'm also
polling everyone on the
news-groups.The problem remains even with the .close()
I've been informed by Weblogic support that creating user-threads within the
Weblogic server is not supported.
My Optimizeit traces appear to indicate that the leak arises from Weblogic
using the Thread.currentThread() object to index a static Thread-local cache
that contains
various interesting bits of information pertinent to the current thread.
(Thus Thread objects
are never garbage-collectable once you use 'most any Weblogic implemented
services within
the thread.)
The workaround support suggested was essentially to run the task
using one of the threads they keep in their execute-thread pool.
The mechanics of their recommendation is to use the Weblogic Time service to
.run() a
Runnable within a Triggerable task (and schedule it ASAP).
Time service tasks are run using a free thread within their execute-thread
pool, so
I speculate the "leak" is then invisible, because all the action happens
within a
fixed set of threads. (Weblogic apparently never idles out any of execute
threads,
so they cannot be GC'ed anyway, and re-using them re-uses the Thread-local
cache.)
Regards,
-kb-
Alex <[email protected]> wrote in message
news:[email protected]...
You might try closing your context in a finally block - context.close().
That usually seems to be a good thing. But this is a guess.
KB Sriram <[email protected]> wrote in message
news:[email protected]...
WebLogic Build: 4.5.1 Service Pack 7 02/16/2000 15:17:50 #63218
OS: both solaris and windows.
There appears to be a leak when creating the default jndi initial
context
from multiple
threads. As a quick demonstration of this problem, the following codefrom
a
JSP served by the Weblogic server:
<HTML>
<HEAD>
<TITLE>Debug</TITLE>
<%@ page import="javax.naming.InitialContext" %>
</HEAD>
<BODY>
<H1>Debug</H1>
<%
for (int i=0; i<100; i++) {
Thread t = new Thread() {
public void run() {
try { new InitialContext(); } catch (Exception ex)
{ex.printStackTrace(); }
private byte buf[] = new byte[100000];
t.start();
try { t.join(); } catch (Exception ex) {ex.printStackTrace();}
t = null;
System.gc();
out.println("Avail mem is "+Runtime.getRuntime().freeMemory());
out.println("<br>");
%>
</BODY>
</HTML>
Returns a steadily diminishing amount of memory
Avail mem is 43085112
Avail mem is 43059888
Avail mem is 42959488
Avail mem is 42858992
Avail mem is 42758496
Avail mem is 42658000
Avail mem is 42557504
Avail mem is 42457008
Avail mem is 42354288
Avail mem is 42256016
The memory never gets gc'ed, and eventually Bad Things(TM) happen.
Has anyone encountered this behaviour? Workarounds? Patches?
Thanks,
-kb-
PS: Apologies to the very helpful support folks at Weblogic -- I just
sent
them a separate email, but this is
turning into a critical last-minute problem, so instead of waiting, I'malso
polling everyone on the
news-groups. -
Jndi lookup problem between weblogic 6.1 and 8.1
Hello,
I have a portal application running in weblogic 6.1(sp2). It needs to lookup a
Stateless Session Bean which is deployed in Weblogic 8.1.
I have the 8.1 version ejb client jar in my WEB-INF/lib
Here is my code:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.TengahInitialContextFactory");
env.put(Context.PROVIDER_URL, "t3://server1.abc.com:port);
ctx = new InitialContext(env);
Object objref = ctx.lookup(EJBJNDI_NAME);
mEJBHome = (EJBServiceHome)PortableRemoteObject.narrow(objref, EJBServiceHome.class);
mEJBService=mEJBHome.create();
An exception occurred during the ctx.lookup call:
javax.naming.CommunicationException. Root exception is java.rmi.UnmarshalException:
Problem finding error class; nested exception is:
java.lang.ClassNotFoundException: java.lang.StackTraceElement
java.lang.ClassNotFoundException: java.lang.StackTraceElement
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClass
Loader.java:180)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAw
areClassLoader.java:68)
What troubles me is that the exact same code worked for a regular web application
(web1.war), but not the portal application (portal1.war). Both web1.war and portal1.war
are inside app.ear
Please help!! Any guess/suggestions are welcome.
Thank you!
EllenHi,
All I can say is Weblogic6.1 doesnot use JDK1.4 compared to Weblogic8.1, hence the class java.lang.StackTraceElement is not found when the object is executed in 6.1.
This is clue which you may like to take forward for debugging your application.
Thanks. -
Looking for tips on a OC4J/JNDI lookup problem
Hello All,
I am running into a situation where a user I have setup in Oracle Enterprise Manager 10G Instance Level Security is not able to access our JNDI resources. We have tried providing all the roles(including administrators) to this user, but to no success. For some reason it works in standalone though.
Our exception is fired when deploying the application and the spring configuration tells the app to fetch the jms connection factory from JNDI.
Caused by: javax.naming.NoPermissionException: Not allowed to look up jms/ConnectionFactory, check the namespace-access tag setting in orion-application.xml for details
+ at com.evermind.server.rmi.RMIClientConnection.handleLookupResponse(RMIClientConnection.java:873)+
+ at com.evermind.server.rmi.RMIClientConnection.handleOrmiCommandResponse(RMIClientConnection.java:337)+
+ at com.evermind.server.rmi.RMIClientConnection.dispatchResponse(RMIClientConnection.java:296)+
+ at com.evermind.server.rmi.RMIClientConnection.processReceivedCommand(RMIClientConnection.java:278)+
+ at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.java:152)+
+ at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnection.java:127)+
+ at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)+
+ at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)+
+ at java.lang.Thread.run(Thread.java:595)+
+ at com.evermind.server.rmi.RMICall.warningExceptionOriginatesFromTheRemoteServer(RMICall.java:109)+
+ at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:91)+
+ at com.evermind.server.rmi.RMIClientConnection.waitForJndiResponse(RMIClientConnection.java:425)+
+ at com.evermind.server.rmi.RMIClientConnection.lookup(RMIClientConnection.java:233)+
+ at com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:302)+
+ at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:56)+
+ ... 43 more+
I wonder if there is a specific role that OC4J is looking for to allow the app to use JNDI? One thread I read earlier mentioned granting the user RMI permission. Any tips on where this could be configured?
Our namespace section of the orion application xml file is below...
<namespace-access>
<read-access>
<namespace-resource root="">
<security-role-mapping name="<jndi-user-role>">
<group name="administrators" />
</security-role-mapping>
</namespace-resource>
</read-access>
<write-access>
<namespace-resource root="">
<security-role-mapping name="<jndi-user-role>">
<group name="administrators" />
</security-role-mapping>
</namespace-resource>
</write-access>
</namespace-access>
Any thoughts or recommendations for isolating and troubleshooting the problem would be highly appreciated.
Many Thanks in Advance Guys!What Mylenium said. Although, perhaps with Forge Freeform and a huge amount of work, you might be able to fake it.
-
JNDI Naming Problem accessing Session Bean from Message Driven Bean
Hi,
I am facing a very strange problem in JNDI look up accessing a Session Bean from a Message Driven Bean. I have a session fa�ade bean(Remote Bean) which is being called from Struts Action class getting the home reference from the ServiceLocator (I have implemented ServiceLocator pattern to obtain JNDI reference for all EJBs). When I am calling the session fa�ade EJB from the Struts Action class everything is working fine.
But when I am trying to call the same EJB from my Message Driven Bean, I am getting a JNDI exception (NameNotFoundException - No Object bound to name �java:comp/env/ejb/EJBJNDIName�). I am trying to get the remote reference from the same ServiceLocator which is successfully providing me a reference while calling from the struts action class. But the same ServiceLocator is not able to provide me a reference while calling from the Message Driven Bean. If I use the JNDI name directly like �EJBJNDIName� in the lookup it is working fine. The lookup for the name is working fine and I am able to call the Session Fa�ade bean with that reference.
I am really not sure what exactly the problem is. If I have any problem in the ServiceLocator, it should have given me the same error while calling from Struts Action class. But it is working fine with the full name �java:comp/env/ejb/EJBJNDIName� calling from the struts action class. I am not sure whether Message Driven Bean has something to do with it. Why I am not able to get a reference of the EJB with the full name? Please Help.
Thanks
AmitHi Bhagya,
Thanks for your response. I think from EJB container we can call Local EJBs with the full JNDI name. The session facade bean which is being called is a remote bean. From the session facade bean I am calling a local stateless session bean for database access. I am getting the reference of the local EJB from my session facade bean with full JNDI name "java:comp/env/ejb/EJBJNDIName". It is working fine with out any problem. My servicelocator is able to provide me the reference of the local EJB from the session facade remote bean with Full JNDI name. I am only having this problem calling from the MDB. I am really not sure whether what is causing it?
Thanks
Amit -
I am using the JNDI API for working with the OpenLDAP server, and I have the following problem: when adding entries through the JNDI API, these entries can be retrieved and everything works ok. If I try adding entries with another directory client, or through an .ldif file, these entries cannot be found(retrieved) through JNDI... The entries look the same in the server (they are stored in the same place, they have the same attributes....), but the JNDI client finds only the entries that were added through the JNDI API... Can anyone help?
Thank you in advanceI am using the JNDI API for working with the OpenLDAP server, and I have the following problem: when adding entries through the JNDI API, these entries can be retrieved and everything works ok. If I try adding entries with another directory client, or through an .ldif file, these entries cannot be found(retrieved) through JNDI... The entries look the same in the server (they are stored in the same place, they have the same attributes....), but the JNDI client finds only the entries that were added through the JNDI API... Can anyone help?
Thank you in advance -
I'm developing a simple struts app in JDeveloper where the model component connects to an Oracle database. The webapp works fine when I deploy it... I just want to get it running locally in the embedded OC4J server. I get this stack trace error:
javax.naming.NameNotFoundException: java:/comp/env not found
at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:164)
at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:333)
at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:120)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at lsqtms.LoginModel.checkLoginAgainstDB(LoginModel.java:34)
at lsqtms.LoginAction.execute(LoginAction.java:45)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:649)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
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:192)
at java.lang.Thread.run(Thread.java:534)
Here is my code to access this connection pool:
Context initContext = new InitialContext();
Context envContext = (Context) initContext.lookup("java:/comp/env"); //error occurs here
javax.sql.DataSource ds = (javax.sql.DataSource) envContext.lookup("Oracle");
Connection conn = ds.getConnection(); // retreive db connection from pool
I've tried to edit the OC4J preferences for the DataSource and JNDI and data-sources.xml... no luck...
I read the OC4J article on datasources and I'm not really sure what I'm doing - I apologize for being a "newbie." How can I fix this so that I can write and debug code locally.
Thanks
DougTo web.xml add
<resource-ref>
<res-ref-name>jdbc/OracleDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>Obtaing Connection with
InitialContext initialContext = new InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource)initialContext.lookup("java:comp/env/jdbc/OracleDS");
java.sql.Connection conn = ds.getConnection(); -
JNDI lookup problem in WAS 5.1
Hello all,
I have generated an EAR using XDoclet and MyEclipse. When I deploy this EAR on WAS 5.1, I get the following exception:
javax.naming.NameNotFoundException: Context: WarHog/nodes/WarHog/servers/server1, name: ejb/TEDIObjectManagerLocal: First component in name TEDIObjectManagerLocal not found. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at com.ibm.rmi.iiop.CDRInputStream.readBoxedIDLEntity(CDRInputStream.java:2112)
at com.ibm.rmi.iiop.CDRInputStream.readIDLValue(CDRInputStream.java:2177)
at com.ibm.rmi.iiop.CDRInputStream.fast_read_value(CDRInputStream.java:1734)
at com.ibm.rmi.io.IIOPInputStream.readValueType(IIOPInputStream.java:2085)
at com.ibm.rmi.io.IIOPInputStream.readObjectField(IIOPInputStream.java:2057)
at com.ibm.rmi.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:1765)
at com.ibm.rmi.io.IIOPInputStream.inputObjectUsingClassDesc(IIOPInputStream.java:1348)
at com.ibm.rmi.io.IIOPInputStream.continueSimpleReadObject(IIOPInputStream.java:420)
at com.ibm.rmi.io.IIOPInputStream.simpleReadObjectLoop(IIOPInputStream.java:404)
at com.ibm.rmi.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:347)
at com.ibm.rmi.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:200)
at com.ibm.rmi.iiop.CDRInputStream.read_value(CDRInputStream.java:1367)
at com.ibm.rmi.util.ProxyUtil.copyObject(ProxyUtil.java:450)
at com.ibm.CORBA.iiop.UtilDelegateImpl.copyObject(UtilDelegateImpl.java:789)
at javax.rmi.CORBA.Util.copyObject(Util.java:333)
at com.wdc.tedi.interfaces._TransformationEngine_Stub.transform(_TransformationEngine_Stub.java:268)
at com.wdc.tedi.web.TestHarnessBean.translate(TestHarnessBean.java:42)
at com.wdc.tedi.web.TestHarnessBean.setDataBlob(TestHarnessBean.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)First of all, I don't really understand what the error means. Is it that the JNDI lookup failed when one of my beans tried to do a lookup on 'ejb/TEDIObjectManagerLocal'? I believe there's some configuration that went wrong (EJB reference binding or something) when I deployed the EAR. The reason I don't think it's a faulty code is because the EAR runs like a charm when I deploy it on Oracle 10g and Weblogic.
I am really stuck on this problem and shall appreciate any help that I can get. I can send the code, xdoclet tags and configuration if that might assist someone.
Thanks
-ybh6336Hello all,
I'm still stuck on this issue. Following are the entries related to my
application when I do a 'dumpNameSpace':
28 (top)/nodes/WarHog/servers/server1/ejb/tedi/TEDIObjectManager
28
com.wdc.tedi.interfaces._TEDIObjectManagerHome_Stub
29 (top)/nodes/WarHog/servers/server1/ejb/tedi/DSValueLookup
29
com.wdc.tedi.interfaces._DSValueLookupHome_Stub
30 (top)/nodes/WarHog/servers/server1/ejb/tedi/TransformationEngine
30
com.wdc.tedi.interfaces._TransformationEngineHome_StubObservations:
- I only see the namespace entries for my Session beans. There's one
entity bean also which does not show up.
- I don't see anything for the Local Home interfaces, it shows only the
Home interfaces.
As additional information, I'm looking up 'TEDIObjectManagerLocal'
using 'ejb/TEDIObjectManagerLocal'. I also tried using 'local:ejb/ejb/TEDIObjectManagerLocal' (as Karthyk suggested) and
'java:comp/env/ejb/TEDIObjectManagerLocal', but that does not work
either.
Also, the XDoclet tags that I use to generate the interfaces for
TEDIObjectManager bean are as follows:
/* @ejb.bean name="TEDIObjectManager"
* display-name="TEDIObjectManager"
* description="TEDIObjectManager"
* jndi-name="ejb/tedi/TEDIObjectManager"
* local-jndi-name="ejb/TEDIObjectManagerLocal"
* type="Stateless"
* view-type="both"
* @ejb.util generate="physical"
* @ejb.ejb-ref ejb-name="TEDIObject"
* view-type = "local"
* ref-name = "ejb/TEDIObjectLocal"
* @oc4j.bean jndi-name="ejb/tedi/TEDIObjectManager"
*/My ejb-jar.xml looks like following for that bean:
<session >
<description><![CDATA[TEDIObjectManager]]></description>
<display-name>TEDIObjectManager</display-name>
<ejb-name>TEDIObjectManager</ejb-name>
<home>com.wdc.tedi.interfaces.TEDIObjectManagerHome</home>
<remote>com.wdc.tedi.interfaces.TEDIObjectManager</remote>
<local-home>com.wdc.tedi.interfaces.TEDIObjectManagerLocalHome</local-home>
<local>com.wdc.tedi.interfaces.TEDIObjectManagerLocal</local>
<ejb-class>com.wdc.tedi.ejb.TEDIObjectManagerSession</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref >
<ejb-ref-name>ejb/TEDIObjectLocal</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>com.wdc.tedi.interfaces.TEDIObjectLocalHome</local-home>
<local>com.wdc.tedi.interfaces.TEDIObjectLocal</local>
<ejb-link>TEDIObject</ejb-link>
</ejb-local-ref>
</session>AND following for the bean that is referencing it:
<session >
<description><![CDATA[TransformationEngine]]></description>
<display-name>TransformationEngine</display-name>
<ejb-name>TransformationEngine</ejb-name>
<home>com.wdc.tedi.interfaces.TransformationEngineHome</home>
<remote>com.wdc.tedi.interfaces.TransformationEngine</remote>
<local-home>com.wdc.tedi.interfaces.TransformationEngineLocalHome</local-home>
<local>com.wdc.tedi.interfaces.TransformationEngineLocal</local>
<ejb-class>com.wdc.tedi.ejb.TransformationEngineSession</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref >
<ejb-ref-name>ejb/TEDIObjectManagerLocal</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.wdc.tedi.interfaces.TEDIObjectManagerLocalHome</local-home>
<local>com.wdc.tedi.interfaces.TEDIObjectManagerLocal</local>
<ejb-link>TEDIObjectManager</ejb-link>
</ejb-local-ref>
</session>The entries in ibm-ejb-jar-bnd.xmi (generated using MyEclipse) are as
follows for the two beans:
<ejbBindings
xmi:id="Session_bnd_1"
jndiName="ejb/tedi/TransformationEngine">
<ejbRefBindings xmi:id="EJBRefBnd_1"
jndiName="ejb/TEDIObjectManagerLocal">
<bindingEjbRef href="META-INF/ejb-jar.xml#EJBLocalRef_1"/>
</ejbRefBindings>
<enterpriseBean
xmi:type="ejb:Session"
href="META-INF/ejb-jar.xml#Session_TransformationEngine" />
</ejbBindings>
<ejbBindings
xmi:id="Session_bnd_3"
jndiName="ejb/tedi/TEDIObjectManager">
<ejbRefBindings xmi:id="EJBRefBnd_2"
jndiName="ejb/TEDIObjectLocal">
<bindingEjbRef href="META-INF/ejb-jar.xml#EJBLocalRef_2"/>
</ejbRefBindings>
<enterpriseBean
xmi:type="ejb:Session"
href="META-INF/ejb-jar.xml#Session_TEDIObjectManager" />
</ejbBindings>I know I'm swamping the post with code, but please let me know if anyone finds something unusual.
NOTE: When deploying on WAS, in the 'Map EJB references to beans' step, I'm giving the following values for 'TransformationEngine' bean:
Reference binding: ejb/TEDIObjectManagerLocal
JNDI Name: ejb/tedi/TEDIObjectManager
There's one other similar binding that works for 'TEDIObjectManager'
bean:
Reference binding: ejb/TEDIObjectLocal
JNDI Name: ejb/TEDIObject
Everything in ejb-jar and ibm-ejb-jar-bnd.xmi look similar for this working bean, there is one difference though, I do the lookup on this one using 'java:comp/env/ejb/TEDIObjectLocal', but I've already tried that for the other one.
Really appreciate your time.
Thanks
-yogesh
Maybe you are looking for
-
How to know debit and credit transaction key for movement type
Hi, With T. code OMWB account assignment simulation we can see all the accounts which are involve for debit and credit enties but I want to know is there any T. code or method with which we can know which transaction key will be debit and which
-
Duplicate files appearing in Windows Photo Gallery under Vista Home Basic.
I am suffering a bout of duplications in my Windows Photo Gallery under Vista. I am getting duplicates, triplicates and quadruple versions of the original file. Despite turning off all Autoplay media types to 'No Action', I get random duplicates when
-
MacBook Pro Retina Late 2013 Compatibility issue with Bose Companion 5 USB Speakers on Mavericks
Hi, I wonder if somebody has compatibility issues of new MacBook Pro Retina (late 2013) and Bose Companion 5 USB speakers? They work fine on a left USB port on my MacBook Pro, but doesn't work at all on a right one: USB speakers are not recognised or
-
I want to change the background colour of certain sentences in an e-mail (on my MacBook Air). I'm sure I've done this before, but I forget how. Hope someone can help me. Thank you. Jill
-
Pixelated images in Express HD
Hey all! I'm in the midst of making a sort of animated graphic novel-type movie with Express HD. I've been learning a lot of stuff through booklets and things like that, and have come quite a long way in as little as a week. One of the main problems,