Start OC4J with user thread option
When starting an OC4j using datasource, this error may arise:
"Javax.naming.NamingException: Not in an application scope - start Orion with the -userThreads switch if using user-created threads"
Solution:
If using stand alone OC4J, start it with -userThreads parameter.
For example: java -jar oc4j.jar -userThreads
If using Oracle Application server, add the oc4j.userThreads=true parameter to <ORACLE_HOME>/j2ee/home/config/oc4j.properties
5 Comments:
Solved my problem, thank you!
Even though this seems to solve the problem of application scope, i have noticed that using lookup on initialcontext in user defined threads is not threadsafe
I was using an OC4JStartup class that created threads and the error still occurred even with userThreads enabled.
The way around this is to set the userThreads property in the preDeploy() method:
public String preDeploy(Hashtable args, Context context)
{
System.setProperty("oc4j.userThreads", "true");
return "OK";
}
That finally fixed it for me.
thank you very much.
Yes, I faced the same problem worth OC4J. I was using OC4J as standalone program. You guys solved my problem. I am going to try both the methods and use whichever I find easy and simple to remember. I don't know why this solution didn't strike me.
Post a Comment
<< Home