• Post Reply Bookmark Topic Watch Topic
  • New Topic

Develop application to lookup resources at runtime?  RSS feed

 
Sheeraz Junejo
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a very simple and light weight web application which lookup resources using InitialContext etc etc on runtime (User input the CxFactory, Queue names etc and my application lookup these resources and uses them), but this is only possible on jBoss because WebLogic and WebSphere won't allow lookups until unless I map them using my deployment descriptor and this way I have to hard code the resources names. How can I achieve dynamic lookup without using deployment descriptors? Using any framework like Spring?

I am looking for some example or tutorial which can explain this?

Let me know if you need more information on this.

Thanks,

--

SJunejo
 
Nitin Kasat
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please explain little more what exactly your application does or your requirement is? Because when you say your application need to lookup resources at runtime, and when use intialcontext.lookup() it is at runtime only. So if you have bound any resources to initial context before perform lookup you should be able to lookup at runtime with specified properties. If resources are not bound then no server will return lookup results. Let me know if anything is misunderstood by me.
 
Sheeraz Junejo
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I have developed a small web based utility which takes Cx Factories, JMS Queues etc etc JNDI names as input from user and lookup on runtime to verify that it exist or not. Now jBoss allow you to dynamically lookup resources by passing 'java:comp/env/....' as JNDI to initialContext.lookup() but now I want to make my application compatible with WebSphere and WebLogic application servers which does not allow lookup (access to the resources which are not mapped at the time of deployment) without mapping resources via deployment descriptors. As you know user can input any name as JNDI, so I can not have deployment descriptor but some other mechanism to enable my application to access the resources. I heard If I use Spring framework than it might help.

I hope it make any sense. Let me know if you need more information.

Thanks,

--

SJunejo
 
Sheeraz Junejo
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does above make any sense?
 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Sheeraz, so you mean that if I want to bind some object to the JNDI at runtime I cannot look it up during runtime?

EDIT: in WebSphere and Weblogic.

What version of servers / EJB container do you use?
 
Sheeraz Junejo
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to deploy my application on WebSphere 7+ and WebLogic 10.3.3 (11g).
 
Piotr Nowicki
Ranch Hand
Posts: 611
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hard to say... Maybe it's the matter of non-portable global JNDI which was introduced in Java EE 6? (as far as I know WebSphere 7 implements Java EE 4 and Weblogic Java EE 5)

Needless to say, there were few topics with similar question:
http://www.coderanch.com/t/77370/Websphere/Websphere-JNDI-lookup-warning-when
http://www.coderanch.com/t/484139/Websphere/JNDI-Lookup-WebSphere
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!