最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

【未解决】Mac本地测试远程服务器中taos报错:java.lang.UnsatisfiedLinkError no taos in java.library.path

Mac crifan 491浏览 0评论
折腾:
【未解决】集成TDEngine到智能电力的Java后台SprintBoot中
期间,mac中,去尝试给之前已跑通的SprintBoot的Java后端项目中,加上taos的支持。
结果运行
mvn spring-boot:run
报错:
2020-03-25 20:48:55,771 WARN  AbstractApplicationContext.java:558 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.UnsatisfiedLinkError: no taos in java.library.path
2020-03-25 20:48:55,777 INFO  DirectJDKLog.java:173 - Stopping service [Tomcat]
2020-03-25 20:48:55,948 ERROR SpringApplication.java:826 - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.UnsatisfiedLinkError: no taos in java.library.path
        at org.springframework.beans.factory.support.AbstractAutowireCapabl
之前巧了看到官网文档:
FAQ
https://github.com/taosdata/TDengine/blob/develop/documentation/webdocs/markdowndocs/Connector.md#faq
* java.lang.UnsatisfiedLinkError: no taos in java.library.path
Cause:The application program cannot find Library function taos
Answer:Copy C:\TDengine\driver\taos.dll to C:\Windows\System32\ on Windows and make a soft link through ln -s /usr/local/taos/driver/libtaos.so.x.x.x.x /usr/lib/libtaos.so on Linux.
解释的,虽然说很清楚。但是并没有解决我此处的问题:
我此处是:本地开发调试是Mac
而taos是在远程服务器CentOS中的,且的确存在libtaos.so
[[email protected] ~]# ll /usr/lib/libtaos.so*
lrwxrwxrwx 1 root root 21 2月  29 15:55 /usr/lib/libtaos.so -> /usr/lib/libtaos.so.1
lrwxrwxrwx 1 root root 41 2月  29 15:55 /usr/lib/libtaos.so.1 -> /usr/local/taos/driver/libtaos.so.1.6.5.5
此处是希望mac中springboot能连接CentOS中的taos
竟然还报错,表示找不到libtaos.so
所以很是奇怪啊,难道是:数据库必须在Mac本地??
Issues · taosdata/TDengine
demo中jdbc连接数据库 · Issue #1386 · taosdata/TDengine
windows failed to connect to server · Issue #1269 · taosdata/TDengine
去用客户端尝试连接一下,即用类似于:
taos -h x.x.x.x
看看本地Mac中能否连得上远端的taos
但是发现:Mac中没有client的taos可用。。。
而Mac中的client,官网
快速上手 | TDengine
https://www.taosdata.com/cn/getting-started/#快速上手
说的是“如果应用需要在Mac上运行,只能使用TDengine的RESTful接口连接服务器。”
此处Mac只能用REST的接口了?
但是如何使用?没有说
Getting Started | TDengine
“If you are using Mac, please use RESTful connector”
-》看懂了,应该是:
RESTful Connector
TODO:待会再去试试
从:
Downloaded from central: https://repo.maven.apache.org/maven2/com/taosdata/jdbc/taos-jdbcdriver/1.0.3/taos-jdbcdriver-1.0.3.jar (74 kB at 5.9 kB/s)
突然想到:
貌似Mac本地是下载了taos的jdbc的driver的
那或许是:让Mac本地能找到上面的jar包?也就可以了?
所以去试试
springboot java.lang.UnsatisfiedLinkError no in java.library.path
java.lang.UnsatisfiedLinkError: no XXX in java.library.path 问题解决_Java_坤哥的博客-CSDN博客
IDEA springboot启动报错java.lang.UnsatisfiedLinkError: no tcnative-1 in java.library.path_Java_O_OIIIII的博客-CSDN博客
java – Loading native library with Spring Boot – Stack Overflow
eclipse – java.lang.UnsatisfiedLinkError: no opencv_java2411 in java.library.path – Stack Overflow
java – why my SpringBoot application loadLibrary .so UnsatisfiedLinkError – Stack Overflow
java – loading library from java library path – Stack Overflow
不知道此处SprintBoot中如何,把System.setProperty加到哪里去?
spring boot – SpringBoot with no netty_transport_native_epoll_x86_64 in java.library.path error – Stack Overflow
springboot  java.library.path
java – External library folder for Spring Boot – Stack Overflow
The Executable Jar Format
说是:4. PropertiesLauncher Features
loader.path
Comma-separated Classpath, such as lib,${HOME}/app/lib. Earlier entries take precedence, like a regular -classpath on the javac command line.
还可以用环境变量:
  • loader.path
    • Manifest entry: Loader-Path
    • Environment variable: LOADER_PATH
maven – Append to java.library.path in `jvmArguments` some path – Stack Overflow
How to package native library in spring-boot jar using maven – Stack Overflow
maven – Set java.library.path for testing – Stack Overflow
如鹿渴慕溪水 >> How to add “java.library.path” system property to spring boot project?
试试:
mvn -Drun.jvmArguments="-Djava.library.path=./libs" spring-boot:run
不过先要找到此处taos的jar的位置
此处本地找不到之前下载到的
taos-jdbcdriver
即:taos-jdbcdriver-1.0.3.jar
后来看到
/Users/crifan/dev/dev_root/projects/xxx/src/server/xxx/xx/.factorypath
    <factorypathentry kind="VARJAR" id="M2_REPO/com/taosdata/jdbc/taos-jdbcdriver/1.0.3/taos-jdbcdriver-1.0.3.jar" enabled="true" runInBatchMode="false"/>
至少有taos
不过,此处看来是:
没有把taos-jdbcdriver-1.0.3.jar下载到本地
所以也没法去加java.library.path
那先直接去下载一个再说
https://repo.maven.apache.org/maven2/com/taosdata/jdbc/taos-jdbcdriver/1.0.3/taos-jdbcdriver-1.0.3.jar
先放这里
/Users/crifan/dev/dev_root/projects/xxx/src/server/xxx/xx/src/main/libs/taos-jdbcdriver-1.0.3.jar
后来感觉应该换到libs和src并列,所以是:
/Users/crifan/dev/dev_root/projects/xxx/src/server/xxx/xx/libs/taos-jdbcdriver-1.0.3.jar
即:
  master ●  pwd                               
/Users/crifan/dev/dev_root/projects/xxx/src/server/xxx/xx
 [email protected]  ~/dev/dev_root/projects/xxx/src/server/xxx/xx   master ●  ll libs
total 152
[email protected] 1 crifan  staff    72K  3 25 21:30 taos-jdbcdriver-1.0.3.jar
然后再去想办法加上参数,试试
mvn -Drun.jvmArguments="-Djava.library.path=./libs" spring-boot:run
问题依旧。
不清楚是参数对了,但是不起效果
还是此处路径 ./libs 不正确导致没用
又或者是:只能在服务器中才可以?
本来打算再去试试很多人提到的
spring-boot-maven-plugin
或:
maven-surefire-plugin
去加配置的
但是基本上确定,还是:
官网提到的,缺libtaos.so
看来只能是:需要在有libtaos.so的CentOS的服务器中去运行此sprintboot才可以。
所以就先去:
【未解决】把Mac本地的SpringBoot的Java服务部署上传到远程服务器CentOS中

转载请注明:在路上 » 【未解决】Mac本地测试远程服务器中taos报错:java.lang.UnsatisfiedLinkError no taos in java.library.path

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
86 queries in 0.097 seconds, using 20.72MB memory