Hello, this question is two part.
Part 1: How can I place a simple custom java object in jndi on jboss 4? In Tomcat is could not be easier. I simply have
< Context path="/myApp" ... >
< Resource name="myPath/MyObject"
auth="Container"
type="com.myco.MyObject"
factory="org.apache.naming
.factory.B
eanFactory
"
location="localhost"/> // this line will call getLocation in MyObject after instantiating it.
</Context>
Now to use this I simply:
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/
env");
MyObject myObj = (MyObject) envCtx.lookup("myPath/MyOb
ject");
Part 2: The above Tomcat config is very nice since it is app context specific. I can now take myApp.war and copy/paste it as myAppQA.war. No app config at all. I simply add another context to server.xml except I change the name to myAppQA and the location="localhost" to location="
www.where-ever.com". Then when ever I deploy the either myApp or myAppQA it will get the different object even though the application code points to the same name. In JBoss, it looks like any jndi reference is to be setup as app server wide, not app context wide.
I'm really stuck on this as I'm new to JBoss. Thanks in advance.
Dale