App won't load if remote app server isn't there

I have an application that is using a connection factory to subscribe to a topic on a remote host. If that remote host is not up when i deploy my application, the application will not load. If the app is already running and the remote server goes down, it will just retry to connect to the remote server. My app can still run with out it. So how do I get my app to come up when the remote server is not up and running? Thanks!

[440 byte] By [706242] at [2007-11-25 8:29:34]
# 1

Please provide more information, such as

The type of application, a mdb, servlet, session bean, appclient .. ?

How the connection factory is used in the application ?

What does the application do ?

The application server version ?

Please elaborate on "subscribe to a topic on a remote host"

amy.kang at 2007-7-1 14:57:52 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 2

Hi! Thanks for replying back! Here is some more info:

> Please provide more information, such as

>

> The type of application, a mdb, servlet, session

> bean, appclient .. ?

For sake of keeping it simple, it is a MDB on one application server and a publisher on another app server.

> How the connection factory is used in the application

> ?

The connection factory is being used from the descriptor files. here is my descriptor file for the MDB (ejb-jar):

<message-driven>

<ejb-name>ReplySubscriber</ejb-name>

<ejb-class>com.mycompany.common.framework.ejb.mdb.ReplySubscriber</ejb -class>

<transaction-type>Container</transaction-type>

<message-driven-destination>

<destination-type>javax.jms.Topic</destination-type>

<subscription-durability>Durable</subscription-durability>

</message-driven-destination>

<env-entry>

<env-entry-name>factoryLookup</env-entry-name>

<env-entry-type>java.lang.String</env-entry-type>

<env-entry-value>java:comp/env/jms/remoteTCF</env-entry-value>

</env-entry>

<env-entry>

<env-entry-name>queryReplyTopic</env-entry-name>

<env-entry-type>java.lang.String</env-entry-type>

<env-entry-value>java:comp/env/jms/statusTopic</env-entry-value>

</env-entry>

<resource-ref>

<res-ref-name>jms/remoteTCF</res-ref-name>

<res-type>javax.jms.TopicConnectionFactory</res-type>

<res-auth>Container</res-auth>

</resource-ref>

<resource-env-ref>

<resource-env-ref-name>jms/statusTopic</resource-env-ref-name>

<resource-env-ref-type>javax.jms.Topic</resource-env-ref-type>

</resource-env-ref>

</message-driven>

-end ejb-jar

here is the bean in the sun-ejb-jar:

<ejb>

<ejb-name>ReplySubscriber</ejb-name>

<jndi-name>jms/statusTopic</jndi-name>

<resource-ref>

<res-ref-name>jms/remoteTCF</res-ref-name>

<jndi-name>jms/remoteTCF</jndi-name>

<default-resource-principal>

<name>admin</name>

<password>admin</password>

</default-resource-principal>

</resource-ref>

<resource-env-ref>

<resource-env-ref-name>jms/statusTopic</resource-env-ref-name>

<jndi-name>jms/statusTopic</jndi-name>

</resource-env-ref>

<mdb-connection-factory>

<jndi-name>jms/remoteTCF</jndi-name>

<default-resource-principal>

<name>admin</name>

<password>admin</password>

</default-resource-principal>

</mdb-connection-factory>

<jms-durable-subscription-name>jms/durableSub</jms-durable-subscriptio n-name>

</ejb>

end sun-ejb-jar

so the container automatically sets up the subscription to the topic statusTopic. The TopicConnectionFactory remoteTCF has a imqBrokerHostName set to a remote host, not localhost. So it is subscribing to a topic using a remote broker through that connection factory.

> What does the application do ?

Again for simplicity sake, all it does is listen for a message to be published to the statusTopic on a remote machine (appserver). There is a publisher on the remote machine that publishes to that topic using a localTCF.

> The application server version ?

SunOne Application Server 7.0 platform edition (and Messaging Queue 3.01 platform)

> Please elaborate on "subscribe to a topic on a remote

> host"

I think i did this above.

So when i deploy this application, the container sets up the durable subscription for me. Then the app waits for a message to be published.

Now, if the app server that contains the publisher is not running and i try to bring up the app server with the MDB (say after a restart), the MDB application will not load because it cannot connect to the remote host named by the connection factory.

How do I get around this? Thanks for the reply!

Andrew

706242 at 2007-7-1 14:57:52 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 3

>If that remote host is not up when i deploy my application, the application will not load. If the app is already running and the remote server goes down, it will just retry to connect to the remote server

If the MQ broker on the remote host is not running,your MDB app will not be

able to be loaded because the MDB container is unable to make connection to

the configured JMS provider - MQ broker on the remote host - to provide

message delivery service for the MDB (an asynchronous message consumer).

If your MDB app is already running and the remote MQ broker goes down, the

MDB container by default will automatically attempt to reconnect to the remote

MQ broker. You can disable the auto-reconnect feature through properties of

mdb-container element in server.xml (see AS7 documentation on server.xml)

>now, if the app server that contains the publisher is not running and i try to bring up the app server with the MDB (say after a restart), the MDB application will not load because it cannot connect to the remote host named by the connection factory.

The built-in MQ broker in the remote app server can be started independently

if you don't want the remote app server running. Please see AS7 and MQ

administration documentation.

amy.kang at 2007-7-1 14:57:52 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 4

> >If that remote host is not up when i deploy my

> application, the application will not load. If the

> app is already running and the remote server goes

> down, it will just retry to connect to the remote

> server

>

> If the MQ broker on the remote host is not running,

>your MDB app will not be

> able to be loaded because the MDB container is unable

> to make connection to

> the configured JMS provider - MQ broker on the remote

> host - to provide

> message delivery service for the MDB (an asynchronous

> message consumer).

>

> If your MDB app is already running and the remote MQ

> broker goes down, the

> MDB container by default will automatically attempt

> to reconnect to the remote

> MQ broker. You can disable the auto-reconnect

> feature through properties of

> mdb-container element in server.xml (see AS7

> documentation on server.xml)

>

> >now, if the app server that contains the publisher

> is not running and i try to bring up the app server

> with the MDB (say after a restart), the MDB

> application will not load because it cannot connect

> to the remote host named by the connection factory.

>

> The built-in MQ broker in the remote app server can

> be started independently

> if you don't want the remote app server running.

> Please see AS7 and MQ

> administration documentation.

>

So what you are telling me is that I can't use the rest of my application if the remote host is down? How is this a viable solution? Why can't the container just retry like it does when the remote host goes down if the application is already loaded? This is how it should work. My application should be able to work independantally of the remote server. It should NOT rely on it being up. And bringing up the MQ Broker seperately isn't a solution either. I still want to publish messages on my machine even if the remote host isn't there.I will take a look at the documentation for the server.xml and see if anything in there will help, but if I cannot use the app server in this way, i'm going to have to find another solution. I'll be very dissapointed in this technology if it works this way..I appreicate your help though.

Please let me know if you have more insight into this problem.

Thanks!

Andrew

706242 at 2007-7-1 14:57:52 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 5
Please see EJB 2.0 specification P314 15.4 Protocol between a message-drivenbean instance and its container, P319 15.5 Message-driven bean state diagram
amy.kang at 2007-7-1 14:57:52 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 6

> Please see EJB 2.0 specification P314 15.4 Protocol

> between a message-driven

> bean instance and its container, P319 15.5

> Message-driven bean state diagram

>

I just read all of chapter 15 of the EJB Spec and it does not mention anything about this problem. This doesn't seems to be a problem with just the MDB container though. It seems to be a problem with how the MDB container interacts with the rest of the EJB container.

Are you a sun support rep? If you are, can I call you and talk about this? Let me know.

Thanks

Andrew

706242 at 2007-7-1 14:57:52 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...
# 7

> It seems to be a problem with how the MDB container interacts with the rest of the EJB container.

No, that is not the issue based on the information you have provided.

EJB 2.0 specification 15.4 -

"It's the container's responsibility to ensure that the message-driven bean

comes into existence when the container is started up ..."

^^

EJB 2.0 specification 15.5 specifies that a message-driven bean from the state

of "does not exist" to the state of existence - "method-ready" - ready to be

^^

delivered a message sent to its Destination ...

That is why the MDB container needs the connection when the MDB is deployed.

If you have further question, please send email to imq-feedback@sun.com

amy.kang at 2007-7-1 14:57:52 > top of Java-index,Application & Integration Servers,Sun Java System Message Queue...