Skip to Main Content

Problem with the JNDI properties while executing a client test

934472May 4 2012 — edited May 5 2012
Hello Everybody,
I'm trying to learn Jdeveloper, and I have followed the tutoriel " Learn Oracle Fronn Oracle" Volum 2, so i am trying to create a simple oriented bean message with EJB 3.0, and a client test to deliver a message, and the problem is that i can't display my message in the Embedded OC4J WINDOW.

This is the errors displayed:

Line:-----

D:\jdevstudio10132\jdk\bin\javaw.exe -client -classpath D:\jdevstudio10132\EJB30MDB\SimpleMDB\classes;D:\jdevstudio10132\j2ee\home\lib\ejb30.jar;D:\jdevstudio10132\j2ee\home\lib\activation.jar;D:\jdevstudio10132\j2ee\home\lib\ejb.jar;D:\jdevstudio10132\j2ee\home\lib\jms.jar;D:\jdevstudio10132\j2ee\home\lib\jta.jar;D:\jdevstudio10132\j2ee\home\lib\mail.jar;D:\jdevstudio10132\j2ee\home\lib\servlet.jar;D:\jdevstudio10132\rdbms\jlib\aqapi.jar;D:\jdevstudio10132\toplink\jlib\toplink-essentials.jar;D:\jdevstudio10132\j2ee\home\oc4j.jar;D:\jdevstudio10132\j2ee\home\oc4jclient.jar;D:\jdevstudio10132\j2ee\home\lib\javax77.jar -Dhttp.proxyHost=10.0.0.99 -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts=localhost|127.0.0.1|doi-sonia -Dhttps.proxyHost=10.0.0.99 -Dhttps.proxyPort=8080 -Dhttps.nonProxyHosts=localhost|127.0.0.1|doi-sonia oracle.mdb.jmsclient.TestJMSClient
Looking up TCF
javax.naming.CommunicationException: Connection refused: connect [Root exception is java.net.ConnectException: Connection refused: connect]
at com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:292)
at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:51)
at com.evermind.naming.FilterContext.lookup(FilterContext.java:126)
at com.evermind.server.ApplicationClientContext.lookup(ApplicationClientContext.java:63)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at oracle.mdb.jmsclient.TestJMSClient.main(TestJMSClient.java:20)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:507)
at java.net.Socket.connect(Socket.java:457)
at java.net.Socket.<init>(Socket.java:365)
at java.net.Socket.<init>(Socket.java:207)
at com.evermind.server.rmi.RMIClientConnection.createSocket(RMIClientConnection.java:682)
at oracle.oc4j.rmi.ClientSocketRmiTransport.createNetworkConnection(ClientSocketRmiTransport.java:58)
at oracle.oc4j.rmi.ClientRmiTransport.connectToServer(ClientRmiTransport.java:78)
at oracle.oc4j.rmi.ClientSocketRmiTransport.connectToServer(ClientSocketRmiTransport.java:68)
at com.evermind.server.rmi.RMIClientConnection.connect(RMIClientConnection.java:646)
at com.evermind.server.rmi.RMIClientConnection.sendLookupRequest(RMIClientConnection.java:190)
at com.evermind.server.rmi.RMIClientConnection.lookup(RMIClientConnection.java:174)
at com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:283)
... 5 more
Process exited with exit code 0.

Line:-----


and and there is the TestJMSClient code:

Line:-----

package oracle.mdb.jmsclient;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.Message;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.Topic;
import javax.naming.InitialContext;


public class TestJMSClient {


public static void main(String[] args) {

try {
System.out.println("Looking up TCF");
ConnectionFactory connectionFactory =
(ConnectionFactory) new InitialContext()
.lookup("jms/TopicConnectionFactory");
Connection connection = connectionFactory.createConnection();
connection.start();
System.out.println("Starting Topic Session");
Session topicSession = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
Destination topic = (Destination)new InitialContext().lookup("jms/demoTopic");
MessageProducer publisher = topicSession.createProducer(topic);
Message message = topicSession.createMessage();
message.setJMSType("theMessage");
message.setLongProperty("time", System.currentTimeMillis());
message.setStringProperty("subject", "Test EJB 3.0 MDB");
message.setStringProperty("message",
"Test message Send to first EJB 3.0 MDB");
publisher.send(message);
System.out
.println("Message Sent to JMS Topic, Check Server Console to See whether MDB got activated!");
publisher.close();
topicSession.close();
connection.close();
}catch (Throwable ex) {
ex.printStackTrace();
}
}

}

Line:-----

I am not sure if the JNDI properties should have a correct configuration to make this application work:

Line:-----

java.naming.factory.initial=oracle.j2ee.naming.ApplicationClientInitialContextFactory
java.naming.provider.url=ormi://localhost:23891/current-workspace-app
java.naming.security.principal=oc4jconn
java.naming.security.credentials=welcome

Line:-----

Above, it's the code given by the tutoriel, i change welcome by my pass word, but the problem still existing.

Any idea or help would be greatful
Thanks
Comments
Post Details
Added on May 4 2012
7 comments
3,504 views