Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
Phill Moran reported a problem with WASManagedRuntime and Spring. Attached is the relevant portion of the stack trace :
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.jav
a:196)
Caused by: <4|true|0.0.0> org.apache.openjpa.persistence.InvalidStateException:
An error occured reflecting WebSphere proprietary interfaces. Please ensure that
you are running the application from within WebSphere Application Server
(version 5.0.2 or newer).
FailedObject: javax.naming.NoInitialContextException: Need to specify class name
in environment or system property, or as an applet parameter, or in an
application resource file: java.naming.factory.initial
at
org.apache.openjpa.ee.WASManagedRuntime.endConfiguration(WASManagedRuntime.java:
344)
at
org.apache.openjpa.ee.AutomaticManagedRuntime.getTransactionManager(AutomaticMan
agedRuntime.java:124)
... 39 more
NestedThrowables:
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an application
resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at
org.apache.openjpa.ee.JNDIManagedRuntime.getTransactionManager(JNDIManagedRuntim
e.java:51)
at
org.apache.openjpa.ee.AutomaticManagedRuntime.getTransactionManager(AutomaticMan
agedRuntime.java:140)
I don't believe this is the root of the problem that he's running into, but it needs to be cleaned up before we go further.
The error occurs when we configure the WASManagedRuntime and one approach is to swallow the exception at that time and proceed.
A better approach is to look for a "WebSphere signiture" in the constructor to WASManagedRuntime, if it's not found throw an exception. The exception is handled by AutomaticRuntime and prevents WASManagedRuntime from being used again (this is similar to what WLSManagedRuntime does).