on 02-04-2020 9:55 AM
Hi,
I'm trying to figure out what it takes to gain access to the SAP Java Connector on Cloud Foundry. According to this page in the documentation three things needs to be satisfied:
I've created a simple maven-project, where I've satisfied all these three conditions. The code for this project can be found here.
My main-method:
public static void main( String[] args )
{
try {
JCoDestination destination = JCoDestinationManager.getDestination("TEST");
System.out.println("Destination exists: " + destination.getDestinationName());
} catch (JCoException e) {
e.printStackTrace();
}
}<br>
I am using this dependency to gain access to the JCo classes (from this tutorial):
<dependency>
<groupId>com.sap.cloud</groupId>
<artifactId>neo-java-web-api</artifactId>
<version>[3.71.8,4.0.0)</version>
<scope>provided</scope>
</dependency>
This is my manifest file:
---
applications:
- name: jco-poc
buildpacks:
- sap_java_buildpack
services:
- jco_poc_connection_service
- jco_poc_destination_service
However when I push my application I get the following error:
ERR Error: A JNI error has occurred, please check your installation and try again
ERR (/bas/sapjvm/81_REL/src/8/jdk/src/share/bin/java.c 1628)
ERR Exception in thread "main" java.lang.NoClassDefFoundError: com/sap/conn/jco/JCoException
ERR at java.lang.Class.getDeclaredMethods0(Native Method)
ERR at java.lang.Class.privateGetDeclaredMethods(Class.java:2724)
ERR at java.lang.Class.privateGetMethodRecursive(Class.java:3071)
ERR at java.lang.Class.getMethod0(Class.java:3041)
ERR at java.lang.Class.getMethod(Class.java:1807)
ERR at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:564)
ERR at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:546)
ERR Caused by: java.lang.ClassNotFoundException: com.sap.conn.jco.JCoException
ERR at java.net.URLClassLoader.findClass(URLClassLoader.java:444)
ERR at java.lang.ClassLoader.loadClass(ClassLoader.java:480)
ERR at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:384)
ERR at java.lang.ClassLoader.loadClass(ClassLoader.java:413)
ERR ... 7 more
Can you please elaborate on what the requirements are for applications, if they wish to use the SAP Java Connector or point me to what I've done wrong in my example.
Am I using the right dependency?
Any help is much appreciated.
Hello Morten,
good that you added the additional comment, otherwise I would have pointed to the tutorial. In the restrictions section of Invoking ABAP Function Modules via RFC it is mentioned that you need to run your application on top of the TomEE or Tomcat container provided by the buildpack. Hence, you need to run it as a web application. What kind of application did you have in mind?
Best regards,
Markus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Markus,
Thank you for your answer. I suspected that was the case - as you write - that I need to deploy in the TomEE container for it to work.
I'm trying to build a proof-of-concept of an application consuming messages from SAP Enterprise Messaging and writing entries to SAP using BAPIs.
The reason for this architecture is that I want to minimise the effort required on the on-premise-system to get the solution up and running. This way I would only need two things on the "inside": A user with RFC access and a cloud connector pointing to my SCP subdomain.
I can still do that if my application is deployed as a web-app, so I will have to pursue that road.
User | Count |
---|---|
85 | |
11 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.