This discussion is archived
7 Replies Latest reply: May 5, 2012 2:41 PM by EJP RSS

Problem with the JNDI properties while executing a client test

934472 Newbie
Currently Being Moderated
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
  • 1. Re: Problem with the JNDI properties while executing a client test
    EJP Guru
    Currently Being Moderated
    javax.naming.CommunicationException: Connection refused: connect [Root exception is java.net.ConnectException: Connection refused: connect]
    This exception has exactly one meaning. Nothing is listening at the host:port you specified.
  • 2. Re: Problem with the JNDI properties while executing a client test
    934472 Newbie
    Currently Being Moderated
    Thanks for answering, did you mean: 23891, mentioned in this line:

    java.naming.provider.url=ormi://localhost:23891/current-workspace-app

    Could 'i specify another one and what can i put rather than it?
  • 3. Re: Problem with the JNDI properties while executing a client test
    EJP Guru
    Currently Being Moderated
    Not being able to see your system and know what is or isn't listening at every port, I don't see how you can reasonably expect anyone here to answer that.
  • 4. Re: Problem with the JNDI properties while executing a client test
    934472 Newbie
    Currently Being Moderated
    I use Oracle Jdeveloper 10.1.3.2.0 , Oracle 10g(10.2) Express Edition and PL/SQL Developer V: 7.1.0.13337, XP as OS .
    this is my netstat-a cmd, i expect you can answer, if you want any information about my system, ask me and i will answer you, thanks a lot:

    ***********************************************************
    Connexions actives

    Proto Adresse locale Adresse distante Etat
    TCP est-tatia:epmap est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:microsoft-ds est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:1053 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:1110 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:1521 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:8888 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:9127 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:19780 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:23791 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:23943 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:netbios-ssn est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:1056 est-tatia.ABL.local:1521 ESTABLISHED
    TCP est-tatia:1059 10.0.0.101:13000 ESTABLISHED
    TCP est-tatia:1387 10.0.0.101:epmap TIME_WAIT
    TCP est-tatia:1388 10.0.0.101:1026 TIME_WAIT
    TCP est-tatia:1390 10.0.0.101:epmap TIME_WAIT
    TCP est-tatia:1391 10.0.0.101:1026 TIME_WAIT
    TCP est-tatia:1521 est-tatia.ABL.local:1056 ESTABLISHED
    TCP est-tatia:1038 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:1044 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:1132 localhost:1521 ESTABLISHED
    TCP est-tatia:1137 localhost:1138 ESTABLISHED
    TCP est-tatia:1138 localhost:1137 ESTABLISHED
    TCP est-tatia:1139 localhost:1140 ESTABLISHED
    TCP est-tatia:1140 localhost:1139 ESTABLISHED
    TCP est-tatia:1385 localhost:1386 ESTABLISHED
    TCP est-tatia:1386 localhost:1385 ESTABLISHED
    TCP est-tatia:1389 localhost:23791 ESTABLISHED
    TCP est-tatia:1521 localhost:1132 ESTABLISHED
    TCP est-tatia:8080 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:23791 localhost:1389 ESTABLISHED
    TCP est-tatia:30523 est-tatia.ABL.local:0 LISTENING
    UDP est-tatia:microsoft-ds *:*
    UDP est-tatia:isakmp *:*
    UDP est-tatia:1025 *:*
    UDP est-tatia:1026 *:*
    UDP est-tatia:1151 *:*
    UDP est-tatia:4500 *:*
    UDP est-tatia:15000 *:*
    UDP est-tatia:15001 *:*
    UDP est-tatia:ntp *:*
    UDP est-tatia:netbios-ns *:*
    UDP est-tatia:netbios-dgm *:*
    UDP est-tatia:1900 *:*
    UDP est-tatia:ntp *:*
    UDP est-tatia:1027 *:*
    UDP est-tatia:1048 *:*
    UDP est-tatia:1287 *:*
    UDP est-tatia:1289 *:*
    UDP est-tatia:1900 *:*
    **************************************************************************
  • 5. Re: Problem with the JNDI properties while executing a client test
    EJP Guru
    Currently Being Moderated
    this is my netstat-a cmd
    In which port 23891 does not appear.

    My case rests.
  • 6. Re: Problem with the JNDI properties while executing a client test
    934472 Newbie
    Currently Being Moderated
    Excuse me but i dont understand what you mean by "In which port 23891 does not appear".
    Did you want to ask me why the port 23891 is not appear? if that is your question, my answer will be: i dont know.
  • 7. Re: Problem with the JNDI properties while executing a client test
    EJP Guru
    Currently Being Moderated
    I didn't 'want to ask you' anything. I noted that the port number in your source code does not appear in the netstat output, so there is nothing listening at that port, which bears out my initial answer. Either the service you are trying to connect to isn't running at all, or it's listening at a different port, or it's running and listening at that port in a different host.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points