3
回答
J2Cache示例程序运行报错
终于搞明白,存储TCO原来是这样算的>>>   

运行runtest.bat报错,见下:

>java -Djava.ext.dirs=lib -cp bin net.oschina.j2cache.CacheTester

Exception in thread "main" java.lang.UnsupportedClassVersionError: net/oschina/j
2cache/CacheTester : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

windows平台,jdk的版本是1.7
>java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)

Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

不知道j2Cache对jdk的版本要求是哪一个,望各位大神抽点时间回复下,我这个是什么环境问题导致的,不甚感激!

举报
zhuganlai
发帖于1年前 3回/416阅
共有3个答案 最后回答: 1年前

引用来自“红薯”的评论

你可以现在源码编码,就不用管这个版本问题了:)

后来是在eclipse控制台,对测试类net.oschina.j2cache.CacheTester的运行情况。提示无法赋值。(我在配置文件里是配置了某个主redis,版本是3.0,集群部署。命令行是会根据key值自动切换redis主库地址的,下面是命令行的一个输出-> Redirected to slot [1953] located at 127.0.0.1:7002)
》set growth user001 100
net.oschina.j2cache.CacheException: redis.clients.jedis.exceptions.JedisMovedDataException: MOVED 14283 127.0.0.1:7002
at net.oschina.j2cache.redis.RedisCache.put(RedisCache.java:70)
at net.oschina.j2cache.CacheManager.set(CacheManager.java:137)
at net.oschina.j2cache.RedisCacheChannel.set(RedisCacheChannel.java:117)
at net.oschina.j2cache.CacheTester.main(CacheTester.java:38)
Caused by: redis.clients.jedis.exceptions.JedisMovedDataException: MOVED 14283 127.0.0.1:7002
at redis.clients.jedis.Protocol.processError(Protocol.java:109)
at redis.clients.jedis.Protocol.process(Protocol.java:151)
at redis.clients.jedis.Protocol.read(Protocol.java:205)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:297)
at redis.clients.jedis.Connection.getIntegerReply(Connection.java:222)
at redis.clients.jedis.BinaryJedis.hset(BinaryJedis.java:748)
at net.oschina.j2cache.redis.RedisCache.put(RedisCache.java:68)
 ... 3 more




综上所说,目前j2cache是不是不支持redis3集群配置的。
#########################################
# Redis connection configuration
#########################################


## connection
redis.host = 127.0.0.1
redis.port = 7000
redis.timeout = 2000
#redis.password = 
redis.database = db0


7000,7001,7002是主。7003---7005是从。

--- 共有 1 条评论 ---
红薯我们正在用 redis3 ,用的就是 j2cache 1年前 回复
顶部