Skip to Content
avatar image
Former Member

Web Programming JCo

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Feb 05, 2008 at 06:50 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 05, 2008 at 08:23 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      hi i am currently working on mb5b and mm60 transactions. i need to bring the list through jsp.. can u give me the source code for jsp and jco..

      thanks in Advance