• 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Tim Cooke
  • Bear Bibeault
  • paul wheaton
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Mikalai Zaikin
  • Piet Souris

How to deploy URLs like default URL provider in websphere

Posts: 6
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Our EJBs and WARs (in an EAR) have references to an URL.
I want to deploy this URL in JNDI one time and resolve all references by linking on the deployed URL.
This is the same concept as websphere default URL provider, but how do I do that in jboss?
Which mbean can I use?
Do I have to define a special service?
Right now, I resolved the link using the jboss.xml file and it works. But I do not want to repeat this in each EJB.

Thank you.

My code uses a URL like this:
public static final String AUDITLOG_PATH = "java:comp/env/AuditLogPath";
Object rep = new InitialContext().lookup(InternalJNDIRefererences.AUDITLOG_PATH);

In ejb-jar.xml:

In jboss.xml:




This works:
UserTransaction (class: javax.transaction.UserTransaction)
+- env (class: org.jnp.interfaces.NamingContext)
| +- ejb (class: org.jnp.interfaces.NamingContext)
| | +- ConfigurationManager[link -> ConfigurationManager] (class: javax.naming.LinkRef)
| +- AuditLogPath (class: java.net.URL)

But I don't want to duplicate the URL definition in all WARs and EJBs jboss xml config.

How can I define something I can deploy in server/default/deploy ?
Which mbean can I reuse to deploy URLs like in websphere URL provider?
Marc Gagnon
Posts: 6
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After looking around, I found that I can do this:
Add the following to conf/jboss-service.xml:
<mbean code="org.jboss.naming.JNDIBindingServiceMgr"
<attribute name="BindingsConfig" serialDataType="jbxb">
xs:schemaLocation="urn:jboss:jndi-binding-service:1.0 resource:jndi-binding-service_1_0.xsd"

<jndi:binding name="urls/jboss-home">
<jndi:value type="java.net.URL">http://www.jboss.org</jndi:value>;


Then I see it in the global JNDI tree:
+- urls (class: org.jnp.interfaces.NamingContext)
| +- jboss-home (class: java.net.URL)

Which is fine.

As is, this is a working solution.

The only improvement I would like to see is:
How can I define the same behavior outside of the jboss-service.xml file?
The reason I'm asking is because I don't like the idea of adding to an existing configuration file.
When we install a new jboss from the distribution, I like to be able to unzip the whole package and then, only add the config file required.
If I keep the urls in the jboss-service.xml file, I cannot do this: I must open (manually or programmatically) the jboss-service.xml file and add the mbean section at the end.
I would prefer to simply copy a standalone file to do the same.
Any suggestion?
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure if this is too late to be helpful, but I believe you can put that in any -service.xml (ex: myApp-service.xml) file and drop it in your deploy directory and have it deployed for JNDI lookup.

Of of these might be a helpful reference (pretty much the same thing in both):
I don't get it. A whale wearing overalls? How does that even work? It's like a tiny ad wearing overalls.
Low Tech Laboratory
    Bookmark Topic Watch Topic
  • New Topic