10.1.3.1 and standalone RMI client
I'm migrating our J2EE applications from 10.1.2.0.1 to 10.1.3.1.0. I also have a custom JAAS login module that is used by our applications. I have the login module working successfully and web applications that can call EJBs.
But I am unable to get a simple RMI client to call the EJBs. I can see from the server logs that the JAAS module executes successfully, but then I get a ClassNotFoundException (seems to be from the server) when the client tries to access the JNDI tree (see stack below on the client; I can't find any log relating to this event on the server).
I had real problems with RMI access in 10.1.2, seems that Oracle AS isn't really thought through with respect to simple RMI client access. In the system-jazn-data.xml file I have granted my custom principals the RMI login permission. I tried to raise a TAR but it's been rejected because 10.1.3.1.0 is a "preview" version. (Don't you guys want to know about bugs before a release goes into production?)
Any ideas?
27-Sep-2006 14:50:46 oracle.j2ee.rmi.RMIMessages EXCEPTION_ORIGINATES_FROM_THE_R
EMOTE_SERVER
WARNING: Exception returned by remote server: {0}
java.lang.ClassNotFoundException: com/evermind/server/ejb/EJBHomeObjectInfo
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at com.evermind.io.ClassLoaderObjectInputStream.resolveClass(ClassLoader
ObjectInputStream.java:33)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:153
8)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
693)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1628)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1293)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at java.util.HashMap.readObject(HashMap.java:1013)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:919
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1813)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
713)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at com.evermind.server.rmi.RMIClientConnection.handleListContextResponse
(RMIClientConnection.java:768)
at com.evermind.server.rmi.RMIClientConnection.handleOrmiCommandResponse
(RMIClientConnection.java:242)
at com.evermind.server.rmi.RMIClientConnection.dispatchResponse(RMIClien
tConnection.java:205)
at com.evermind.server.rmi.RMIClientConnection.processReceivedCommand(RM
IClientConnection.java:187)
at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.jav
a:152)
at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnec
tion.java:127)
at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExec
utor.java:814)
at java.lang.Thread.run(Thread.java:595)
javax.naming.NamingException: com/evermind/server/ejb/EJBHomeObjectInfo [Root ex
ception is java.lang.ClassNotFoundException: com/evermind/server/ejb/EJBHomeObje
ctInfo]
at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:1
00)
at com.evermind.server.rmi.RMIClientConnection.waitForJndiResponse(RMICl
ientConnection.java:334)
at com.evermind.server.rmi.RMIClientConnection.list(RMIClientConnection.
java:293)
at com.evermind.server.rmi.RMIClient.list(RMIClient.java:392)
at com.evermind.server.rmi.RMIClientContext.getListValues(RMIClientConte
xt.java:95)
at com.evermind.server.rmi.RMIContext.listBindings(RMIContext.java:444)
at com.evermind.naming.FilterContext.listBindings(FilterContext.java:91)
at com.evermind.server.ApplicationClientContext.listBindings(Application
ClientContext.java:127)
at javax.naming.InitialContext.listBindings(InitialContext.java:406)
at com.axiomsystems.common.tools.test.APITester.getEJBs(APITester.java:2
06)
at com.axiomsystems.common.tools.test.APITester.<init>(APITester.java:17
3)
at com.axiomsystems.common.tools.test.APITester.main(APITester.java:68)
Caused by: java.lang.ClassNotFoundException: com/evermind/server/ejb/EJBHomeObje
ctInfo
at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_
SERVER(RMICall.java:109)
at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:9
1)
... 11 more
Hi Debu,
I have found the problem and a workaround in my code.
I obtained the initial context ctx with the following properties set:
Context.INITIAL_CONTEXT_FACTORY (= oracle.j2ee.naming.ApplicationClientInitialContextFactory)
Context.PROVIDER_URL (= opmn:ormi://myHost:myPort:myOC4J/myApp)
Context.SECURITY_PRINCIPAL (= my username)
Context.SECURITY_CREDENTIAL (= my password)
then I did
NamingEnumeration en = ctx.listBindings("ejb/myJndiName")
which resulted in the exception.
Changing this to
Context ctx2 = (Context)ctx.lookup("ejb/myJndiName");
NamingEnumeration en = ctx2.listBindings("");
has resolved the problem. I'm not sure why this behaves differently, I suppose it may have something to do with the fact that ctx2 is not an InitialContext object. It is an adequate workaround for my application.
Once I have an EJB reference, invoking methods over RMI works as expected.
Thanks,
Keith
Similar Messages
-
OJMS and Standalone Java Client
Hi ,
any one had luck in accessing the ojms queue from a standalone java application.I am using oc4j standalone 9.0.0.3 container.I was able to do it from a jsp page .
But when i tried the same from standalone java client , its giving me javax.naming.NameNotFoundException: "No object bound for java:comp/resource/TestRP/QueueConnectionFactories/RPTable". The same lookup succeeds inside the jsp.Is there any additional configuration to be there for the standalone java client ?
thanks in advance ..
premPerhaps too obvious a point, but your standalone java client is running in a process different from that of oc4j. How do your java client process connect to oc4j?
Note that a jsp is running inside oc4j. -
HELP! Having trouble connecting to EJB with RMI client
I've got a simple stateless session EJB deployed and I'm trying to connect
to it using a standalone
RMI client. I'm getting the following error back when I first do a
context.lookup("ejb/beanname"):
org.omg.CORBA.COMM_FAILURE: minor code: 1 completed: Maybe
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Exception.java:42)
at java.lang.RuntimeException.<init>(RuntimeException.java:47)
at org.omg.CORBA.SystemException.<init>(SystemException.java:49)
at org.omg.CORBA.COMM_FAILURE.<init>(COMM_FAILURE.java:77)
at org.omg.CORBA.COMM_FAILURE.<init>(COMM_FAILURE.java:63)
at
com.sun.corba.ee.internal.iiop.IIOPConnection.purge_calls(Compiled Code)
at com.sun.corba.ee.internal.iiop.ReaderThread.run(Compiled Code)
Any troubleshooting advice would be greatly appreciated.
BTW: After this error, iPlanet's cxs process seems to die! Until I restart
cxs I get no connection failures
of the form:
javax.naming.CommunicationException:
Cannot connect to ORB. Root exception is org.omg.CORBA.COMM_FAILURE:
minor code: 1398079490 completed: No
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(RuntimeException.java:47)
at org.omg.CORBA.SystemException.<init>(SystemException.java:49)
at org.omg.CORBA.COMM_FAILURE.<init>(Compiled Code)
at org.omg.CORBA.COMM_FAILURE.<init>(Compiled Code)
at com.sun.corba.ee.internal.iiop.IIOPConnection.writeLock(Compiled
Code)
at com.sun.corba.ee.internal.iiop.IIOPConnection.send(Compiled Code)
at com.sun.corba.ee.internal.iiop.IIOPOutputStream.invoke(Compiled
Code)
at
com.sun.corba.ee.internal.iiop.ClientRequestImpl.invoke(ClientRequestImpl.ja
va:74)
at
com.sun.corba.ee.internal.corba.ClientDelegate.invoke(ClientDelegate.java:16
0)
at
com.sun.corba.ee.internal.corba.InitialNamingClient.resolve(InitialNamingCli
ent.java:199)
at
com.sun.corba.ee.internal.corba.InitialNamingClient.cachedInitialReferences(
InitialNamingClient.java:278)
at
com.sun.corba.ee.internal.corba.InitialNamingClient.resolve_initial_referenc
es(InitialNamingClient.java:187)
at
com.sun.corba.ee.internal.corba.ORB.resolve_initial_references(ORB.java:1422
at
com.sun.corba.ee.internal.POA.POAORB.resolve_initial_references(POAORB.java:
541)
at com.sun.jndi.cosnaming.CNCtx.setOrbAndRootContext(CNCtx.java:252)
at com.sun.jndi.cosnaming.CNCtx.initUsingUrl(Compiled Code)
at
com.sun.jndi.cosnaming.CNCtx.initOrbAndRootContext(CNCtx.java:185)
at com.sun.jndi.cosnaming.CNCtx.<init>(CNCtx.java:72)
.... stuff deleted....
Is RMI client support in iPlanet 6.0 truly this buggy or am I missing
something?
Jack Profit
[email protected]Make sure to review the Converter sample and employ all of the workarounds
listed there.
David
Jack Profit wrote:
I've got a simple stateless session EJB deployed and I'm trying to connect
to it using a standalone
RMI client. I'm getting the following error back when I first do a
context.lookup("ejb/beanname"): -
How do I make a RMI client running in Bea find a remote, non Bea, RMI server?
On my stand alone test system I run a RMI server in one JVM,
registry.exe and a RMI client in its own JVM. The client uses
java.rmi.Naming.lookup() to find the RMI server, and this works fine.
If I run the same RMI client class within Bea the naming lookup fails! I
guess this is due to Bea using it own RMI registry rather than the
registry.exe I started separately(?)
QUESTION: How do I make a RMI client running in Bea find a remote,
non-Bea, RMI server?
Of course, in the final environment the server will run on a system
remote from Bea.
The RMI client calls are done from a servlet, not from a EJB.
The doumentation about using RMI with Bea is focused on running the RMI
server within Bea. This might be the "normal" thing to do, but in our
case Bea is the client, not the server. Do I still need to use
weblogic.rmi.*....? If so, where?
Grateful for any tip.
Göran HagnellOn my stand alone test system I run a RMI server in one JVM,
registry.exe and a RMI client in its own JVM. The client uses
java.rmi.Naming.lookup() to find the RMI server, and this works fine.
If I run the same RMI client class within Bea the naming lookup fails! I
guess this is due to Bea using it own RMI registry rather than the
registry.exe I started separately(?)
QUESTION: How do I make a RMI client running in Bea find a remote,
non-Bea, RMI server?
Of course, in the final environment the server will run on a system
remote from Bea.
The RMI client calls are done from a servlet, not from a EJB.
The doumentation about using RMI with Bea is focused on running the RMI
server within Bea. This might be the "normal" thing to do, but in our
case Bea is the client, not the server. Do I still need to use
weblogic.rmi.*....? If so, where?
Grateful for any tip.
Göran Hagnell -
Getting the IP address of RMI clients
I have developed an RMI server class and a RMI client class, each with its own Remote Interface.
I want both clients and server to call methods from each other to exchange data.
Here is what I have coded.
The server object starts by creating a Name registry "LocateRegistry.createRegistry(1099)"), and then binds itself to it, using name "server".
On another machine, a client is created. It creates a Name Registry too and binds itself to it (using a unique name).
Then the client asks the server's remote registry for a remote reference to the server (it knows the server's IP adress and it knows that the registry is on port 1099).
It then calls a connect(clientName, clientRegistryPort) remote procedure which provides the server with the client's name and registry port, as the arguments suggests.
The goal is to enable the server to get a remote reference to the client.
But my problem is, to do this the server needs the client's IP address. I am sorry if this looks like a dumb question, but how can the server know the client's IP address ?
Of course the client could send it, but wouldn't it be a more elegant method if the server to found it by itself (after all, a connection is already established since the client has called a method on the server) ? Does RMI provide a method for this ? Do you think that my general solution is correct ?The goal is to enable the server to get a remote
reference to the client.You don't need a client-side Registry to accomplish that. Just pass a reference to the client-side remote object via a remote method call to the server. -
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. -
RMI Server and RMI Client Problem
First, Hi!
I have create my RMI Server and a RMI Servlet client.
I can run the server and servlet first time and it works fine.
Then, I stop rmiregistry and server.
Then, I start rmiregistry and server for a second time but my RMI Servlet client gets a
java.rmi.ConnectException: Connection refused to host: xxx.xxx.xxx.xxx; nested exception is: java.net.ConnectException: Connection refused
If I copy the class again where the servlets resides, it works again. But I have to keep doing that. I have to keep copying the class file to the servlet directory every 2nd time I try to run it for it to work.
Anyone know what am I doing wrong?First, Hi!
I have create my RMI Server and a RMI Servlet client.
I can run the server and servlet first time and it
works fine.
Then, I stop rmiregistry and server.
Then, I start rmiregistry and server for a second time
but my RMI Servlet client gets a
java.rmi.ConnectException: Connection refused to host:
xxx.xxx.xxx.xxx; nested exception is:
java.net.ConnectException: Connection refused
If I copy the class again where the servlets resides,which class file ? u mean RMIServer's class files ??
I have faced the same problem too. In my case if i just restart my Tomcat webserver the error goes and the servlet is very well able to connect back to the RMI Server
it works again. But I have to keep doing that. I have
to keep copying the class file to the servlet
directory every 2nd time I try to run it for it to
work.
Anyone know what am I doing wrong? -
RMI client losing connection and weblogic.rjvm.PeerGoneException
What causes PeerGoneExceptions? We are seeing this very often on our
production and test systems. We use WLS RMI clients connected to WLS 4.5.1
servers w/ service pack 10. I understand that there is a heartbeat between
the client JVM and the server JVM. Is there any documentation that explains
how this actually works. For example, how often does the client send its
heartbeat. Is it configurable? What could cause it to stop or drop the
connection. We are using straight T3 (no T3S or HTTP).
thanks for your help,
Edwin Marcial
Intercontinental ExchangeWhat causes PeerGoneExceptions? We are seeing this very often on our
production and test systems. We use WLS RMI clients connected to WLS 4.5.1
servers w/ service pack 10. I understand that there is a heartbeat between
the client JVM and the server JVM. Is there any documentation that explains
how this actually works. For example, how often does the client send its
heartbeat. Is it configurable? What could cause it to stop or drop the
connection. We are using straight T3 (no T3S or HTTP).
thanks for your help,
Edwin Marcial
Intercontinental Exchange -
One RMI client and mutliple RMI server implementation
Hi,
We are planning to implement a RMI. In the design approach we are planning to have 1 client and mutiple RMI server and each RMI server register to a system. All the RMI server will have the same functionality. The decision to call particualr RMI server is done at runtime based on some parameter. I am not clear on how to implement the same as I am new to RMI technology, so it would be great if you can suggest some good approach for doing the same.
Thanks,
Ramreddygreetings,
your client and server are in the same class?
i.e. server object (interface implementation instance)
and lookup are within the same execution thread
i believe this defeats the purpose of RMI
the objective is to utilize object methods on different machines
otherwise, you can just use a local method within your server/client mainline (of course, it ceases to become "remote" at that point)
logistically, there is also the problem of the runtime not being able to resolve the skeleton/proxy components correctly (since it's probably searching for a client stub which doesn't exist...); maybe you could fake it out by compiling a phony client class - again, this won't provide any advantage but it might run
perhaps if you shared your system/network setup and a bit more about your design objectives someone in this forum could provide some assistance
good luck,
D -
Hi,
I am trying to use a jApplet as an rmi client. However, either creating a new instance of the class i created, that extends jApplet, in the rmi client class i created or creating a new instance of the rmi client in the class that extends jApplet results in error.
What is the correct way to go about doing this? I developed the jApplet thinking it could be simply used with the rmi client.
instanciating the rmi client in the jApplet class gives :
java.lang.OutOfMemory Error
instanciating the jApplet class in the rmi client class gives other errors I am unable to reproduce at the moment :(
thanks for any help
-Paulo Murphy de FreitasHi,
I am trying to use a jApplet as an rmi client. However, either creating a new instance of the class i created, that extends jApplet, in the rmi client class i created or creating a new instance of the rmi client in the class that extends jApplet results in error.
What is the correct way to go about doing this? I developed the jApplet thinking it could be simply used with the rmi client.
instanciating the rmi client in the jApplet class gives :
java.lang.OutOfMemory Error
instanciating the jApplet class in the rmi client class gives other errors I am unable to reproduce at the moment :(
thanks for any help
-Paulo Murphy de Freitas -
RMI - EJB Standalone Java client
Hello,
We have a standalone Java client attempting to invoke a EJBs running on OC4J. We get a user not allowed to access namespace...check orion-application.xml file... Any ideas what could be the problem.
Regards.Hi,
In access namespace tag of your orion-application.xml, you should specify the same user as the one used by your java client.
Hope that helps
regards -
How to use standalone java client with an enterprise bean in J2EE 1.4
Hi All,
I am have deployed a stateless session bean in Sun's J2EE 1.4 Application Server. i am trying to call the bean using a standalone java client. but the client cannot access the bean.
The error coming is:
Jan 21, 2004 7:48:27 PM com.sun.corba.ee.impl.legacy.connection.SocketFactoryCo
nectionImpl <init>
WARNING: ORBUTIL.connectFailure
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(
RBUtilSystemException.java:1739)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(
RBUtilSystemException.java:1757)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryConnectionImpl.
init>(SocketFactoryConnectionImpl.java:74)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryContactInfoImpl
createConnection(SocketFactoryContactInfoImpl.java:88)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.begi
Request(CorbaClientRequestDispatcherImpl.java:146)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(Corba
lientDelegateImpl.java:121)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaCli
ntDelegateImpl.java:212)
at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.jav
:69)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.ja
a:58)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:12
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at StatelessSessionClient.main(StatelessSessionClient.java:17)
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection re
used: connect
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSoc
etFactory.java:390)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryConnectionImpl.
init>(SocketFactoryConnectionImpl.java:58)
... 10 more
Caused by: java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:457)
at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSoc
etFactory.java:381)
... 11 more
javax.naming.CommunicationException: Can't find SerialContextProvider
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.ja
a:66)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:12
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at StatelessSessionClient.main(StatelessSessionClient.java:17)
Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed
No
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(
RBUtilSystemException.java:1739)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(
RBUtilSystemException.java:1757)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryConnectionImpl.
init>(SocketFactoryConnectionImpl.java:74)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryContactInfoImpl
createConnection(SocketFactoryContactInfoImpl.java:88)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.begi
Request(CorbaClientRequestDispatcherImpl.java:146)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(Corba
lientDelegateImpl.java:121)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaCli
ntDelegateImpl.java:212)
at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.jav
:69)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.ja
a:58)
... 3 more
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection re
used: connect
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSoc
etFactory.java:390)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryConnectionImpl.
init>(SocketFactoryConnectionImpl.java:58)
... 10 more
Caused by: java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:457)
at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSoc
etFactory.java:381)
... 11 more
My java client uses the following code to access the bean:
Hashtable props = new Hashtable();
String URL="iiop://localhost:3700";
props.put("java.naming.factory.initial","com.sun.jndi.cosnaming.CNCtxFactory");
props.put("java.naming.provider.url", URL) ;
InitialContext ctx = new InitialContext();
Object ref = ctx.lookup("ejb/StatelessSessionHome");
StatelessSessionHome home = (StatelessSessionHome)PortableRemoteObject.narrow(ref,StatelessSessionHome.class);
StatelessSessionRemote statelessSession = home.create();
plz help me to locate the error.
Regards,
MohitHi Amol,
thanks for your suggestion.
i have deployed the converter application in J2EE1.4 tutorial in Sun AppServer J2EE1.4. the deployment process works smoothly. but accessing the deployed converter bean using standalone client as given in the tutorial gives the following error.
Caught an unexpected exception!
javax.naming.NoInitialContextException: Need to specify class name in environmen
t or system property, or as an applet parameter, or in an application resource f
ile: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
40)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
a:280)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at ConverterClient.main(ConverterClient.java:14)
I have set the InitialHost and InitialPort as suggested by you in the client code. the client gets successfully compiled but gives error when executed.
The client code is:
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import java.math.BigDecimal;
public class ConverterClient {
public static void main(String[] args) {
System.setProperty("org.omg.CORBA.ORBInitialHost","localhost");
System.setProperty("org.omg.CORBA.ORBInitialPort","3700");
try {
Context initial = new InitialContext();
Object objref = initial.lookup
("java:comp/env/ejb/SimpleConverter");
ConverterHome home =
(ConverterHome)PortableRemoteObject.narrow(objref,
ConverterHome.class);
Converter currencyConverter = home.create();
BigDecimal param = new BigDecimal ("100.00");
BigDecimal amount =
currencyConverter.dollarToYen(param);
System.out.println(amount);
amount = currencyConverter.yenToEuro(param);
System.out.println(amount);
System.exit(0);
} catch (Exception ex) {
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
Please suggest so that i can run the standalone client successfully.
Regards,
Mohit Kapoor -
How to insert message in OC4J JMS from standalone java client.
Hi,
I have been following available examples for creating standalone java clients to insert messages in JMS queues.
I am able to insert using java client when the SOA suite and the standalone java code are on same machine.
package producerconsumerinjava;
import javax.jms.*;
import javax.naming.*;
import java.util.Hashtable;
public class QueueProducer
public static void main(String[] args)
String queueName = "jms/demoQueue";
String queueConnectionFactoryName = "jms/QueueConnectionFactory";
Context jndiContext = null;
QueueConnectionFactory queueConnectionFactory = null;
QueueConnection queueConnection = null;
QueueSession queueSession = null;
Queue queue = null;
QueueSender queueSender = null;
TextMessage message = null;
int noMessages = 5;
* Set the environment for a connection to the OC4J instance
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
env.put(Context.SECURITY_CREDENTIALS, "mypass");
env.put(Context.PROVIDER_URL,"ormi://myserver.company.com:12402"); //12402 is the rmi port
* Set the Context Object.
* Lookup the Queue Connection Factory.
* Lookup the JMS Destination.
try
jndiContext = new InitialContext(env);
queueConnectionFactory =
(QueueConnectionFactory) jndiContext.lookup(queueConnectionFactoryName);
queue = (Queue) jndiContext.lookup(queueName);
catch (NamingException e)
System.out.println("JNDI lookup failed: " + e.toString());
System.exit(1);
* Create connection.
* Create session from connection.
* Create sender.
* Create text message.
* Send messages.
* Send non text message to end text messages.
* Close connection.
try
queueConnection = queueConnectionFactory.createQueueConnection();
queueSession =
queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
queueSender = queueSession.createSender(queue);
message = queueSession.createTextMessage();
for (int i = 0; i < noMessages; i++)
message.setText("Message " + (i + 1));
System.out.println("Producing message: " + message.getText());
queueSender.send(message);
queueSender.send(queueSession.createBytesMessage());
catch (JMSException e)
System.out.println("Exception occurred: " + e.toString());
finally
if (queueConnection != null)
try
queueConnection.close();
catch (JMSException e)
System.out.println("Closing error: " + e.toString());
But when the SOA Suite is remote, I am struggling to get the settings correct
Till now, here is what I have figured out from looking at blogs/tars etc on the Net:
1. I need to use ApplicationClientInitialContextFactory instead of RMIInitialContextFactory (http://download.oracle.com/docs/cd/E14101_01/doc.1013/e13975/jndi.htm)
2. The project should have a META-INF/application-client.xml file, which may be dummy (http://www.wever.org/java/space/Oracle/JmsTar1). Question is, my code is there in a single absolutely standalone code..how I can use this application-client.xml and where it has to be placed.
Errors:
When trying to run exact same code on local server that tries to enqueue JMS on remotee serverer
Exception occurred: javax.jms.JMSException: Unable to create a connection to "xxxxxxx.yyyyyy01.dev.com/10.42.456.11:12,602" as user "null".
Any help is greatly welcome.
As an exercise, I copied this complete code on the server and then ran locally using a telnet client...it worked. So the problem is coming when accessing the server remotely.
Rgds,
Amit1. I need to use ApplicationClientInitialContextFactory instead of RMIInitialContextFactoryNot necessarily.
2. The project should have a META-INF/application-client.xml fileThat's only necessary if going the ApplicationClientInitialContextFactory route.
There are two types of JMS client applications you can write -- a pure/plain Java app, and an "AppClient". That first is your everyday run-of-the-mill Java application, nothing special. That latter is a special, complicated beast that tries to act as a part of the whole client/server/J2EE architecture which provides you with a semi-managed environment. Either can be made to work, but if all you need is JMS access (using plain OC4J JMS factory/queue names and not JMS Connector names), then the first is easier to get working (and performs a tiny bit better as well due to being a lighter-weight solution).
I think the problem you are having might be: When you use the plain Java client solution, you do not have any type of management, and that includes user management. With no user management (and if the JMS server is not configured to allow anonymous connections) you need to include the username and password in the call to createConnection. (I think it may be that this is actually true in the AppClient case as well -- I avoid using the AppClient model as much as possible so my memory there is weaker.)
If you prefer to go the AppClient route, I would point you to a demo I wrote which had a functioning example, but Oracle seems to have removed it (and all of the 10.1.3 demos?) from OTN. :-(
Hmm, it seems to still be available on the wayback machine:
http://web.archive.org/web/20061021064014/www.oracle.com/technology/tech/java/oc4j/1013/how_to/index.html
(Just look down the page for "With OEMS JMS (In-Memory and File-Based)" -- there is an .html document with info, and there is a .zip file with source code.)
Question is, my code is there in a single absolutely standalone code..how I can use this application-client.xml and where it has to be placed.The app client in my demo had the following directory structure:
myjavaclient.class
jndi.properties
META-INF\MANIFEST.MF
META-INF\application-client.xml
META-INF\orion-application-client.xml
When you use ApplicationClientInitialContextFactory I think it just looks under .\META-INF for the .xml files.
-Jeff -
RMI client-side - how to encrypt,decrypt in client-side
I write javacard RMI style. My problem is...
Source code below is work when it write in applet (card - side)
but in client-side (reader -side) I copy it to client - side code and test to run, if fail --> throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
It seem to be "javacardx.crypto" and "javacard.security" is make for use in applet in card only. Did I misunderstand?
if it make for use in applet only, how is possible to do like this " card use privatekey to sign message and send to reader , reader use card's publickey to verify that card sign this signature or not."
or
"card use reader's publickey to encrypt message and send to reader, then reader use privatekey to decrypt message (reader authencate itself) "
because I can't do any of cipher , keybuilder in RMI-client side(reader)
Cipher.getInstance(Cipher.ALG_RSA_PKCS1,false);
it will throw nullPointerException
and if (change false to true)
Cipher.getInstance(Cipher.ALG_RSA_PKCS1,true);
throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
after that I swap this line with
pri_key = (RSAPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE,KeyBuilder.LENGTH_RSA_512, false);
since it will do this first (i swap the line already) it also throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
also be the same result with swap
kp = new KeyPair(KeyPair.ALG_RSA,(short)KeyBuilder.LENGTH_RSA_512 );
to a first line
it throw exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHM
Please help me
RSAPrivateKey pri_key;
RSAPublicKey pub_key;
KeyPair kp;
Cipher RSAcipher;
RSAcipher = Cipher.getInstance(Cipher.ALG_RSA_PKCS1,false);
pri_key = (RSAPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PRIVATE,KeyBuilder.LENGTH_RSA_512, false);
pub_key =(RSAPublicKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC,KeyBuilder.LENGTH_RSA_512, false);
kp = new KeyPair(KeyPair.ALG_RSA,(short)KeyBuilder.LENGTH_RSA_512 );
kp.genKeyPair();
pri_key = (RSAPrivateKey) kp.getPrivate();
pub_key = (RSAPublicKey) kp.getPublic();
//ENCRYPT
RSAcipher.init(pri_key, Cipher.MODE_ENCRYPT);
t_cipherLengthRSA = RSAcipher.doFinal(plaintxt,(short)0, (short)plaintxt.length, t_cipherText, (short)0);
//DECRYPT
RSAcipher.init(pub_key, Cipher.MODE_DECRYPT);
RSAcipher.doFinal(ciphertxt,(short)0,(short) t_cipherLengthRSA, temp1, (short)0);I write javacard RMI style. My problem is...
Source code below is work when it write in applet (card - side)
but in client-side (reader -side) I copy it to client - side code and test to run, if fail --> throw
exception 0x3 - javacard.security.CryptoException.NO_SUCH_ALGORITHMYou can not share code between card and client. On the card use the classes of javacardx.crypto and on the client side those of javax.crypto and java.security.
It seem to be "javacardx.crypto" and "javacard.security" is make for use in applet in card only. That is right.
if it make for use in applet only, how is possible to
do like this " card use privatekey to sign message
and send to reader , reader use card's publickey to
verify that card sign this signature or not." or
"card use reader's publickey to encrypt message and
send to reader, then reader use privatekey to decrypt
message (reader authencate itself) "On each platform you have classes that provide the same cryptographic operations but the interface of these classes is different (because of the limitations of the java card platform).
because I can't do any of cipher , keybuilder in
RMI-client side(reader)Use the java.security.KeyFactory instead.
Cipher.getInstance(Cipher.ALG_RSA_PKCS1,false);
it will throw nullPointerException
and if (change false to true)
Cipher.getInstance(Cipher.ALG_RSA_PKCS1,true);
throw exception 0x3 -
javacard.security.CryptoException.NO_SUCH_ALGORITHMCryptographic support on java cards is optional. Not every card supports every algorithm. Try to use another algo.
Jan -
I have implemented a transformation server as a JMS client. This is not
written as a EJB bean, partly because I'm not very familiar with EJB beans.
I'm being told MDB is the way to go (I'm a bit reluctant in front of the
additional work) for the usual reasons : transaction-control (not really an
issue right now for me but may become one), ease of deployment and
centralized monitoring. Fair enough.
My standalone JMS client creates a lot of variables at initialization (such
as a precompiled XSLT stylesheet to substantially improve the speed of each
transformation).
Where should this be created if I were to convert my standalone JMS client
into an MDB ? In ejbCreate() ?
I'm also a bit worried about a few aspects :
1) Performance, the size of requests may vary tremendously and I currently
use a synchronous receive on my input queue, is this more efficient (I pull
messages when I'm ready) than using beans and onMessage() ? In other words,
will the container try to push message notifications to MDB bean instances
that are not ready ?
2) My standalone JMS consumer is also a producer to several destinations
(including temporary queues, permanent queues and topics), is there any
limitation to the use of JMS destinations in an MDB (what about selectors ?)
vs a standalone java JMS application?
3) My standalone JMS consumer creates a few threads per request. Any gotchas
in a MDB vs a standalone Java JMS application ? Are MDB passivated at any
time ?
Many thanks for any answer,
Rosalie
RosalieRosalie Mignon wrote:
I have implemented a transformation server as a JMS client. This is not
written as a EJB bean, partly because I'm not very familiar with EJB beans.
I'm being told MDB is the way to go (I'm a bit reluctant in front of the
additional work) for the usual reasons : transaction-control (not really an
issue right now for me but may become one), ease of deployment and
centralized monitoring. Fair enough.There's a number of MDB advantages over writing your own JMS consumers.
I would recommend MDBs for JMS consumers running within WLS. If you
have a JMS consumer that is a separate (say client) process, then
vanilla JMS is still the way to go.
The MDB container takes care of things like reconnecting you to JMS if
it fails. It supports foreign JMS providers so your MDBs will work with
"foreign" messaging systems like MQ-Series.
>
My standalone JMS client creates a lot of variables at initialization (such
as a precompiled XSLT stylesheet to substantially improve the speed of each
transformation).
Where should this be created if I were to convert my standalone JMS client
into an MDB ? In ejbCreate() ?Yes, ejbCreate would be fine.
>
I'm also a bit worried about a few aspects :
1) Performance, the size of requests may vary tremendously and I currently
use a synchronous receive on my input queue, is this more efficient (I pull
messages when I'm ready) than using beans and onMessage() ? In other words,
will the container try to push message notifications to MDB bean instances
that are not ready ?I'm not sure I understand. You will have a pool of MDB instances all
receiving from the queue. When an instance is available and there is a
message pending, the EJB/JMS containers will call your MDB's onMessage
implementation.
>
2) My standalone JMS consumer is also a producer to several destinations
(including temporary queues, permanent queues and topics), is there any
limitation to the use of JMS destinations in an MDB (what about selectors ?)
vs a standalone java JMS application?Not that I can think of.
>
3) My standalone JMS consumer creates a few threads per request. Any gotchas
in a MDB vs a standalone Java JMS application ? You are not really allowed to create threads from an EJB. Why do you
need to create threads? In general, we wouldn't recommend that
server-side applications create new threads on each request.
Are MDB passivated at any
time ?
No
Many thanks for any answer,Your domain name is an unusual one for the J2EE world. If you can tell
us, I'd be interested to know what you're doing.
-- Rob
>
Rosalie
Rosalie
Maybe you are looking for
-
hi, I try to view my presentation in jsp page.I use oracle jdeveloper 9.2.0.4 and bibeans 9.2.0.4 and once 1 month ago I did this taks (I view a presentation from bibdemo in jsp file) now I try to view my own presentation in jsp but I recieve error m
-
Ibooks author autoplay not working
I was excited to see that the latest version of iBooks Author has Autoplay as an option. However, selecting it is not allowing HTML5 widget or movies to Autoplay. Is anyone having this work?
-
Response content type does get set.
Hi All, I'm in the middle of converting an ISO-8859-1 web application to a UTF-8 encoded application. The application uses struts/tiles and runs on Sun One App server 7.0 and J2EE 1.3. I have made the following changes to the existing application. 1.
-
ExtendScript Help - Why am I getting "prompt is not a function" error?
Hello RH friends, I need to search through my 2200+ topic project, find any topics that use a certain image in the source and then open up that file in the wysiwyg editor to visually see what's happening to the conditional markings on those topics. I
-
How to create .exe files in CRX/Compiled Report
Hello I am running CRX and we use Control M to schedule reports. According to the company's website, you can create a .EXE and run it on the Windows Command prompt. The problem is (as you will see below), there's no REPORT, COMPILED REPORT functiona