Skip to Content

how to create a JSP connection to SAP through Jco?

I want to create a JSP and fetch data from SAP. I followed the official tutorial of sJco 3.0 and stuck in the first step. I'm really confused. Can some give a hint ? below is the offical sample code.

public class StepByStepClient
Properties connectProperties = new Properties();
"homo faber");
CITY, "3");
T, "10");
static void createDestinationDataFile(String destinationName,
Properties connectProperties)
File destCfg = new File(destinationName+".jcoDestination");
FileOutputStream fos = new FileOutputStream(destCfg,
false);, "for tests only !");
catch (Exception e)
throw new RuntimeException("Unable to create the
destination files", e);
public static void step1Connect() throws JCoException
	  JCoDestination destination=JCoDestinationManager.getDestination(DESTINATION_NAME1);

1.I don't understand what's the use of createDestinationDataFile method? It just create a file isn't it? all the property already set up in DestinationProvider, then why need a file?

2.I copy the sample code to a project and it worked. But when I triy to create a JSP and call it error happened. I doubt maybe the configuration file is the reason. Anyone has same error before? The error is below.

08:49:20,035 ERROR [stderr] (default task-2) java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path
08:49:20,036 ERROR [stderr] (default task-2) 	at java.lang.ClassLoader.loadLibrary(Unknown Source)
08:49:20,049 ERROR [stderr] (default task-2) 	at
08:49:20,049 ERROR [stderr] (default task-2) 	at io.undertow.server.handlers.PredicateHandler.handleRequest(
08:49:20,186 ERROR [stderr] (default task-2) 	at
08:49:20,187 ERROR [stderr] (default task-2) 	at
08:49:20,229 ERROR [io.undertow.request] (default task-2) UT005023: Exception handling request to /TestWebsite/1.jsp: javax.servlet.ServletException: java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path
	at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(
	at org.apache.jasper.runtime.PageContextImpl.handlePageException(
	at org.apache.jsp._1_jsp._jspService(
	at org.apache.jasper.runtime.HttpJspBase.service(
	at javax.servlet.http.HttpServlet.service(
	at org.apache.jasper.servlet.JspServletWrapper.service(
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(
	at org.apache.jasper.servlet.JspServlet.service(
	at javax.servlet.http.HttpServlet.service(
	at io.undertow.servlet.handlers.ServletHandler.handleRequest(
	at io.undertow.jsp.JspFileHandler.handleRequest(
	at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(
Caused by: java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at SCOfetch.JCOtest.step4QueryTable(
	at org.apache.jsp._1_jsp._jspService(
	... 45 more
Add a comment
10|10000 characters needed characters exceeded

  • ricky luo, please follow up on your open question.

    • comment answers or your question if there are still open issues.
    • otherwise mark an answer as accepted if it helped you solve your problem
    • or post an answer of yourself and accept it if you found another useful solution yourself
    • or redirect your question to another question that is related and was useful to solve your problem
    • in the end, close your question

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on May 14 at 05:47 AM

    In wildfly 11 server. I create a module for the dll and jar in modules folder and in jboss-deployment-structure.xml point to it and problem solved.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 10 at 04:49 AM

    The sapjco3.dll seems to be missing or is the wrong version.

    Do you have the sapjco3.dll library installed and did you make sure that JVM and sapjco3.dll are for the same platform.

    Go to Start>Control Panel>Java to check JVM version.

    Otherwise try these links for more information:

    1. JCO 3 problems with Library - UnsatisfiedLinkError [SOLVED] - Toolbox for IT Groups


    3. Error: sapJco3 load the Java library

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.