on 02-04-2008 3:21 PM
Hi, thanks in advanced for all your answers
I'm trying to test the connection from a servlet to sap. I have made a an index.jsp where I type the data to open the connection (client,user,password,language,server,system). I checked that I recieved correctly the data in the servlet.
I deploy the application without problem but I got the following error when using the method connect():
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 [C:\WINDOWS\system32\sapjcorfc.dll: Can't find dependent libraries]. java.library.path [C:\j2sdk1.4.2_11\jre\bin\server;C:\j2sdk1.4.2_11\jre\bin;C:\j2sdk1.4.2_11\bin;D:\usr\sap\DEV\DVEBMGS00\j2ee\os_libs;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Dell\SysMgt\oma\bin;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;D:\usr\sap\DEV\SYS\exe\uc\NTI386]
I have copied the necesary dlls (librfc32u and sapjcorfc) are into the folder c:\windows\system32\ in the server.
Also I have done the Jco's tutorial from help.sap.com I could read a table and show it on the console, so I don't know why I failed when using a servlet.
Hi,
Place the libraries in D:\usr\sap\DEV\DVEBMGS00\j2ee\os_libs, so the class loader of the JVM will find it (don't forget J2EE VM and J2SE VM are not the same, J2EE Vm runs in it own container and so it doesn't check what lies in the os system directories; ATTENTION SUN J2VM and SUN J2EE VM are not the same!!!). Vladimir Pavlov has written an great blog on how the Class Loader System of the SAP J2EE works, can't find it at the moment but search through the blogs and you will find it (Vladimir correct me if I'm wrong, and if I'm so sorry!).
But an other question, why work with native JCO access?
There are other possibilities (sorted in my preference):
- Use Web Services to call SAP Functions (my favourite!!!, create WS in ABAP backend, get the WSDL, and call it in JAVA)
- Use SAP Enterprise Connector (wraps native JCO calls to backend into (proxy classes for you, works only with NWDS)
- Use JCA (a hard way, you've to write a connector and so on, ... refer to SAP help and SUN Help, wou will find a mass of examples how to write such an connector)
Regards,
Daniel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your answers guys. All of your answers were helpful.
Looking around the forums in order to solve my problem, I found a topic where they mentioned that you had to reference the library in the EAR Project too. This is what I did:
Open developer studio:
1. Open the EAR project and look for the archive "application-j2ee-engine.xml".
2. In the "general" tab you will see a treebrowser "References", select it.
3. Then click the "Add" button and a list of the libraries.
4. A dialog box appears, and choose the middle button ("Select Library/Interface/Select Application")
5. Then a list of all the libraries sap.com appears.
6. Select " com.sap.mw.jco".
7. Save the changes.
8. Go to the WebModule and build it again, the same with the EAR project.
9. Deploy it and run it.
Hi,
You need to register this dll
To register a dll you can use the following
Syntax
regsvr32 </u> [/s] [/n] [/i[:cmdline]] dllname
Parameters
/u
Unregisters server.
/s
Specifies regsvr32 to run silently and to not display any message boxes.
/n
Specifies not to call DllRegisterServer. You must use this option with /i.
/i:cmdline
Calls DllInstall passing it an optional [cmdline]. When used with /u, it calls dll uninstall.
dllname
Specifies the name of the dll file that will be registered.
/?
Displays help at the command prompt.
Ex: regsvr32 sapjcorfc.dll
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.