cancel
Showing results for 
Search instead for 
Did you mean: 

SAP J2EE engine problem

Former Member
0 Kudos

Hi,

I have this strange problem which i am encountering with the deployed J2EE application on SAP J2EE engine. I developed an j2ee application and deployed on the local/server J2EE engine. It works fine.

But when I deploy another application on the J2ee engine and try to restart the engine, Then only the first application that was accessed works. The next application gives the following error message

java.lang.ExceptionInInitializerError: JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'

Native Library C:\WINDOWS\system32\sapjcorfc.dll already loaded in another classloader

at com.sap.mw.jco.JCO.(JCO.java:566)

at servlet.TerritoryLookup.processRequest(TerritoryLookup.java:46)

at servlet.TerritoryLookup.doGet(TerritoryLookup.java:30)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)

at com.inqmy.services.servlets_jsp.server.RunServlet.runSerlvet(RunServlet.java:163)

at com.inqmy.services.servlets_jsp.server.ServletsAndJspImpl.startServlet(ServletsAndJspImpl.java:683)

at com.inqmy.services.httpserver.server.RequestAnalizer.checkFilename(RequestAnalizer.java:454)

at com.inqmy.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:190)

at com.inqmy.services.httpserver.server.Response.handle(Response.java:160)

at com.inqmy.services.httpserver.server.HttpServerFrame.request(HttpServerFrame.java:772)

at com.inqmy.core.service.context.container.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:36)

at com.inqmy.core.cluster.impl3.ParserRunner.run(ParserRunner.java:30)

at com.inqmy.core.thread.impl2.SingleThread.run(SingleThread.java:118)

And if I refresh the page and access the link again it gives a different error message

java.lang.NoClassDefFoundError

at servlet.TerritoryLookup.processRequest(TerritoryLookup.java:46)

at servlet.TerritoryLookup.doGet(TerritoryLookup.java:30)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)

at com.inqmy.services.servlets_jsp.server.RunServlet.runSerlvet(RunServlet.java:163)

at com.inqmy.services.servlets_jsp.server.ServletsAndJspImpl.startServlet(ServletsAndJspImpl.java:683)

at com.inqmy.services.httpserver.server.RequestAnalizer.checkFilename(RequestAnalizer.java:454)

at com.inqmy.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:190)

at com.inqmy.services.httpserver.server.Response.handle(Response.java:160)

at com.inqmy.services.httpserver.server.HttpServerFrame.request(HttpServerFrame.java:772)

at com.inqmy.core.service.context.container.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:36)

at com.inqmy.core.cluster.impl3.ParserRunner.run(ParserRunner.java:30)

at com.inqmy.core.thread.impl2.SingleThread.run(SingleThread.java:118)

The first application that was accessed after restarting the J2EE engine works fine but the other doesnot work. Can anyone help me with this issue. Is this related to accessing common local variables or memory access problems on the J2EE engine?

Ravi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ravi,

yes, the JCO middleware (the dll) can only be loaded once on a machine. Did you add the sapjco.jar or the rfc.jar to the used jars of your application(s)? In this case, only the first app will succeed starting.

You have to add a reference the "com.sap.mw.jco" library in your applications and remove the JCO jar. This will work (the lib and the middleware is then shared by all apps).

The NoClassDefFoundError is a logical consequence of the first error, since a class, which throws an exception during init, isn't loaded and can't be found afterwards.

Hope that helps.

Regards

Stefan

Former Member
0 Kudos

Hi Steven,

Yes I have the sapjco.jar file in both of my applications.

When you said adding a reference for "com.sap.mw.jco", Do i need to import that in my java application and remove the sapjco.jar file from the application itself?

I removed the sapjco.jar file from the lib of one of the application and tried to dploy on the J2EE engine. It gave the following error message

Error can't load Servlet servlet.TerritoryLookup : java.lang.NoClassDefFoundError: com/sap/mw/jco/JCO$BasicRepository

Ravi

Former Member
0 Kudos

Hi Ravi,

remove all sapjco.jar(s) from all applications and do the following:

1. Add the library reference to the J2EE module project(s) of the apps by right-click onto the project node->Add/Remove Additional Libraries...->com.sap.mw.jco

2. Open the EAR(s) containing the module(s) and open application-j2ee-engine.xml by doubleclick. Click on "References", choose Add, "Select library/interface/service" and choose the JCO lib here also.

3. Rebuild the module(s) EJB archives and the EAR(s) and redeploy the EARS.

Hope that helps.

Regards

Stefan

Former Member
0 Kudos

Thanks Stefan it took care of the issue after playing for a while with the suggestions you gave.

I did the following things so that anyone in the future if they have the similar problems they can take of the issues similarly. This is for the stand-alone server only that i have performed.

1) While developing the J2EE application do not include the jar files into the WEB-INF/lib folder. But include the jar file for the Java build-path/libraries if you are using eclipse or websphere

2)Open folder SAPJ2EE Engine\alone\managers\library.txt

and include the following lines

library com.sap.mw.jco sapjco.jar

3) In the same folder open reference.txt and include the following

reference <Application-Name> library:com.sap.mw.jco

if it is Test.ear then <Application-name> will be Test

4) In the SAPJ2EEEngine\deploying open and edit application-j2ee-engine.xml file and include the following

<reference reference-type="hard">

<reference-target

provider-name="engine.sap.com"

target-type="library">com.sap.mw.jco</reference-target>

</reference>

some use the "engine.sap.com" and some have "sap.com".

And now start the J2ee Engine go.bat and open the deploy tool and deploy the applications.

This should take care of the problem, But I also did one more step to make sure that the refernces are made for the application

5)In the deploy tool window, after you have created an EAR or after you have loaded the Ear, Click on the Deploy menu and then select Libraries. In the Pop-up window select References and the click on 'add' and type in "com.sap.mw.jco". select ok and then connect to the local server and deploy the application.

Ravi

Former Member
0 Kudos

Any suggestions on how to install SAPjco on Visual age

for Java and Websphere ?

What I did so far, is copying librfc32.dll, sapjcorfc.dll

and sapjco.jar to c:\winnt\system32 as suggested.

This is the exception :


Root Error-1: JCO.classInitialize(): Could not load 
middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC' 
JCO.nativeInit(): Could not initialize dynamic link 
library sapjcorfc [no sapjcorfc in java.library.path]. 
java.library.path [C:Program FilesIBMVisualAge for 
Javaideprogram;.;C:IBM 
ConnectorsEncinabin;C:IBMCON~1
CICSBIN;C:HYPERIONESSBASEBIN;C:WINNTsystem32;C:WIN
NT;C:WINNTSystem32Wbem;%C:WINNT%system32;%C:WINNT%;%
%%C:WINNT%%%system32;%%%C:WINNT%%
%;INSTALLDIR;C:Program FilesIBMTrace 
Facility;C:Program FilesIBMPersonal 
Communications;C:ORANTbin;C:WINNTsystem32
;C:WINNTsystem32
Wbem;C:IMNnq_NT;C:SQLLIBBIN;C:SQLLIBFUNCTION;C:SQLL
IBSAMPLESREPL;C:SQLLIBHELP;C:j2sdk1.4.1_01
bin;C:apache-ant-1.6.1bin;C:Program FilesMicrosoft 
Visual StudioCommonToolsWinNT;C:Program 
FilesMicrosoft Visual StudioCommonMSDev98
Bin;C:Program FilesMicrosoft Visual 
StudioCommonTools;C:Program FilesMicrosoft Visual 
StudioVC98bin;C:Program FilesIBMVisualAge for 
Javaeabbin;C:Program FilesIBMVisualAge for 
Javaidetoolscom-ibm-psh-viewer;]

Former Member
0 Kudos

Hi Stefan,

Good Day.

I have been encountering the same problem for two weeks, but I couldn't solve it yet since I am using WebLogic not Websphere, and I'm not using SAPJ2EE server.

Running it under Windows, there is no problem. But in Linux, it does. Running the cIient for the first time, I always encounter,

Message Exception: javax.ejb.EJBException: EJB Exception: ; nested exception is:

java.lang.ExceptionInInitializerError: JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'

JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc [no sapjcorfc in java.library.path].

And on the second time,

java.lang.NoClassDefFoundError: com/sap/mw/jco/JCO; nested exception is: java.rmi.RemoteException: EJB Exception:

The configurations are right on LD_LIBRARY_PATH. I mean, the file "librfccm.so" and "libsapjcorfc.so" are being refered. Also the sapjco.jar is set to CLASSPATH.

I am using JCO in Linux and deploying it in WebLogic. I already put the

APP_CLASSPATH=$APP_HOME/sapjco.jar. I guarantee you that the configurations on path and classpath are correct. The file permissions of the files also correct.

Is there anything to do with "application.xml" of the j2ee? Do I need to add some tag there?

I tried also putting the "sapjco.jar" in WEB-INF\lib but it doesn't work.

The tag below obviously, wouldn't work for me.

<reference reference-type="hard">

<reference-target

provider-name="engine.sap.com"

target-type="library">com.sap.mw.jco

</reference-target>

</reference>

Hoping for your answer.

Thanks and Best Regards,

John

Former Member
0 Kudos

Hi,

Is a solution found for this issue of deploying SAP JCO in Weblogic server?

Answers (3)

Answers (3)

Former Member
0 Kudos

PLEASE DO HELP ME, ELSE I WILL BE KICKED OUT FROM MY JOB!!!

I have been encountering the same problem for two weeks, but I couldn't solve it yet since I am using WebLogic not Websphere, and I'm not using SAPJ2EE server.

Running it under Windows, there is no problem. But in Linux, it does. I always encounter,

java.lang.NoClassDefFoundError: com/sap/mw/jco/JCO; nested exception is: java.rmi.RemoteException: EJB Exception:

The configurations are right on LD_LIBRARY_PATH. I mean, the file "librfccm.so" and "libsapjcorfc.so" are being refered. Also the sapjco.jar is set to CLASSPATH.

I am using JCO in Linux and deploying it in WebLogic. I already put the

APP_CLASSPATH=$APP_HOME/sapjco.jar. I guarantee you that the configurations on path and classpath are correct.

Is there anything to do with "application.xml" of the j2ee? Do I need to add some tag there?

I tried also putting the "sapjco.jar" in WEB-INF\lib but it doesn't wiork.

The tag below obviously, wouldn't work for me.

<reference reference-type="hard">

<reference-target

provider-name="engine.sap.com"

target-type="library">com.sap.mw.jco

</reference-target>

</reference>

PLEASE DO HELP SINCE MY DAYS ARE NUMBERED!!!

Edited by: John Paz on Feb 12, 2008 1:05 PM

Barin
Product and Topic Expert
Product and Topic Expert
0 Kudos

"java.lang.NoClassDefFoundError: com/sap/mw/jco/JCO;" parameter means your class path to sapjcoX.jar is missing.

Explicity set class path till <folder path>/sapjcox.jar

if you set class path to the folder only then too you can get no class def found error.

prasad
Participant
0 Kudos

Hi,

We are also getting same error when we try to run the program even though we set the classpath for sapjco.jar.

Regards,

VSRK

Former Member
0 Kudos

Hi ravi,

You marked the question as answered, so please assign contributor points too. I did this time, but you can change them.

See: /people/mark.finnern/blog/2004/08/10/spread-the-love for directions.

Click on the yellow Star icon per reply. You can give:

1 - 10 pts (Which marks the question as answered)

2 - 6 pts (Very helpful)

Lots of 2 pts (Helpful)

It's just a little thank you for the responses.

Thanks!

Joan (and Mark Finnern)

Former Member
0 Kudos

Hi stefan,

One more question. I have made changes to the local server and it worked fine. Where on the Cluster level we will find the application-j2ee-engine.xml.

We are trying to deploy this on the cluster level but I am not sure where to exactly locate the xml file to make the changes that I have mentioned on the Point 4.

And thanks Mary for letting me know about the point system, I thought closing the topic will help others.

Thanks all

Ravi

Former Member
0 Kudos

Hi Ravi,

i'm not quite sure, what you mean with "changes on cluster level". The application-j2ee-engine.xml is one descriptor of each enterprise application (e.g EAR). So, if the application synchronization between the server nodes in the cluster works (what is should), all applications in all server nodes should be identical anyway.

Easy spoken, if you change something in the xml and deploy it to one server node in the cluster, the applications in the other server nodes of the same cluster should be updated automatically, nothing more to do about it.

Hope that helps.

Regards

Stefan

Former Member
0 Kudos

Interesting mixed solution

Just for future reference you can define all the libraries and/or references in the last phase of the deploy tool. It will modify the reference.txt and library.txt files accordingly.

Alternatively you can do all of it manually through the files as well and never add any references in the actual deploy tool. I have always preferred the direct modification of these two files as it is very simple, but the deploy tool does do the job o.k. as well and is the only option if you don't have system access to the server which runs the J2EE engine.

The only problems I've had with the deploy tool is when you need to do library to library references, it is easy on the file level but it might too be possible with the tool.