On Tue, 19 Jun 2001 [EMAIL PROTECTED] wrote:

> Hi,
> 
> > My question is: How do we start with that with JBOSS ???? How 
> > can we 'find' beans deployed in a JBOSS on another computer 
> > and use them ?? 
> 
> Start the JBoss on one of the computers. You have to check the
> jndi.properties in the JBoss config, and replace the localhost with the
> normal IP address/host name in the
> java.naming.provider.url property where the JBoss is running.

Hi,

I guess I have some experience working with this, so here it goes.

The above mentioned method would not work very well at this point. The
reason is simple. If all the JBoss servers share JNDI space by registering
all into a single namespace on the host given in the provider.url, there
will be naming conflicts, because each JBoss server registers JMX beans
and other stuff in the global JNDI namespace and all of the server
instances would use the same name. When clustering in JBoss picks up, this
issue would be taken care of by some form of distributed JNDI
implementation and each server instance awareness of operating in a
cluster environment.

There is, though a very simple solution. All you need to do, is specify
ejb-refs in jboss.xml to point directly to the beans deployed on the
remote machines. An example of that would be

<jboss>
  <enterprise-beans>
    <session>
       <ejb-name>TheShoppingClientController</ejb-name>

       <ejb-ref>
         <ejb-ref-name>ejb/mailer</ejb-ref-name>
         <jndi-name>jnp://hostname:1099/TheMailer</jndi-name>
       </ejb-ref>

        ...
       snip
       ....

    </session>
  </enterprise-beans>
</jboss>


This jboss.xml defines an external reference named "ejb/mailer" for
a bean "TheShoppingClientController" to point to a bean deployed on JBoss
running on "hostname" (1099 is the port where JBoss JNDI runs by
default) under name "TheMailer"

This is as far as connecting the beans together.

Another major issue is distributed transaction support (which you will
need if the beans are calling each other in transactional manner across
the Jboss servers). Native JBoss TM does not support distributed
transactions across Jboss servers. Luckily for you I've integrated a DTM
from exolab.org called Tyrex together with JBoss about a month ago. All
the code for this, though, is not in 2.2 but should be in 2.4 and up. I
have not posted any documentation about it but configuration is trivial,
if you are interested, ask me. The code is in org.jboss.tm.plugins.tyrex
and Tyrex is supplied in the JBoss CVS as well, so the configuration
basically involves commenting out default JBoss TM MBean and uncommenting
Tyrex DTM MBean in jboss.jcml and then starting JBoss (I said it is
trivial :)

Now, you should also be aware that XADataSources are _not_ serializable,
so if your beans deployed on different machines need to access the same
database, you need to configure each server's DataSources
separately and the beans would access the database through its
local server's DataSource. Beware of your database consistency,
though. This may get hairy.

If something is unclear, don't hesitate to ask me.

Anatoly Akkerman.

> 
> The same should be done in your client environment (depending on how you
> initialize the initial context).
> 
> Check the JDBC url if it points to the database server instead local host,
> check your JSP  engine if it tries to connect to the JBoss host for JNDI
> lookups (the property above).
> 
> Seems that's all... 
> 
> Regards,
> Roman
> 
> P.S. I have two machines: one running the JBoss + database (InterBase),
> other's running Tomcat. Both have Apache with mod_jk that connects to the
> Tomcat, and load balancer that sends requests to both Apache instances. It
> runs well.
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
> 


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to