Tuesday, June 05, 2007

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:

Anonymous Anonymous said...

Solved my problem, thank you!

11/04/2008 5:33 PM  
Anonymous Anonymous said...

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

12/31/2008 5:05 AM  
Anonymous Anonymous said...

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.

1/21/2009 9:58 PM  
Anonymous Anonymous said...

thank you very much.

9/16/2009 9:08 AM  
Anonymous sap erp system said...

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.

11/05/2011 1:41 AM  

Post a Comment

<< Home