• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How and where to create Service Locator ???

 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic