This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes BEA/Weblogic and the fly likes WebLogic 10.3: how to add System Property/new global JNDI object at server startup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "WebLogic 10.3: how to add System Property/new global JNDI object at server startup" Watch "WebLogic 10.3: how to add System Property/new global JNDI object at server startup" New topic
Author

WebLogic 10.3: how to add System Property/new global JNDI object at server startup

Emanuele Ghe
Ranch Hand

Joined: Feb 04, 2009
Posts: 111
Hi,
I am migrating from JBoss to WebLogic, and I need to add some object to the JNDI tree.

What I need to do is bind my properties file path to a JNDI name, so I can lookup from my applications (EJB 2.1) these path and access
properties without carving the path into code.

In jboss I used the "properties-service.xml" file, in which I can define key/values pairs, and the key will be published in the server global JNDI directory.

How can I do the same in weblogic 10.3 ?

Thanks !


SCJP6 with score 90%. I am conscious of my ignorance and ready to learn from everyone.
Emanuele Ghe
Ranch Hand

Joined: Feb 04, 2009
Posts: 111
Can someone help me ?
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Hi Emanuele,

I am not aware of an automated process that can achieve what you want. One way to do this would be to write a startup class that will bind these key/value pairs for you when the server starts. If you are paying for a weblogic license, you should email support. That might shed some light into the problem. If you do find a way to do this declaratively, do let us know.


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Emanuele Ghe
Ranch Hand

Joined: Feb 04, 2009
Posts: 111
Hi,
I reply here what I've found for all the other members.

First of all this post points out how to do something similar:

http://forums.oracle.com/forums/thread.jspa?forumID=598&threadID=1017093


Next, this article point some best practices on managing properties file:

http://www.javaworld.com/javaworld/javaqa/2003-08/01-qa-0808-property.html



At the end, the solution I came from reading these posts/articles is to deploy an ear containing the properties files as a shared library and
then use the ClassLoader to load the files into my modules.


I hope this can help others as it did for me.
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Thanks for sharing your solution.

Since your did indeed use shared libraries, perhaps you could have loaded the properties files into the JNDI directly instead of accessing the class files in the other application using the ClassLoader. Just a suggestion
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: WebLogic 10.3: how to add System Property/new global JNDI object at server startup