Author Topic: ODWEK Tomcat Issue  (Read 3477 times)

mshives

  • Newbie
  • *
  • Posts: 2
    • View Profile
ODWEK Tomcat Issue
« on: January 13, 2016, 01:40:25 PM »
We have a developed a web service to access CMOD. We have deployed on a Windows 2008 Server running Tomcat 7.0.30. ODWEK version 8.5.0.6. The service works for the first five/six sessions. After the fifth/sixth session, a call to ODServer.initialize() causes the Tomcat to crash.

The Java class that handles sessions has been designed thread safe using synchronize. However, we are not using pooling.

Has anyone had any success using ODWEK with Tomcat? if so have you had similar issues we are having? Is ODWEK not compatible with Tomcat?

Any advice would be greatly appreciated.

-mshives

Alessandro Perucchi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1002
    • View Profile
Re: ODWEK Tomcat Issue
« Reply #1 on: January 14, 2016, 04:48:58 AM »
Hello mshives,

you are on old versions from what I see :-) At least from ODWEK 8.5.0.6, since it will be out of support end of April 2016. So for new development my advice would be to go directly with ODWEK V9 or even better V9.5. (except if you have some MUST where you need to keep the version 8.5 for some very old CMOD server which are not anymore supported by ODWEK V9+)

Now back to your question. ODWEK doesn't care about JBOSS, TomCat, WAS, WebLogic, etc... it works with everything.
Now the question is more how do you create your sessions? Can you give us an idea what are doing exactly on that topic?

For example, for each session, do you do something like that?

Code: [Select]
ODConfig odc = new ODConfig();
ODServer ods = new ODServer(odc);
ods.setServerName("localhost");
ods.setUserId("admin");
ods.setPassword("password");
ods.initialize("");
ods.logon();
// do something in CMOD
ods.logoff();
ods.terminate();

If you do an ODServer.initialize(...), then you MUST do a ODServer.terminate(), otherwise you'll have a leak of memory because the native libraries that are used behind won't be freed. And since ODWEK use JNI, if you don't have enough memory for the native libraries... then it can simply crash.

Here is a nice document that can help you in developping with ODWEK:

This is the RedBook for the ODWEK development: http://www.redbooks.ibm.com/abstracts/sg247646.html
This is a really technical document for AFP, but he has a section about JNI and Java memory handling with ODWEK, a must read: http://www-01.ibm.com/support/docview.wss?uid=tss1wp101247
Here is another document for the servlet connections, connection pooling, etc... exactly what you are doing (document is a bit old, but still valid) www-01.ibm.com/support/docview.wss?uid=tss1wp101203

I hope that helps you a little bit.

Alessandro Perucchi

#Install #Migrations #Conversion #Educate #Repair #Upgrade #Migrate #Enhance #Optimize #AIX #Linux #Multiplatforms #DB2 #Windows #Oracle #TSM #Tivoli #Performance #Audits #Customizing #Availability #HA #DR #JavaApi #ContentNavigator #ICN #WEBi #ODWEK #Services #PDF #AFP #XML

Andreas Baaserud Hauge

  • Jr. Member
  • **
  • Posts: 48
    • View Profile
Re: ODWEK Tomcat Issue
« Reply #2 on: March 01, 2023, 02:12:07 AM »
I'd just like to say this solution helped a ton, thanks Alessandro. Was missing to terminate the initialization one or two places so ended up in memory leak.
For later troubleshooting, was using tools like jconsole, visualvm, jprofiler to see that our application was performing Garbage Collection - it was, but still saw memory was being allocated. Appeared to be CMOD native application allocating the memory


If you do an ODServer.initialize(...), then you MUST do a ODServer.terminate(), otherwise you'll have a leak of memory because the native libraries that are used behind won't be freed. And since ODWEK use JNI, if you don't have enough memory for the native libraries... then it can simply crash.

ABH