classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with JDNI (under IKVM)


From: Le.Wang
Subject: Problem with JDNI (under IKVM)
Date: Tue, 12 Jul 2005 19:06:26 +0200

Hi,
 
 
my task is to use the Joram JMS (Java Messaging Service, provider JORAM) in my .Net(C#) application, at first
I used "jbimp" from .Net, but jbimp could never find the classpaths which I set, today  I found
the tool IKVM which uses GNU Classpath, I feel the IKVM is much better, but I still met some problems.
 
 
I have a small test program  "TestSend.java" which sends the messages to JMS Server,
and it runs well :
---
javac TestSend.java
java TestSend
---> the messages are sended.
----
 
 
Then I compressed the TestSend to TestSend.jar and used "ikvmc" to convert it to TestSend.dll,
the converse was successful, but there were serveral warnings about some classes such like javax.jms.Queue (all from javax.jms.*)
missing ( which I already set it in system envirement variables, I tried to copy the jar files to the same ordner
of TestSend.java/class too, but there were still the warnings).
 
When I added the dll file as reference in my C# application, the program "died" at an unknow position, and
I got no exceptions , it just stayed and did't go on.
 
Later I tried to run the java application  with JVM "ikvm" to make sure whether the IKVM worked, Because I think if I
 could run it with IKVM in a command, then I could run it in my .Net application with the help of IKVM too, couldn't I?
I did the following in a command:
----
1. compile TestSend.java  again
2. run "java TestSend", and it worked.
3. run "ikvm TestSend", and it worked until about 30% and stoped without any response. 
----
 
 
Here it is the source code of the method "sending" in the java application which works through JNDI.:
--------------------------------------------------------------------------
 Hashtable jndiProps = new Hashtable();
  public void sending()throws Exception
  {
    System.out.println("11");
    jndiProps.put("java.naming.factory.initial",
                  "fr.dyade.aaa.jndi2.client.NamingContextFactory");
    jndiProps.put("java.naming.factory.host",
                  "localhost");
    jndiProps.put("java.naming.factory.port",
                  "16400");
 System.out.println("22");
    Context ictx = null;
 System.out.println("33");
    try {
      ictx = new InitialContext(jndiProps);
      System.out.println("init");
    }
    catch (NamingException e) {
      e.printStackTrace();
      System.out.println(e.toString());
    }

 System.out.println("44"); // output was showed in the command, then it hanged
      Queue queue = (Queue) ictx.lookup("queue");
      System.out.println(queue.toString()); // I didn't get this output
       System.out.println("442");
      QueueConnectionFactory qcf = (QueueConnectionFactory) ictx.lookup("qcf");
System.out.println("55");
      ictx.close();
System.out.println("66");
      QueueConnection qc = qcf.createQueueConnection();
      System.out.println("77");
      QueueSession qs = qc.createQueueSession(true, 0);
      QueueSender qsend = qs.createSender(queue);
      TextMessage msg = qs.createTextMessage();
 
      int i;
      for (i = 0; i < 10; i++) {
        msg.setText("Test number " + i);
        qsend.send(msg);
      }
    System.out.println("88");
      qs.commit();
 
      System.out.println(i + " messages sent.");
 
      qc.close();
--------------------------------------------------------------------------------
 
The program hangs by "ictx.lookup", is it a bug ? Did anyone have the same problem? I
really need some help to solve it.
 
Thanks a lot!
 
Le

reply via email to

[Prev in Thread] Current Thread [Next in Thread]