• Post Reply Bookmark Topic Watch Topic
  • New Topic

How and where to create Service Locator ???

 
Giju George
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am creating a J2EE app with a few EJBs in an .ear file and a Client Tier in a separate .war file, running in JBoss. Now I want to create a Service Locator for handlng the lookup code. I've got a few ques.

1. I don't want to hardcode the IP Address of the server for lookup because if the server address changes, then I have to re-compile the whole class. So, which is the best place to define the address as a String. Even if I define it in <env-entry> in either the web.xml OR ejb-jar.xml, to get that env, I need to do a lookup with the IP ???

2. What's the best way to deploy the Service Locator, as a separate jar file or combined with .war OR .ear file ???. I mean, how do the j2ee veterans use this normally ???.

3. What's the best way to deploy the Business Delegate, as a separate jar file or combined with .war OR .ear file ???

Thanx for your reply.

[ November 08, 2004: Message edited by: Giju George ]
[ November 08, 2004: Message edited by: Giju George ]
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Giju George:
Hi,
I am creating a J2EE app with a few EJBs in an .ear file and a Client Tier in a separate .war file, running in JBoss. Now I want to create a Service Locator for handlng the lookup code. I've got a few ques.

1. I don't want to hardcode the IP Address of the server for lookup because if the server address changes, then I have to re-compile the whole class. So, which is the best place to define the address as a String. Even if I define it in <env-entry> in either the web.xml OR ejb-jar.xml, to get that env, I need to do a lookup with the IP ???

2. What's the best way to deploy the Service Locator, as a separate jar file or combined with .war OR .ear file ???. I mean, how do the j2ee veterans use this normally ???.

3. What's the best way to deploy the Business Delegate, as a separate jar file or combined with .war OR .ear file ???

Thanx for your reply.

[ November 08, 2004: Message edited by: Giju George ]

[ November 08, 2004: Message edited by: Giju George ]


From your description I understand that both the war and ear are in the same JVM. In such a case you dont need to hard code the IP address. When doing the JNDI lookup you could just use the default constructor of InitialContext.

Put Business delegate/Service Locator in war file.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!