How about just making a copy of your configuration and launching it
bound to a different host? That way you do not have to change anything
provide you are using the no-arg InitialContext.

Example: 

1. Create copies of your configuration folder: /jboss/server/orginal ->
/jboss/server/foo and /jboss/server/bar 
2. Add two additional IPs to your NIC mapped to foo and bar for
convenience (say, in /windows/system32/drivers/etc/hosts). 
3. Launch using shortcut, in this case the hostname and configuration
happen to be the same: 

        run.bat -c foo --host foo 

4. Rinse and repeat. 

        run.bat -c bar --host bar

Ditto for Linux more or less. Make sure you DO NOT run the same
configuration twice and remove
/jboss/server/whaddeva/deploy/snmp-adapter.sar, from every instance.
That's about it.




-----Original Message-----
From: Brian Styles [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 08, 2003 2:18 AM
To: [EMAIL PROTECTED]
Subject: [JBoss-user] Multiple deploy of ear, how to steps


Hi all,

This list has been very helpful to me so I thought I'd write some notes
on 
things I experienced in order to get the same application deployed and 
virtual hosted multiple times on jboss-3.2.2. This has been a common
enough 
query on the lists and the forums.

The application was a standard enough struts---->sesssion beans & MDBs
----> 
cmr-entity beans
packaged as an ear file

Issues with deployment are:

1) If you deploy ejbs in two ears then the jndi names will conflict, so
you 
must change the jndi names for each deployed bean. Xdoclet allows you to
do 
this easily. You don't have to rename the ejbs, just change the jndi 
mappings

2) Unfortunately xdoclet doesn't currently support creating jndi
mappings 
for MDBs so you can't easily change their names. However apparently this
was 
recently realised and a patch has been created. 
http://www.mail-archive.com/[EMAIL PROTECTED]/msg33920.ht
ml
(I presume that this means it will be available in the next version of 
xdoclet?)

3) Also, you have to add the queues to jbossmq-destinations-service.xml.

4) I'm using mysql, and so for each ear deployed I wanted to connect to
a 
different database. For this you must add a new datasource. I created a 
different mysql-ds.xml file for each one.

5) I was unable to successfully get ears to successfully use their
correct 
database until I added a jboss-app.xml file to META-INF containing the 
following:

<jboss-app>
 
<loader-repository>myapp.com:loader=nameofmyear.ear</loader-repository>
</jboss-app>

This loads the ear with a different classloader. It fixed my problems
(not 
too sure why).

6) I used to keep the struts and commons jar files in
myapp.war/WEB-INF/lib. 
However when multiple versions of the app are running, then I got
errors. By 
removing all the jars from this folder and putting them in 
server/yourconfig/lib I fixed the problem.

7) Then to add virtual hosting, first add the following line to your 
myapp.war/jboss-web.xml file:

<virtual-host>www.whatever.com</virtual-host>

8) Then add the corresponding entry to

 
server/yourconfig/deploy/jbossweb-tomcat41.sar/META-INF/jboss-service.xm
l

<Host name="www.whatever.com">
  <Valve className="org.apache.catalina.valves.AccessLogValve"
prefix="xyz" 
directory="${jboss.server.home.dir}/log"/>
</Host>

within the engine tag.

If you want to test that the virtual hosting is working, you'll have to
edit 
your dns. For linux guys, that's probably easy. However if you're a
newbie 
and a windows user like me, you can download a dns server and run it
locally 
to test your virtual hosting. The one I used was called posadis from 
sourceforge and was simple and worked fine.

That's about it.

A few things to know that would be good are:

a) how many virtual hosted apps can easily be run on a single jboss.
This 
probably depends on memory and cpu and load on each etc, but just if
anyone 
has experience such as - "I run 100 virtual hosted apps on jboss" etc.
that 
would be good to know.

b) Is it possible to set up a different log file for each deployed 
application? If so, how.

anyway, hope this helps others out there.
thanks,
Brian

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail



-------------------------------------------------------
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_id78&alloc_id371&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to