873 words

WebSphere Liberty Configuration

#1
2016-08-09 14:30

Hi!

I've been trying to get ObjectDB configured with WebSphere Liberty server.

I have been able to get the sample app running in TomCat but when I run the jee version of the guestbook in WebSphere I get a combination of errors depending on how I tweak the configuration the most promising error I get is this one:

Caused by: javax.naming.NamingException: CWNEN1000E: A JNDI operation on a java:comp/env name cannot be completed because the current thread is not associated with a Java Enterprise Edition application component. This condition can occur when the JNDI client using the java:comp/env name does not occur on the thread of a server application request. Make sure that a Java EE application does not run JNDI operations on java:comp/env names within static code blocks or in threads created by that application. Such code does not necessarily run on the thread of a server application request and therefore is not supported by JNDI operations on java:comp/env names.

[ERROR   ] SRVE0315E: An exception occurred: java.lang.Throwable: javax.ejb.EJBException: CWNEN0030E: The server was unable to obtain an object instance for the java:comp/env/guest.GuestDao/em reference.  The exception message was: com.objectdb.o._PersistenceException: Failed to use JTA (TransactionManager is not found); nested exception is: java.lang.RuntimeException: com.objectdb.o._PersistenceException: Failed to use JTA (TransactionManager is not found)
  at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4900)
  at [internal classes]
Caused by: javax.ejb.EJBException: CWNEN0030E: The server was unable to obtain an object instance for the java:comp/env/guest.GuestDao/em reference.  The exception message was: com.objectdb.o._PersistenceException: Failed to use JTA (TransactionManager is not found); nested exception is: java.lang.RuntimeException: com.objectdb.o._PersistenceException: Failed to use JTA (TransactionManager is not found)
  at com.ibm.ejs.container.util.ExceptionUtil.EJBException(ExceptionUtil.java:461)
  at [internal classes]
  at guest.EJSLocalNSLGuestDao_93abe9c6.getAllGuests(EJSLocalNSLGuestDao_93abe9c6.java)
  at guest.GuestServlet.doGet(GuestServlet.java:24)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
  at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1287)
  at [internal classes]
  at com.ibm._jsp._index._jspService(_index.java:93)
  at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:101)
  ... 1 more
Caused by: java.lang.RuntimeException: com.objectdb.o._PersistenceException: Failed to use JTA (TransactionManager is not found)
  at com.ibm.ws.jpa.management.JPAPUnitInfo.getEntityManagerFactory(JPAPUnitInfo.java:955)
  ... 10 more
Caused by: com.objectdb.o._PersistenceException: Failed to use JTA (TransactionManager is not found)
  at com.objectdb.o._PersistenceException.b(_PersistenceException.java:45)
  at com.objectdb.jpa.Provider.createContainerEntityManagerFactory(Provider.java:123)
  at com.objectdb.jpa.Provider.createContainerEntityManagerFactory(Provider.java:32)
  at com.ibm.ws.jpa.management.JPAPUnitInfo.createEMFactory(JPAPUnitInfo.java:1070)
  ... 1 more
Caused by: com.objectdb.o.UserException: Failed to use JTA (TransactionManager is not found)
  at com.objectdb.o.MSG.d(MSG.java:75)
  at com.objectdb.jpa.EMF.initJta(EMF.java:175)
  at com.objectdb.jpa.EMF.init(EMF.java:97)
  at com.objectdb.jpa.Provider.newEMF(Provider.java:136)
  at com.objectdb.jpa.Provider.createContainerEntityManagerFactory(Provider.java:120)
  ... 3 more
Caused by: javax.naming.NamingException: CWNEN1000E: A JNDI operation on a java:comp/env name cannot be completed because the current thread is not associated with a Java Enterprise Edition application component. This condition can occur when the JNDI client using the java:comp/env name does not occur on the thread of a server application request. Make sure that a Java EE application does not run JNDI operations on java:comp/env names within static code blocks or in threads created by that application. Such code does not necessarily run on the thread of a server application request and therefore is not supported by JNDI operations on java:comp/env names.
  at com.ibm.ws.injectionengine.osgi.internal.naming.InjectionJavaColonHelper.getInjectionScopeData(InjectionJavaColonHelper.java:159)
  at [internal classes]
  at javax.naming.InitialContext.lookup(InitialContext.java:417)
  at com.objectdb.jpa.EMF.initJta(EMF.java:133)
  ... 6 more


I'm pretty much stuck at this point and am not sure where to go from here. Any pointers anyone could send my way would be helpful.

Thanks!

 

-Aaron O'Brien

Kansas City, MO

 

aobrien
aobrien's picture
Joined on 2016-08-09
User Post #1
#2
2016-08-09 15:06

It may be related to the location of the objectdb.jar file.

Please provide details about how you are using the ObjectDB jar file:

  • Are you using Maven to get the ObjectDB jar file?
  • If you are using a local ObjectDB jar file, is it objectdb.jar or objectdb-jee.jar?
  • Where is the JAR located? in the web application? On the server classpath?
  • Do you have other JPA implementations in the classpath?

If you have other error messages (from other configurations) please post them.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,584
#3
2016-08-09 20:24

Thanks for replying so quickly.

I pull the jar in through maven and bundle it in the war file.  It is objectdb.jar, I saw in the forums (http://www.objectdb.com/database/forum/673)  that the objected-jee.jar is the same as the objectdb.jar without the spa libraries in it and as of an older version (I can't find that post now) jpa was removed from ojbectdb completely.

As far as the location of the library I've tried it configured at the server level and including it in the war file.

When liberty starts up I do get this error:

[ERROR   ] CWWJP0015E: An error occurred in the com.objectdb.jpa.Provider persistence provider when it attempted to create the container entity manager factory for the TestDataSource persistence unit. The following error occurred: Failed to use JTA (TransactionManager is not found)

I attached the full stack trace.  I'm certain it's a configuration error, but I am stumped.

 

aobrien
aobrien's picture
Joined on 2016-08-09
User Post #2
#4
2016-08-10 15:16

After further examination of this issue it was found that this is not a configuration issue but a general problem with the integration Of ObjectDB with WebSphere Liberty.

As noted on Hibernate documentation: "WAS, unlike every other app server on the planet, does not allow direct access to the JTS TransactionManager. Instead, for common transaction - related tasks users must utilize a proprietary API known as ExtendedJTATransaction."

A new version of ObjectDB, 2.6.9, addresses this issue and should work with the WebSphere Liberty server. Thank you for your report.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,591
#5
2016-08-10 19:57

Thanks!  That is great to hear. I will try out the new version as soon as I can.

aobrien
aobrien's picture
Joined on 2016-08-09
User Post #3
#6
2016-08-11 13:21

Just a quick follow up.  2.6.9 did work for WebSphere Liberty.  It seems everyone has a deep dislike (hate?) for WebSphere, however Liberyt is really good - even if it does inhereit some of the traditional WAS's craziness.

Thanks for getting the fix out there so quickly!

 

-Aaron

aobrien
aobrien's picture
Joined on 2016-08-09
User Post #4
#7
2016-08-11 14:55

Thanks for the update. Liberty is great. It is just that accessing the JTA transaction manager is not standard (there is no standard yet, but there is a common way that works well for all the other application servers), but this should only affect developers of products such as JPA implementations that have to be integrated with their JTA.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #2,593

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel