我已经遵循了这个指南的instructure:https://nosan.github.io/embedded-cassandra/4.0.7/#what-are-oss-supported-by-embedded-cassandra.我面临的问题,图书馆不支持m1 aarch64芯片.我使用:
- AmazonCorretto OpenJdk 1.8
- Maven builder manager
- MacBook Pro 14 M1芯片
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>CassandraTest</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.github.nosan</groupId>
<artifactId>embedded-cassandra</artifactId>
<version>4.0.7</version>
</dependency>
<dependency>
<groupId>com.datastax.oss</groupId>
<artifactId>java-driver-core</artifactId>
<version>4.15.0</version>
</dependency>
</dependencies>
</project>
字符串
Main.java
package org.example;
import com.datastax.oss.driver.api.core.CqlSession;
import com.github.nosan.embedded.cassandra.Cassandra;
import com.github.nosan.embedded.cassandra.CassandraBuilder;
import com.github.nosan.embedded.cassandra.Settings;
import com.github.nosan.embedded.cassandra.cql.CqlScript;
import java.net.InetSocketAddress;
public class Main {
public static void main(String[] args) {
Cassandra cassandra = new CassandraBuilder()
.addJvmOptions("-Xmx1024m", "-Xms1024m", "-Xss700k")
.build();
cassandra.start();
try {
Settings settings = cassandra.getSettings();
try (CqlSession session = CqlSession.builder()
.addContactPoint(new InetSocketAddress(settings.getAddress(), settings.getPort()))
.withLocalDatacenter("datacenter1")
.build()) {
CqlScript.ofClassPath("schema.cql").forEachStatement(session::execute);
}
}
finally {
cassandra.stop();
}
}
}
型
:
ERROR [main] 2023-11-16 15:23:50,249 NativeLibraryDarwin.java:64 - Failed to link the C library against JNA. Native methods will be unavailable.
java.lang.UnsatisfiedLinkError: /Users/pavlo/Library/Caches/JNA/temp/jna5079777972566874879.tmp: dlopen(/Users/pavlo/Library/Caches/JNA/temp/jna5079777972566874879.tmp, 0x0001): tried: '/Users/pavlo/Library/Caches/JNA/temp/jna5079777972566874879.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/pavlo/Library/Caches/JNA/temp/jna5079777972566874879.tmp' (no such file), '/Users/pavlo/Library/Caches/JNA/temp/jna5079777972566874879.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64'))
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817)
at java.lang.Runtime.load0(Runtime.java:782)
at java.lang.System.load(System.java:1100)
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1018)
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:988)
at com.sun.jna.Native.<clinit>(Native.java:195)
at com.sun.jna.NativeLibrary.<clinit>(NativeLibrary.java:87)
at org.apache.cassandra.utils.NativeLibraryDarwin.<clinit>(NativeLibraryDarwin.java:55)
at org.apache.cassandra.utils.NativeLibrary.<clinit>(NativeLibrary.java:98)
at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:258)
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:765)
at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:889)
型
1条答案
按热度按时间huwehgph1#
现在应该可以了,这是Apache Cassandra的限制。你可以试试embedded-cassandra 4.1.0