Connecting to an EJB using an standalone client
I'm trying to connect to an ejb deployed on my Application server (not standalone). But i always get the exception: javax.naming.AuthenticationException: No such domain/application
To make sure everyting was ok, i followed the recipe described in: http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=232123.1
But get same exception: C:\Servers\oc4j\j2ee\home>java -jar applicationlauncher.jar ormi://fsddappt01:3101/LOTTO_TEST_APP/client1.jar admin welcome 1
Error: Lookup error: javax.naming.AuthenticationException: No such domain/application: LOTTO_TEST_APP; nested exception is:
javax.naming.AuthenticationException: No such domain/application: LOTTO_TEST_APP
Anyone has any suggestion on what's the problem?
Cant find any topics on internet describing this error :-(
Oeyvin J.
Same error.
The real application (web and ejb's) are running on the same OC4J instance. The Web client are accessing the ejb's on port 3101, so i think this is the correct rmi port.
The server is a part of an infrastructure that are running on the same server, the server is one of two ApplicationServers that the infrastructure (farm) is controlling.
each server has an instance name, the server i was deplying to has name instance2. Maybe i have to give a reference to to the instance?
Similar Messages
-
Cant connect to Oracle database using oracle db client
Hi All,
I recently created a virtual machine running windows server 2008 on my windows 7 host. Oracle database 11g is already installed on host OS(windows 7) and I have installed oracle 11g client on the guest OS(windows server 2008) and trying to connect to oracle database from remote server using oracle client but getting this error:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATAI am trying to connect using oracle client as below:
C:\Users\Administrator>SET ORACLE_SID = HR84DEV
C:\Users\Administrator>SQLPLUS /NOLOG
SQL*Plus: Release 11.2.0.1.0 Production on Fri Feb 10 06:16:34 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL> CONNECT SYSADM/[email protected]
ERROR:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
I have created database with name - HR84DEV
HOST ip address is - 192.168.56.1
I googled this error and as most of resources/blogs talked about having correct entry on listner.ora and tnsnames.ora file, I did the changes on both of these files accordingly.
PFB the cotent of both of these files:
tnsnames.ora
# tnsnames.ora Network Configuration File: C:\MyApps\Oracle\product\11.2.0\dbhome_\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.1)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
HR84DEV =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.1)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = HR84DEV)
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
listner.ora
# listener.ora Network Configuration File: C:\MyApps\Oracle\product\11.2.0\dbhome_\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\MyApps\Oracle\product\11.2.0\dbhome_)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\MyApps\Oracle\product\11.2.0\dbhome_\bin\oraclr11.dll")
(SID_DESC =
(SID_NAME = HR84DEV)
(ORACLE_HOME = C:\MyApps\Oracle\product\11.2.0\dbhome_)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\MyApps\Oracle\product\11.2.0\dbhome_\bin\oraclr11.dll")
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.1)(PORT = 1521))
ADR_BASE_LISTENER = C:\MyApps\Oracle
Please not that I dont have any problem in connect to database locally.Thanks Nicolas,
Actually, there was a problem with my oracle client installation. I uninstalled it and then installed back again but still, even after following your instructions I get some error.
Here what I did:
Created tnsnames.ora file as below:
HR84DEV =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.1)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = HR84DEV)
Placed it under appropriate directory and then checked the connection with database using the command shown below:
C:\Users\Administrator>tnsping HR84DEV
TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 10-FEB-2
012 08:42:03
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
C:\MyApps\Administrator\product\11.2.0\client_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = 192.168.56.1)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = HR84DEV)))
OK (20 msec)
Then tried to connect to database as below:
C:\Users\Administrator>SET ORACLE_SID=HR84DEV
C:\Users\Administrator>SQLPLUS /NOLOG
SQL*Plus: Release 11.2.0.1.0 Production on Fri Feb 10 08:25:56 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL> CONNECT SYSADM/SYSADM@HR84DEV
ERROR:
ORA-28547: connection to server failed, probable Oracle Net admin error
But still getting error.
I Googled this error and tried to figure out what the problem is and came across the possible cause which is because I haven't specify that the service should run as a user who is in domain admin group.
well, I am not really sure about this and dont know what user name and password I should enter in OracleserviceHR84DEV-properties-log on-this account.
do I really need to set this? -
GlassFish v3, EJB 3.1 and Standalone Client
hi team.
I'm very glad releasing javaee 6.
I download netbeans 6.8 with GlassFish v3 and try to write simple ejb 3.1 application.
ejb module deployed successfully without any problem, after this I've created new simple java application and try to call ejb 3.1 session bean.
but no success.
can anybody show me sample code how to call ejb 3.1 from standalone client ??
I was working with ejb 3.0 and jboss. I had not any problem from standalone client.
ejb 3.0 standalone client for jboss:
Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url", "localhost:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
InitialContext ctx = new InitialContext(env);
SomeSessionInt sBean = (SomeSessionInt)ctx.lookup("SomeSessionBean/remote");can anybody tell me which client jars are required for client application and what is the environment properties should i set ?
PS.
Also i tried to make enterprise application with ejb and web module into netbeans. but there wasn't any problem to inject ejb session bean from jsf managed bean. problem is how to lookup ejb from standalone client.
any ideas will be appreciated.
Regards,
Paata Lominadze.also i can post my full example with error stacktrace.
1.session bean (interface not required , as we know from spec.)
public class MySessBean {
public String sayHello(String name) throws Exception {
System.out.println("Method initialized.");
return "Hello : " + name;
}2.Standalone java client
public class Main {
public static void main(String[] args) {
try {
Properties jndiProps = new Properties();
jndiProps.put("java.naming.factory.initial", "com.sun.enterprise.naming.impl.SerialInitContextFactory");
jndiProps.put("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
jndiProps.put("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
jndiProps.setProperty("org.omg.CORBA.ORBInitialHost", "127.0.0.1");
jndiProps.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
Context ctx = new InitialContext(jndiProps);
System.out.println(ctx.lookup("java:global/MyEJBModule/MySessionBean"));
MySessionBean mySessionBean = (MySessionBean)ctx.lookup("java:global/MyEJBModule/MySessionBean");
mySessionBean.sayHello("Paata");
} catch (Exception e) {
e.printStackTrace();
}3. error stacktrace on server side:
WARNING: "IOP00100006: (BAD_PARAM) Class com.magti.billing.ejb.__EJB31_Generated__MySessionBean__Intf____Bean__ is not Serializable"
org.omg.CORBA.BAD_PARAM: vmcid: OMG minor code: 6 completed: Maybe
at com.sun.corba.ee.impl.logging.OMGSystemException.notSerializable(OMGSystemException.java:990)4.client side error stacktrace:
Dec 14, 2009 9:15:13 AM com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
Dec 14, 2009 9:15:18 AM com.sun.enterprise.naming.impl.SerialContext lookup
SEVERE: enterprise_naming.serialctx_communication_exception
Dec 14, 2009 9:15:18 AM com.sun.enterprise.naming.impl.SerialContext lookup
SEVERE:
java.rmi.MarshalException: CORBA BAD_PARAM 1330446342 Maybe; nested exception is:
java.io.NotSerializableException: ----------BEGIN server-side stack trace----------
org.omg.CORBA.BAD_PARAM: vmcid: OMG minor code: 6 completed: Maybe
at com.sun.corba.ee.impl.logging.OMGSystemException.notSerializable(OMGSystemException.java:990)
at com.sun.corba.ee.impl.logging.OMGSystemException.notSerializable(OMGSystemException.java:1005)
at com.sun.corba.ee.impl.orbutil.ORBUtility.throwNotSerializableForCorba(ORBUtility.java:753)
at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.writeAny(Util.java:370)_____________________________
Regards,
Paata Lominadze. -
Connect to Oracle 9i server using oracle 11g client
Hi,
my oracle 9i server is on unix machine.
I got new Window 7 64 bit machine for .NET code development(framework 4.0).It is having Oracle 11G installed.I am getting oracle connection error while running .NET application.
what changes (connection string/tnsnames.ora/others) will I have to do to connect Oracle 9i server using oracle 11g client ?Hi,
Please post the complete error stack you are getting.
Regards
Yoonas -
OS_USER not correct when connecting using JDBC Thin Client on 10G
Hi Folks,
We are migrating an application from a 9i database to 10g and have a problem that someone might have come across before.
The application is a Java applet based application that connects to the database using JDBC Thin client. on 9i the OS_USER comes up as the user running the applet but in 10G it is coming up as the user account that installed 10G on the DB server.
We tried using a 9i client to identify if it was a client or DB issue but its the same problem with the 9i client connecting to the 10G DB.
If anyone can help it would be much appreciated.
Thanks,
John.What is the return of this command?
SELECT sys_context ('USERENV', 'OS_USER') FROM dual;
Is it the DB user or the OS user? -
Issue connecting to beehive svr using thunderbird and zimbra desktop client
I have setup beehive server (over linux) and the installation went successful. Even i am able to access email accounts via the zimbra webclient. However when i try to configure thunderbird or zimbra desktop client to access the same mail account both return error saying "could not connect to mail server; the connection was refused".
There is a proxy server setup in the LAN here and i have put the server IP in the ignore list still i get the same error (firewal and antivirus are also turned off). Any suggestions what might be wrong with my setup?
Thanks.I applied the post install steps and got past the above stated hurdle. Now i am able to connect to beehive server using the thunderbird client and receive emails. But still one issue: I am not able to send emails.
When i try to send an email from Thunderbird client i get a error pop-up saying: "Sending of message failed. The message could not be sent because connecting to SMTP server bee-server.mydomain.com failed. The server may be unavailable or is refusing SMTP connections. ..."
Not sure if this has anything to do with the issue but just something that i noticed:
When i run "beectl list_ports" command the 'property name' for both IMAP and SMTP protocols are set to same name "Port". Is it this that may be causing the problem?? If so how to change this to a different property name? -
Reconnect remote EJB using ORMI through RMI Tunnel
Hello!
My client application connecting to server EJB using ORMI.
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "admin".toUpperCase());
env.put(Context.SECURITY_CREDENTIALS, passwordEncoder.encodePassword("admin", null).toUpperCase());
env.put(Context.PROVIDER_URL, "ormi:http://host:7777/application");
First connection passed. All works.
But if connection between client and server broken, then client must reconnect to server... But it can't.
Client pending and not response.
I dump threads on client pending:
First thread:
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x230962d8> (a java.lang.Object)
at EDU.oswego.cs.dl.util.concurrent.LinkedQueue.poll(LinkedQueue.java:192)
- locked <0x230962d8> (a java.lang.Object)
at oracle.oc4j.rmi.tunnelling.TunnelledRmiTransport$PluggableInputStream.read(TunnelledRmiTransport.java:208)
- locked <0x2308ac90> (a oracle.oc4j.rmi.tunnelling.TunnelledRmiTransport$PluggableInputStream)
at oracle.oc4j.rmi.tunnelling.TunnelledRmiTransport$PluggableInputStream.read(TunnelledRmiTransport.java:190)
- locked <0x2308ac90> (a oracle.oc4j.rmi.tunnelling.TunnelledRmiTransport$PluggableInputStream)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
- locked <0x2308cd68> (a java.io.BufferedInputStream)
at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2249)
at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2429)
at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2499)
at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2571)
at java.io.ObjectInputStream.read(ObjectInputStream.java:820)
at com.evermind.server.rmi.RMIConnection.readCommand(RMIConnection.java:162)
at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.java:149)
at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnection.java:127)
at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:814)
at java.lang.Thread.run(Thread.java:619)
Second thread:
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x229c0bc8> (a com.evermind.server.rmi.RMICall)
at java.lang.Object.wait(Object.java:485)
at com.evermind.server.rmi.RMIClientConnection.waitForResponseFromServer(RMIClientConnection.java:758)
- locked <0x229c0bc8> (a com.evermind.server.rmi.RMICall)
at com.evermind.server.rmi.RMIClientConnection.waitForJndiResponse(RMIClientConnection.java:370)
at com.evermind.server.rmi.RMIClientConnection.lookup(RMIClientConnection.java:179)
at com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:287)
at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:51)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at StartUp$1.actionPerformed(StartUp.java:61)
Look's like client trying get response from server, but server not answered... But server is alive! Why so?
When i restart client all works fine...
Please help!Hello!
My client application connecting to server EJB using ORMI.
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "admin".toUpperCase());
env.put(Context.SECURITY_CREDENTIALS, passwordEncoder.encodePassword("admin", null).toUpperCase());
env.put(Context.PROVIDER_URL, "ormi:http://host:7777/application");
First connection passed. All works.
But if connection between client and server broken, then client must reconnect to server... But it can't.
Client pending and not response.
I dump threads on client pending:
First thread:
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x230962d8> (a java.lang.Object)
at EDU.oswego.cs.dl.util.concurrent.LinkedQueue.poll(LinkedQueue.java:192)
- locked <0x230962d8> (a java.lang.Object)
at oracle.oc4j.rmi.tunnelling.TunnelledRmiTransport$PluggableInputStream.read(TunnelledRmiTransport.java:208)
- locked <0x2308ac90> (a oracle.oc4j.rmi.tunnelling.TunnelledRmiTransport$PluggableInputStream)
at oracle.oc4j.rmi.tunnelling.TunnelledRmiTransport$PluggableInputStream.read(TunnelledRmiTransport.java:190)
- locked <0x2308ac90> (a oracle.oc4j.rmi.tunnelling.TunnelledRmiTransport$PluggableInputStream)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
- locked <0x2308cd68> (a java.io.BufferedInputStream)
at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2249)
at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2429)
at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2499)
at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2571)
at java.io.ObjectInputStream.read(ObjectInputStream.java:820)
at com.evermind.server.rmi.RMIConnection.readCommand(RMIConnection.java:162)
at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.java:149)
at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnection.java:127)
at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:814)
at java.lang.Thread.run(Thread.java:619)
Second thread:
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x229c0bc8> (a com.evermind.server.rmi.RMICall)
at java.lang.Object.wait(Object.java:485)
at com.evermind.server.rmi.RMIClientConnection.waitForResponseFromServer(RMIClientConnection.java:758)
- locked <0x229c0bc8> (a com.evermind.server.rmi.RMICall)
at com.evermind.server.rmi.RMIClientConnection.waitForJndiResponse(RMIClientConnection.java:370)
at com.evermind.server.rmi.RMIClientConnection.lookup(RMIClientConnection.java:179)
at com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:287)
at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:51)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at StartUp$1.actionPerformed(StartUp.java:61)
Look's like client trying get response from server, but server not answered... But server is alive! Why so?
When i restart client all works fine...
Please help! -
OS_USER not correct when using JDBC Thin Client on 10G
Hi Folks,
We are migrating an application from a 9i database to 10g and have a problem that someone might have come across before.
The application is a Java applet based application that connects to the database using JDBC Thin client. on 9i the OS_USER comes up as the user running the applet but in 10G it is coming up as the user account that installed 10G on the DB server.
We tried using a 9i client to identify if it was a client or DB issue but its the same problem with the 9i client connecting to the 10G DB.
If anyone can help it would be much appreciated.
Thanks,
John.Could you please provide further details on what do you mean with OS_USER?
The application is a Java applet based application
that connects to the database using JDBC Thin client.
on 9i the OS_USER comes up as the user running the
applet but in 10G it is coming up as the user account
that installed 10G on the DB server.
Are you referring to the user provided to perform authentication against database, i.e. a database user?
How do you know this user is being changed?
~ Madrid -
IllegalArgumentException while accessing an EJB with a servlet client
Dear All,
Hey,
I am facing some problems while accessing a deployed stateless ejb. Following is how my application is being accessed:
WEBAPP CLIENT
caller.html ------->> DisplayServletClient --------->> DisplayServlet
(Simple HTML Page) (Servlet which performs lookup) (The actual bean)
CONSOLE CLIENT
DisplayConsoleClient --------->> DisplayServlet
(Simple Console Client) (The actual bean)
I am using the J2EE reference implementation, the ejb bean is successfully deployed. The console client successfully, access the ejb. But when I try to access the ejb using the webapp client, I get the following exception:
======= EXCEPTION ENCOUNTERED ============
Application DisplayApp deployed.
Servlet Entered
HTML Content Type Set
PrintWriter Object Created
Context Object Created
Exception in Servlet Client Code: java.lang.IllegalArgumentException: Unknown co
mponent type
java.lang.IllegalArgumentException: Unknown component type
at com.sun.enterprise.naming.NamingManagerImpl.getComponentType(NamingMa
nagerImpl.java:670)
at com.sun.enterprise.naming.NamingManagerImpl.getMangledIdName(NamingMa
nagerImpl.java:708)
at com.sun.enterprise.naming.NamingManagerImpl.getComponentIdInternal(Na
mingManagerImpl.java:680)
at com.sun.enterprise.naming.NamingManagerImpl.getComponentId(NamingMana
gerImpl.java:313)
at com.sun.enterprise.naming.java.javaURLContext.getComponentContext(jav
aURLContext.java:397)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.j
ava:51)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at DisplayServletClient.service(DisplayServletClient.java:27)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServl
et.java:428)
at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java
:180)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationF
ilterChain.java:197)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilt
erChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:215)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve
.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
2314)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.ja
va:368)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
r.java:995)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
va:1088)
at java.lang.Thread.run(Thread.java:484)
======== EXCEPTION END ===========
Tweaking with the servlet client code, I have discovered that it is failing to perform a correct lookup. Can anybody suggest any remedy? My Source code is below:
=========================================================
============ Remote Interface START ==============
// The DisplayApp Remote Interface File
import javax.ejb.*;
import java.rmi.*;
public interface Display extends EJBObject
public String display() throws RemoteException;
============ Remote Interface END ==============
============ Home Interface START ==============
// The DisplayApp Home Interface File
import javax.ejb.*;
import java.rmi.*;
public interface DisplayHome extends EJBHome
public Display create() throws RemoteException, CreateException;
============ Home Interface END ==============
============ Bean Class START ==============
// The DisplayApp Bean Class File
import javax.ejb.*;
import java.rmi.*;
public class DisplayBean implements SessionBean
public String display() throws RemoteException
System.out.println("The Server Side Response");
return "Hello, Me a New Friend";
public void ejbCreate(){}
public void ejbRemove(){}
public void ejbActivate(){}
public void ejbPassivate(){}
public void setSessionContext(SessionContext ctx){}
============ Bean Class END ==============
========== Console Client Class START ======
// The Display Console Client Class File
import javax.ejb.*;
import javax.rmi.*;
import javax.naming.*;
import Display;
import DisplayHome;
public class DisplayConsoleClient
public DisplayConsoleClient()
try
Context initial=new InitialContext();
Object objref=initial.lookup("java:comp/env/DisplayJNDI");
DisplayHome home=(DisplayHome)PortableRemoteObject.narrow(objref, DisplayHome.class);
Display ref=home.create();
System.out.println("Client Side: "+ref.display());
ref.remove();
catch(Exception ex)
System.out.println("Exception in Client Code: "+ex);
ex.printStackTrace();
public static void main(String args[])
new DisplayConsoleClient();
========== Console Client Class END ======
========== Servlet Client Class START ======
// The DisplayApp Servlet Client Class File
import javax.ejb.*;
import javax.rmi.*;
import javax.naming.*;
import Display;
import DisplayHome;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class DisplayServletClient extends HttpServlet
private PrintWriter out;
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
try
System.out.println("Servlet Entered");
response.setContentType("text/html");
System.out.println("HTML Content Type Set");
out=response.getWriter();
System.out.println("PrintWriter Object Created");
Context initial=new InitialContext();
System.out.println("Context Object Created");
Object objref=initial.lookup("java:comp/env/ejb/DisplayWEBJNDI");
System.out.println("Lookup Done Successfully");
DisplayHome home=(DisplayHome)PortableRemoteObject.narrow(objref, DisplayHome.class);
System.out.println("Home Object Created");
Display ref=home.create();
System.out.println("Remote Object Created");
out.println("<html><title>The Results Page</title>");
out.println("<body<hr>");
out.println("<h1>The Client Side Response is: ");
out.println(ref.display());
out.println("</h1>");
out.println("<hr>");
out.println("</body></html>");
System.out.println("Responses Done");
out.flush();
System.out.println("Output Stream Flushed");
ref.remove();
System.out.println("Remote Object Removed");
catch(Exception ex)
System.out.println("Exception in Servlet Client Code: "+ex);
ex.printStackTrace();
========== Servlet Client Class END ======
========== Calling HTML File START ======
<html>
<body>
<hr>
<form method="get" action="/servlet/DisplayServletClient">
<input type="submit" name="submit" value="Call Now!">
</form>
<hr>
</body>
</html>
========== Calling HTML File END ======
=========================================================
Since, the descriptors were automatically generated, I have not included them here. Also, I did not build the war, jar, ear files myself, they were automatically generated by the deploytool.
Please help!!
Thanks & Bye,
Tualha KhanHey,
This was the latest code snippet which I used in the Servlet file.
========================
try
System.out.println("Servlet Entered");
response.setContentType("text/html");
System.out.println("HTML Content Type Set");
out=response.getWriter();
System.out.println("PrintWriter Object Created");
InitialContext initial=new InitialContext();
System.out.println("Context Object Created");
Object objref=initial.lookup("DisplayWEBJNDI");
System.out.println("Lookup Done Successfully");
DisplayHome home=(DisplayHome)PortableRemoteObject.narrow(objref, DisplayHome.class);
System.out.println("Home Object Created");
Display ref=home.create();
System.out.println("Remote Object Created");
out.println("<html><title>The Results Page</title>");
out.println("<body<hr>");
out.println("<h1>The Client Side Response is: ");
out.println(ref.display());
out.println("</h1>");
out.println("<hr>");
out.println("</body></html>");
System.out.println("Responses Done");
out.flush();
System.out.println("Output Stream Flushed");
ref.remove();
System.out.println("Remote Object Removed");
========================
The Response was
========================
Servlet Entered
HTML Content Type Set
PrintWriter Object Created
Context Object Created
Exception in Servlet Client Code: javax.naming.NameNotFoundException: DisplayWEB
JNDI not found
javax.naming.NameNotFoundException: DisplayWEBJNDI not found
<<no stack trace available>>
========================
So what else should I do???
Thanks & Waiting,
Tualha Khan -
How can I deploy a simple stateless ssion EJB and call it from a standalone client
Hi,
I'm creating s simple staless session EJB that has a method that takes a name and prints "Hello" + name. This EJB is in a package called "com.demos.mydemo.ejbs.hello"
How can I deploy this to OC4J?
How can I call it from a standalone client(no JSP, no servlets)?
In Sun's J2EE is very easy to deploy and I don't have to know any XML stuff.
can I use the .ear file created by the Sun's "deploytool" to deploy my EJB to OC4J?
This is the code at I'm using and it works on Sun's j2sdkee1.2.1:
///////// Remote /////////
package com.demos.mydemo.ejbs.hello;
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
public interface Hello extends EJBObject {
public String sayHello(String name) throws RemoteException;
///////// Home //////////
package com.demos.mydemo.ejbs.hello;
import java.rmi.RemoteException;
import javax.ejb.EJBHome;
import javax.ejb.CreateException;
public interface HelloHome extends EJBHome {
public Hello create() throws CreateException, RemoteException;
/////////// Bean class ///////////
package com.demos.mydemo.ejbs.hello;
import java.rmi.RemoteException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.ejb.CreateException;
import javax.ejb.EJBException;
import java.sql.Connection;
import java.sql.SQLException;
//import java.sql.PreparedStatement;
import javax.sql.DataSource;
import javax.naming.NamingException;
import javax.naming.InitialContext;
public class HelloEJB implements SessionBean {
private SessionContext context;
private Connection con;
private String dbName =
"java:comp/env/jdbc/Oracle";
public HelloEJB() {}
public void setSessionContext (SessionContext context) {
this.context = context;
public void ejbCreate() throws CreateException {
try {
makeConnection();
catch (Exception e) {
System.err.println("HelloEJB: exception in ejbCreate:" + e.getMessage());
e.printStackTrace();
throw new CreateException(e.getMessage());
public void ejbActivate() {
public void ejbPassivate() {
public void ejbRemove() {
try {
con.close();
catch (SQLException ex) {
throw new EJBException("HelloEJB: exception in ejbRemove: " + ex.getMessage());
public String sayHello(String name) {
return "Hello " + name;;
private void makeConnection() throws NamingException, SQLException {
try {
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup(dbName);
con = ds.getConnection();
catch (Exception e) {
System.err.println("HelloEJB: exception in makeConnection:" + e.getMessage() );
e.printStackTrace();
//////////// EJB client that uses a stateless session bean
package com.demos.mydemo.ejbs.hello;
import java.io.*;
import java.sql.*;
import javax.sql.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
public class HelloClient {
public static void main(String[] args) {
try {
Context initial = new InitialContext();
Object objref = initial.lookup("HelloSession");
HelloHome home = (HelloHome)PortableRemoteObject.narrow(objref,HelloHome.class);
Hello h = home.create();
String msg = h.sayHello("John Doe");
System.out.println(msg);
//h.remove();
} catch (Exception ex) {
System.err.println("Caught an exception." );
ex.printStackTrace();
Thanks
Nabil
null<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Nabil Khalil ([email protected]):
I deployed and .ear file created by Sun's J2EE deployment tool on the OC4J. It looks that it was deployed fine -- did not get a deployment error.
When I run the client I'm getting the following error: Caught an exception.
javax.naming.CommunicationException: Can't find SerialContextProvider
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:60)
at com.sun.enterprise.naming.SerialContext.<init>(SerialContext.java:79)
at com.sun.enterprise.naming.SerialInitContextFactory.getInitialContext(SerialInitContextFactory.java:54)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:668)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
at javax.naming.InitialContext.init(InitialContext.java:222)
at javax.naming.InitialContext.<init>(InitialContext.java:178)
at com.equifax.fms.ejbs.hello.HelloClient.main(HelloClient.java:18)
This makes me think that the client can't see the deployed EJB on the OC4J.
How can I fix this problem?
Thanks
Nabil
<HR></BLOCKQUOTE>
Nabil -
Your standalone client needs to obtain certain server-dependent properties. You can provide them in your code or grab them via a properties file.
For Orion - you need essentially the following setup, filling in your own information...
Define your standalone client class with "main" etc (this is orion specific - should work for 9i AS as well - perhaps there are some differences)
public class SomeClass {
try {
Properties p = new Properties();
p.setProperty("java.naming.factory.initial",
"com.evermind.server.ApplicationClientInitialContextFactory");
p.setProperty("java.naming.security.principal","server_admin_name");
p.setProperty("java.naming.security.credentials","server_password");
// THEN you can get your intitial context reference
InitialContext initial = new InitialContext (p);...........
Then go about your business.....
A good book to get is called "Professional Java Server Programming J2EE Edition" - there happens to be a reasonable amount of Orion/OCJ4 centric information since one of the authors is Karl Avedal - one of the principals behind Orion. Go out to java.sun.com and look at some of the J2EE tutorials - unfortunately a lot of it is hidden behind the J2EE Deployer, but you will get a good sense of what goes into outside-the-container standalone clients.
null -
Issue when a standalone client invoke a method on an EJB
I do a simple ejb (like SayHello sample) and i create a standalone client that call one method of this EJB.
When i run the client i have the following error from the eclipse IDE (Error is thrown at lookup):
Exception in thread "main" java.lang.AssertionError: java.lang.ClassNotFoundException: test.IHelloWorld
at weblogic.ejb.container.internal.RemoteBusinessIntfGenerator.generateRemoteInterface(RemoteBusinessIntfGenerator.java:57)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.readObject(RemoteBusinessIntfProxy.java:205)
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 java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:197)
at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:564)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:193)
at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:62)
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:240)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
at weblogic.jndi.internal.ServerNamingNode_1030_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:392)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at client.MainHello.main(MainHello.java:21)
Caused by: java.lang.ClassNotFoundException: test.IHelloWorld
at weblogic.ejb.container.deployer.RemoteBizIntfClassLoader.getClassBytes(RemoteBizIntfClassLoader.java:151)
at weblogic.ejb.container.deployer.RemoteBizIntfClassLoader.loadClass(RemoteBizIntfClassLoader.java:96)
at weblogic.ejb.container.internal.RemoteBusinessIntfGenerator.generateRemoteInterface(RemoteBusinessIntfGenerator.java:54)
... 26 more
The eclipse IDE is runwith the option -vm D:\bea\jdk160_05\bin\java
In eclipse, i configure to use the same jdk.
When i execute the client outside eclipse, all is ok....
Do you have an idée ?
This is the ejb code :
package test;
public interface IHelloWorld {
public static final String JNDI_NAME = "HelloWorld";
public String sayHello( String name);
package test;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.REQUIRED)
@Stateless( name="HelloWorld", mappedName= IHelloWorld.JNDI_NAME)
@Remote( IHelloWorld.class)
public class HelloWorld implements IHelloWorld
public String sayHello (String name) {
final String msg = "Hello " + name + ". The world is wonderfull...";
System.out.println ( msg);
return msg;
This is the client code :
package client;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import test.IHelloWorld;
public class MainHello {
public static void main (String[] args) throws Exception
Hashtable<String, String> properties = new Hashtable<String, String> ();
properties.put (Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put (Context.PROVIDER_URL, "t3://localhost:7001");
InitialContext ctx = new InitialContext( properties);
IHelloWorld hello = (IHelloWorld)ctx.lookup ( "HelloWorld#test.IHelloWorld");
String result = hello.sayHello ( "franck");
System.out.println ( result);
ctx.close ();
As you can see it is very simple but doesn't work inside eclipse IDE...
Edited by: user11281761 on 30 juin 2009 07:13Oracle software purchases come with a CSI number that allows customers to have people contact support for products they own. If you or the organization you are working with has not purchased the product or have other support arrangements with Oracle (some partners have this), then you probably will not be able to obtain the patch from Oracle.
You might be able to try a newer release of the product with an OTN evaluation license, WebLogic Server is currently on version 10.3.3, so you are at least 3 releases behind at this point if you are using 10.3.0. -
PageNotFound when using servlets as clients for EJB
Can anyone help me? I have a container managed EJB. I'm using servlets as my client. I placed my EJB's in a jar file and my servlets and html pages in a WAR file. I deployed them using J2EE's deploytool. I can access my html files but not my servlet files. It always says file not found or a 405 error (resource not allowed) I access my servlet this way...
http://localhost:8000/ReservationContextRoot/ReservationAlias
my web.xml file looks like the following:
<?xml version="1.0" encoding="Cp1252"?>
<!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN' 'http://java.sun.com/j2ee/dtds/web-app_2.2.dtd'>
<web-app>
<display-name>ReservationWAR</display-name>
<description>no description</description>
<servlet> <servlet-name>ReservationServlet</servlet-name>
<display-name>ReservationServlet</display-name>
<description>no description</description>
<servlet-class>ReservationServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ReservationServlet</servlet-name>
<url-pattern>ReservationAlias</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<resource-ref>
<description>no description</description>
<res-ref-name>jdbc/ReservationDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<ejb-ref> <description>no description</description>
<ejb-ref-name>ejb/Reservation</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>ReservationHome</home>
<remote>Reservation</remote>
</ejb-ref>
</web-app>Are you sure your servlet class itself can run without problem? Try debug in the these steps:
1. Change your servlet to simply output some HTML text, so you can be sure tomcat can get to your servlet. If this is OK, it means the servlet itself has problem, probably the EJB stuff.
2. Make sure the EJB container is running.
3. Make your servlet a standalone client (not a servlet) and see if it can run. Pay attention to how you do JNDI lookup of the EJB.
Yi -
How to lookup EJBs deployed in OC4J from a standalone client application
Hello all,
I am trying to lookup an EJB deployed in OC4J 10.1.3 from a standalone client application using the following code:
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.PROVIDER_URL, "ormi://localhost:23791");
env.put(Context.SECURITY_PRINCIPAL, "jazn.com/test");
env.put(Context.SECURITY_CREDENTIALS, "test");
Context context = new InitialContext(env);
Object ref = context.lookup("ejb/Dispatch");
I get the following error:
javax.naming.NameNotFoundException: ejb/Dispatch not found
at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:51)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
For the lookup string I've also tried:
"java:comp/env/ejb/Dispatch" and "Dispatch"
For the Context.PROVIDER_URL property I've also tried:
opmn:ormi://localhost:6003:instance
The result is always the same.
I appreciate if someone could help me with this?
Thanks,
GeorgiGeorgi,
Your question has been discussed many times on this forum. Search the forum archives for "RMIInitialContextFactory".
The PROVIDER_URL needs to include the name of the deployed application that your EJB is part of, for example:
env.put(Context.PROVIDER_URL, "ormi://localhost:23791/MyApp");The lookup name has to be the value of the "ejb-name" element in your "ejb-jar.xml" descriptor file.
Your SECURITY_PRINCIPAL value looks strange to me. Personally, I use "principals" (and not JAZN), so I modified the "application.xml" file (in the "j2ee/home/config" subdirectory) to use "principals". Look for the following comment in that file:
<!-- Comment out the jazn element to use principals.
When both jazn and principals are present jazn is used -->Good Luck,
Avi.
Message was edited by:
Avi Abrami -
Could not connect through rmi standalone client Oracle9iASR2 (Win2k) !!
I have a standalone client which uses rmi to authenticate and call the EJBs. The client was able to use rmi under R1, however, after we migrat to R2, the rmi authenticate hangs forever.
What's the reason for this? Is there any configuration in order to call EJBs throught ormi?
Thanks for your help.Hi Debu:
Thanks a lot for your information. I actually resolved this by change my ports to another range. So I even don't need specify a ormi port number there.
Now I have a new question. Do you know if we could authenticate inside an SessionBean using com.evermind.server.rmi.RMIInitialContextFactory ? I got an error when I tried to do that. The reason I want to do that is I deploy a session bean adaptor as WebService, but in Oracle9iASR2, to deploy as a secure web service, the authentication have to be done on a Java standalone client (Is this true?). Now my consumers of the WebService is a VB client. We don't know how to authenticate from a VB client. Therefore, I'm thinking, if I can authenticate inside the SessionBean Adaptor, that would resolve this problem.
Any idea on this? Thanks in advance. -
How can connect different ejb server in one client program
hi , every
i want to make connect ejb server into one client program.
for that , but i try to change PROVIDER_URL property , it's not correct
who solve this problem for novice? :(You need to create separate initialContext to each of the different servers
and lookup up the different ejbs.
-Sabha
"inking" <[email protected]> wrote in message
news:[email protected]..
hi , every
i want to make connect ejb server into one client program.
for that , but i try to change PROVIDER_URL property , it's not correct
who solve this problem for novice? :(
Maybe you are looking for
-
At home I have two Macs, one for work and another which acts as a sort of entertainment hub storing all my music, podcasts and videos as well as being for the family to use. Is it possible to sync my one iPhone to both Macs, with the work one just sy
-
Querying the output of a batch/scheduled report
We haven't move to Discoverer Viewer as of now. One of the questions I have to those who have already implemented it is, can you schedule a batch report in the viewer and then users are able to query the RESULT of it without querying back the databas
-
Private Window allows previously visited pages to be seen using the Back button.
Private windows seem to be less private than non-Private windows:- 1) In a Private Window the Back button allows previously visited pages to be determined. 2) In a non-Private window Clear History removes previously visited pages (so that they aren't
-
Does anyone know a how I can get a "save" button in the pages toolbar ? This button is not available in the toolbar settings.
-
Need Help with Rotating Banner ad(please help)
I am currently working on a flash project that rotates banners out auto and with button control, got the buttons to work just cant figure out how to get it auto play throgh my bannersThis is the code i have for my project I am working on: My Project