Did you put the following in the Tomcat 4.1.x shared/lib directory:
We've always done this and it works. Some people have reported that placing these jars (or the jbossall-client.jar in later JBoss distributions) in any other place does not work - such as in the WAR.
Normally your JNDI properties should be:
I haven't tried Tomcat with a jndi.properties configuration for JBoss. Normally, we would explicitly define properties in the InitialContext and that does work.
I managed to get around the problem by not using System.getProperties but defining the properties manually, the question remaining is, are those namingfactories incompatible or did I something wrong configuring Tomcat/Jboss?
Obviously nothing wrong in JBoss since you haven't changed anything on the JBoss system.
The jndi.properties could be a problem. Certainly the definitions aren't completely standard but you'd need to experiment with it to see the effect. It works in your other example so probabilities would say that this isn't exactly the problem either.
Possibly Tomcat isn't picking up your JNDI properties. You would need to have picked up and printed the values the System was using to determine if this was the cause. By way of your anecdotal evidence, this is the most likely issue.
Interesting enough, changing the URI from 127.0.0.1:1099 to localhost:1099 actually is noted by Tomcat, so it reads the jndi properties but seems to ignore the namingfactory settings.
Anyway, I got working code and am therefore curious but satisfied. Thanks for Your help,