jndiContext.lookup("java:/ConnectionFactory");

Regards,
Adrian

> On Tue, 2003-12-23 at 20:27, Neal Sanche wrote:
> My code is something like the following:
> 
>     /**
>      * Allocate the JMS Resources if needed.
>      */
>     private void allocateResourcesIfNeeded() {
>         try {
>             InitialContext jndiContext = new InitialContext();
>             Topic topic = (Topic) jndiContext
>             .lookup("topic/com.cartel.usc/timerTopic");
>             TopicConnectionFactory factory = (TopicConnectionFactory) 
>               jndiContext.lookup("ConnectionFactory");
>             if (connection == null)
>                 connection = factory.createTopicConnection();
>             if (session == null)
>                 session = connection.createTopicSession(false, 
>                 Session.AUTO_ACKNOWLEDGE);
>             if (publisher == null)
>                 publisher = session.createPublisher(topic);
>         } catch (Throwable ex) {
>             log
>             .error("Unable to start Timer service. Will not perform 
> automated tasks.");
>         }
>     }
> 
> And then I make calls, once per minute, that look like this:
> 
>     private void fireTimer() {
>         try {
>             allocateResourcesIfNeeded();
>             TextMessage message = 
>               session.createTextMessage(new java.util.Date().toString());
>             publisher.publish(message);
>         } catch (JMSException e) {
>             deallocateResources();
>         } catch (Throwable e) {
>         } finally {
>         }
>     }
> 
> So, I may be using Sockets, but I'm certainly not doing it on purpose. 
> Everything is definitely in the same VM, what would I change?
> 
> -Neal
> 
> On December 23, 2003 03:10 pm, Adrian Brock wrote:
> > > On Tue, 2003-12-23 at 18:15, Neal Sanche wrote:
> > > > Of course it does. The question is, the JBoss instance is
> > > > always talking to itself, on the same machine. Shouldn't the
> > > > TCP/IP connection just stay up all the time? I've never
> > > > encountered this behaviour before JBoss 3.2.3.
> > >
> > > Are you in the same virtual machine?
> > > Why not use java:/ConnectionFactory and forget about the sockets?
> > >
> > > Regards,
> > > Adrian
> > >
> > > > -Neal
> > > >
> > > > On December 23, 2003 12:56 pm, Adrian Brock wrote:
> > > > > The message says the tcp/ip connection was broken.
> > > > >
> > > > > You can monitor for this event using
> > > > > javax.jms.Connection.setExceptionListener()
> > > > > and reconnect.
> > > > >
> > > > > Regards,
> > > > > Adrian
> > > > >
> > > > > On Tue, 2003-12-23 at 17:44, Neal Sanche wrote:
> > > > > > Hi All,
> > > > > >
> > > > > > I'm running a JBoss on a machine that tends to have an IP
> > > > > > address change periodically on it's PPP adaptor. I am
> > > > > > suspecting that might be the reason for the following
> > > > > > exceptions that I get after a certain amount of time on my
> > > > > > system:
> > > > > >
> > > > > > 2003-12-23 12:30:48,577 INFO 
> > > > > > [com.cartel.usc.jmx.TimerService]
> > > > > > org.jboss.mq.SpyJMSException: Cannot send a message to the
> > > > > > JMS server; - nested throwable: (java.net.SocketException:
> > > > > > Broken pipe) 2003-12-23 12:31:45,748 WARN 
> > > > > > [org.jboss.mq.Connection] Connection failure:
> > > > > > org.jboss.mq.SpyJMSException: Connection Failed; - nested
> > > > > > throwable: (java.io.IOException: ping timeout.)
> > > > > >         at
> > > > > > org.jboss.mq.Connection.asynchFailure(Connection.java:718)
> > > > > > at
> > > > > > org.jboss.mq.Connection$PingTask.run(Connection.java:1311)
> > > > > > at
> > > > > > EDU.oswego.cs.dl.util.concurrent.ClockDaemon$RunLoop.run(Cl
> > > > > >ockDae mon.java:364) at
> > > > > > java.lang.Thread.run(Thread.java:534) Caused by:
> > > > > > java.io.IOException: ping timeout.
> > > > > >         at
> > > > > > org.jboss.mq.Connection$PingTask.run(Connection.java:1303)
> > > > > > ... 2 more
> > > > > >
> > > > > > This happens overnight, with a JMX service simply sending a
> > > > > > JMS message to a Topic every minute. When the JMX service
> > > > > > starts it allocates the JMS resources it needs, Connection,
> > > > > > Topic, Session and so on. Those will remain static. I've
> > > > > > just tried stopping and restarting my service, and it's
> > > > > > working again. Very odd. I guess I'll handle the exception
> > > > > > myself, but reallocating the resources on a
> > > > > > SpyJMSException. Any ideas why this is happening though?
> > > > > >
> > > > > > Thanks.
> > > > > >
> > > > > > -Neal
> > > > > >
> > > > > >
> > > > > >
> > > > > > -------------------------------------------------------
> > > > > > This SF.net email is sponsored by: IBM Linux Tutorials.
> > > > > > Become an expert in LINUX or just sharpen your skills. 
> > > > > > Sign up for IBM's Free Linux Tutorials.  Learn everything
> > > > > > from the bash shell to sys admin. Click now!
> > > > > > http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
> > > > > > _______________________________________________
> > > > > > JBoss-user mailing list
> > > > > > [EMAIL PROTECTED]
> > > > > > https://lists.sourceforge.net/lists/listinfo/jboss-user
> > > >
> > > > -------------------------------------------------------
> > > > This SF.net email is sponsored by: IBM Linux Tutorials.
> > > > Become an expert in LINUX or just sharpen your skills.  Sign up
> > > > for IBM's Free Linux Tutorials.  Learn everything from the bash
> > > > shell to sys admin. Click now!
> > > > http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
> > > > _______________________________________________
> > > > JBoss-user mailing list
> > > > [EMAIL PROTECTED]
> > > > https://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: IBM Linux Tutorials.
> Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
> Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
-- 
xxxxxxxxxxxxxxxxxxxxxxxx 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
xxxxxxxxxxxxxxxxxxxxxxxx 



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to