经过反编译SAP的JCO3的java代码,发现:JCO3在FileDestinationsDataProvider类中强制使用当前工作路径为jcoDestination的父路径,要想任意指定路径,一个较快的解决办法就是替换掉com.sap.conn.jco.rt.FileDestinationsDataProvider.java这个类,一下是此类的加强版的java代码:
package com.sap.conn.jco.rt;
import com.sap.conn.jco.ext.*;
import com.sap.conn.jco.util.FastStringBuffer;
import java.io.*;
import java.util.Properties;
public final class FileDestinationsDataProvider implements DestinationDataProvider, ServerDataProvider {
private static String DESTINATION_FILES_SUFFIX = ".jcoDestination";
private static String SERVER_CFG_FILES_SUFFIX = ".jcoServer";
private File destinationDirectory;
FileDestinationsDataProvider(String directory) throws FileNotFoundException {
destinationDirectory = null;
/*
File destinationDirFile = null;
FastStringBuffer error = new FastStringBuffer(128);
destinationDirFile = new File(directory);
if (checkFile(destinationDirFile, error)) {
destinationDirectory = destinationDirFile;
} else {
throw new FileNotFoundException(error.toString());
}
*/
}
private boolean checkFile(File file, FastStringBuffer error) {
if (file.exists()) {
if (file.canRead()) {
return true;
}
if (error != null) {
error.append("File ");
error.append(file.getAbsolutePath());
error.append(" exists, but cannot be read. ");
}
} else
if (error != null) {
error.append("File ");
error.append(file.getAbsolutePath());
error.append(" does not exist. ");
}
return false;
}
public Properties getDestinationProperties(String destinationName) {
return loadProperties(destinationName, DESTINATION_FILES_SUFFIX);
}
public Properties getServerProperties(String serverName) {
return loadProperties(serverName, SERVER_CFG_FILES_SUFFIX);
}
private Properties loadProperties(String destinationName, String suffix) {
File destinationFile = new File(destinationDirectory,
(new StringBuilder()).append(destinationName).append(suffix).toString());
FastStringBuffer buf = new FastStringBuffer(256);
if (!checkFile(destinationFile, buf)) {
throw new RuntimeException(buf.toString());
}
FileInputStream fis = null;
Properties properties = new Properties();
try {
Properties properties1;
try {
properties.load(fis = new FileInputStream(destinationFile));
properties1 = properties;
} catch (IOException ex) {
throw new RuntimeException("Unable to load the destination properties", ex);
}
return properties1;
} finally {
if (fis != null) {
try {
fis.close();
} catch (Exception e) {}
}
}
}
public boolean supportsEvents() {
return false;
}
public void setDestinationDataEventListener(DestinationDataEventListener destinationdataeventlistener) {
}
public void setServerDataEventListener(ServerDataEventListener serverdataeventlistener) {
}
}
附件里有我打包好的经过修改的JCO3的类库文件!
分享到:
相关推荐
是因为没有找到 sapjco3.dll这个库的路径,安装了JDK的环境中,这个库默认的位置不是在system32下,而是在 JDK/JRE/BIN下面。 sapjco3 开发环境设置 1.开发中需要将sapjco3.jar加入到项目的build path中 2.或者将其...
1.sapjco3.dll 需要与 sapjco3.jar 在同一目录 2.设置系统环境变量,将sapjco3所在目录加入系统环境变量 例如: 新建环境变量 变量名: JAVA_SAPJCO 变量值: E:\sapjco3\sapjco3-win32 将新建的 JAVA_SAPJCO 环境...
windows环境设置1.sapjco3.dll需要与sapjco3.jar在同一目录2.设置系统环境变量,将sapjco3所在目录加入系统环境变量例如:新建环境变量变量名:JAVA_SAPJCO变量值:E:\ sapjco3 \ sapjco3- win32将新建的JAVA_SAP...
windows 环境设置 1.sapjco3.dll 需要与 sapjco3.jar 在同一目录 2.设置系统环境变量,将sapjco3所在目录加入系统环境变量 例如: 新建环境变量 变量名: JAVA_SAPJCO 变量值: E:\sapjco3\sapjco3-win32 将新建的 JAVA_...
3、win环境,将sapjco3.dll文件放入C:\Windows\System32路径下即可。 4、linux环境,则将libsapjco3.so文件放入路径:/usr/local/tools/jco3下(可改) 4.1、把目录/usr/local/tools/jco3添加到LD_LIBRARY_PATH环境...
SAP JCo3在LINUX操作系统的安装、直接连接、连接池连接
最新Windows_64和Linux_64下配置JCo3环境,还有配置说明和测试代码 1)将libsapjco3.so、sapjco3.jar扔到指定目录; 3、把JCo3安装目录添加到LD_LIBRARY_PATH环境变量; 4、把 安装目录sapjco3.jar添加到CLASSPATH环境...
sapjco30 SAP官网2017/7/18更新版本,Windows64...因项目开发SAP RFC接口,使用sapjco3.dll/sapjco3.jar,而网上下载多个版本的sapjco3.dll都提示版本等级太低,最后从SAP官网上下载了2017/7/18更新的文件,使用后OK。
1.将sapjco3.jar 文件复制至 $JAVA_HOME/lib/sapjco3.jar 2.将 libsapjco3.so 文件复制至 $JAVA_HOME/jre/lib/amd64/server/libsapjco3.so 3.设置环境变量 CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools....
sapjco3.jar、sapjco3.dll有些技术不可用,下了三个版本才可以用
下载后运行该命令,-Dfile=路径可以修改成自己的路径 mvn install:install-file -DgroupId=org.hibersap -DartifactId=sapjco3 -Dversion=3.0 -Dpackaging=jar -Dfile=E:/sapjco3/sapjco3-win32/sapjco3.jar
How to Migrate from SAP JCo2 to SAP JCo3 and use SAP JCo3 in a Multi-Threaded Environment
自己找了好久的资源,这里提供windows64位和linux64服务器版,sapjco版本为3.0.9,java连接sap系统需要通过sap javaconnect来连接,对于sapjco3.jar系列文件有32位与64位之分。 1)将相对应位数的sapjco3.dll文件拷贝...
sapjco3下载,解决tomcat启动报错:Native library sapjco3 is too old. Found library C:\Program Files\Java\jdk1.8.0_101\bin\sapjco3.dll has version "720.38", but required is at least version "720.117".
sapjco3.dll文件(版本721.619),放在C:\Windows\System32路径下。
sapjco3-3.0.jar下载
java 连接SAP相关的环境工具包。 sapjco3.dll sapjco3.jar
sapjco-sapjco3部署在linux windows所需文件,包含jar包,sapjco3.dll,sapjco3.so