I am having problems connecting to JMS from a J2EE Client. The app works when run inside of NetBeans IDE. It also works when using webstart from the same machine (javaws
http://localhost:8080/JMSTest2). But it hangs if you try and access it from a remote machine using javaws
http://192.168.1.11:8080/JMSTest2. The app will start on the remote machine but hangs on this line.
ConnectionFactory theCF = (ConnectionFactory) theContext.lookup("jms/test_cf");
there is no stack trace or exception on the remote client.
There is a stack trace on the server for both local and remote, but as the local works I am not sure it is causing the problem. When the app is first loaded using javaws -- this exception is thrown on the server.
SEVERE: Adapter[/___JWSappclient/___system] glassfish/modules/webservices-osgi.jar
java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)
at sun.nio.ch.IOUtil.write(IOUtil.java:75)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334)
at com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:106)
at com.sun.grizzly.util.OutputWriter.flushChannel(OutputWriter.java:74)
at com.sun.grizzly.http.SocketChannelOutputBuffer.flushChannel(SocketChannelOutputBuffer.java:321)
at com.sun.grizzly.http.SocketChannelOutputBuffer.flushBuffer(SocketChannelOutputBuffer.java:392)
at com.sun.grizzly.http.SocketChannelOutputBuffer.realWriteBytes(SocketChannelOutputBuffer.java:279)
at com.sun.grizzly.tcp.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:884)
at com.sun.grizzly.tcp.http11.filters.IdentityOutputFilter.doWrite(IdentityOutputFilter.java:155)
at com.sun.grizzly.tcp.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:640)
at com.sun.grizzly.tcp.Response.doWrite(Response.java:676)
at com.sun.grizzly.tcp.StaticResourcesAdapter.service(StaticResourcesAdapter.java:229)
at org.glassfish.appclient.server.core.jws.RestrictedContentAdapter.processContent(RestrictedContentAdapter.java:266)
at org.glassfish.appclient.server.core.jws.RestrictedContentAdapter.serviceContent(RestrictedContentAdapter.java:226)
at org.glassfish.appclient.server.core.jws.AppClientHTTPAdapter.service(AppClientHTTPAdapter.java:135)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)
here is the sample jms client i am trying to use
package jmstest2;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import javax.naming.Context;
import javax.naming.InitialContext;
public class Main
{
public static void main(String[] args)
{
System.out.println("Starting");
try
{
Context theContext = new InitialContext();
System.out.println("Getting Connection Factory.");
ConnectionFactory theCF = (ConnectionFactory) theContext.lookup("jms/test_cf");
System.out.println("Getting Queue.");
Queue theQueue = (Queue) theContext.lookup("jms/test_queue");
Connection theConnection = theCF.createConnection();
Session theSession = theConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer theProducer = theSession.createProducer(theQueue);
}
catch (Exception inException)
{
inException.printStackTrace();
}
System.out.println("Finished");
}
}
Any help or ideas will be appreciated.
[Message sent by forum member 'glenmiller' (glenmiller_at_skyviewsoftware.com)]
http://forums.java.net/jive/thread.jspa?messageID=383520