[Ikvm-developers] JMS in C# - Using Weblogic
Brought to you by:
jfrijters
From: Pandivel R <pan...@db...> - 2006-10-10 10:08:43
|
Hi, I have written the C# client to connect Weblogic 8.1.5 JMS Topic (I have added the jms.dll and weblogic.dll in the C# reference). When I run that I am getting this exception java.net.ConnectException: t3://dblonws0822:7001: Bootstrap to dblonws0822/10.129.20.69:7001 failed. It is likely that the remote side declared peer gone on this JVM at weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:200) at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:125) at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:296) at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:239) at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:135) at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:152) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:296) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:347) at javax.naming.InitialContext.lookup(InitialContext.java:381) at cli.JMSsample.Sample.<init>(sample.cs:96) at cli.JMSsample.Sample.Main(sample.cs:67) Exception -> System.NullReferenceException: Object reference not set to an instance of an object. at JMSsample.Sample.getMonitorDetails() in e:\foredev\jmssample\sample.cs:line 127 at JMSsample.Sample.Main(String[] args) in e:\foredev\jmssample\sample.cs:line 68 This is the C# client.. using System; using ikvm.lang; using javax.naming; using java.util; namespace JMSsample { /// <summary> /// Summary description for Class1. /// </summary> class Sample { InitialContext ctx = null; javax.jms.TopicConnectionFactory factory = null; javax.jms.Topic topic = null; javax.jms.TopicConnection connection = null; javax.jms.TopicSession session = null; javax.jms.TopicSubscriber subscriber = null; /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(string[] args) { // // TODO: Add code to start application here // try { Sample s1 = new Sample(); System.Console.WriteLine("Details = "+ s1.getMonitorDetails()); System.Console.ReadLine(); } catch(Exception e) { Console.WriteLine("Exception -> "+e); System.Console.ReadLine(); } } public Sample() { try { Hashtable environment = new Hashtable(); environment.put("java.naming.factory.initial", "weblogic.jndi.WLInitialContextFactory"); String httpURL = "t3://localhost:7001"; environment.put("java.naming.provider.url", httpURL); ctx = new InitialContext(environment); factory = (javax.jms.TopicConnectionFactory) ctx.lookup("foreJmsConnectionFactory"); topic = (javax.jms.Topic) ctx.lookup("testTopic"); connection = factory.createTopicConnection(); session = connection.createTopicSession(false, 1); subscriber = session.createSubscriber(topic); connection.start(); } catch (NamingException e) { e.printStackTrace(); } catch(java.lang.Exception e) { e.printStackTrace(); } } public string getMonitorDetails() { string msgText = " NO MESSAGE "; try { javax.jms.Message message = subscriber.receive(); if (message != null) { msgText = ( (javax.jms.TextMessage) message).getText(); return msgText; } } catch (javax.jms.JMSException e) { e.printStackTrace(); } return msgText; } } } Could you please help me to resolve this exception but it works fine with java client? Thanks & Regards, Pandivel MR --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. |