Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.12.0版本在Windows下面启动会出现ClassCircularityError #234

Closed
kun1988 opened this issue Jan 18, 2021 · 10 comments
Closed

2.12.0版本在Windows下面启动会出现ClassCircularityError #234

kun1988 opened this issue Jan 18, 2021 · 10 comments
Assignees
Labels

Comments

@kun1988
Copy link

kun1988 commented Jan 18, 2021

我在用IDEA开发的时候,

  • MAC下面没有问题,WINDOWS下面出现了下面的java.lang.ClassCircularityError错误。
  • 而且WINDOWS下面用DEBUG运行也不会出现这个错误。

希望这个错误信息能帮到你们


启动时候的错误信息如下:

2021-01-18 11:54:57.603 SEVERE [main] TtlTransformer: Fail to transform class java/util/LinkedHashMap$LinkedKeySet, cause: java.lang.ClassCircularityError: java/util/LinkedHashMap$LinkedKeySet
java.lang.ClassCircularityError: java/util/LinkedHashMap$LinkedKeySet
	at java.util.LinkedHashMap.keySet(LinkedHashMap.java:533)
	at java.io.ExpiringCache.cleanup(ExpiringCache.java:115)
	at java.io.ExpiringCache.get(ExpiringCache.java:76)
	at java.io.WinNTFileSystem.canonicalize(WinNTFileSystem.java:406)
	at java.io.File.getCanonicalPath(File.java:618)
	at java.io.FilePermission$1.run(FilePermission.java:224)
	at java.io.FilePermission$1.run(FilePermission.java:212)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.io.FilePermission.init(FilePermission.java:212)
	at java.io.FilePermission.<init>(FilePermission.java:299)
	at sun.net.www.protocol.file.FileURLConnection.getPermission(FileURLConnection.java:228)
	at sun.net.www.protocol.jar.JarFileFactory.getPermission(JarFileFactory.java:166)
	at sun.net.www.protocol.jar.JarFileFactory.getCachedJarFile(JarFileFactory.java:136)
	at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:91)
	at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)
	at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:152)
	at java.net.URL.openStream(URL.java:1067)
	at java.lang.ClassLoader.getSystemResourceAsStream(ClassLoader.java:1324)
	at java.lang.Class.getResourceAsStream(Class.java:2221)
	at com.alibaba.ttl.threadpool.agent.internal.javassist.ClassClassPath.openClassfile(ClassClassPath.java:80)
	at com.alibaba.ttl.threadpool.agent.internal.javassist.ClassPoolTail.openClassfile(ClassPoolTail.java:334)
	at com.alibaba.ttl.threadpool.agent.internal.javassist.ClassPool.openClassfile(ClassPool.java:613)
	at com.alibaba.ttl.threadpool.agent.internal.javassist.CtClassType.getClassFile3(CtClassType.java:204)
	at com.alibaba.ttl.threadpool.agent.internal.javassist.CtClassType.getClassFile2(CtClassType.java:178)
	at com.alibaba.ttl.threadpool.agent.internal.javassist.CtClassType.getSuperclass(CtClassType.java:813)
	at com.alibaba.ttl.threadpool.agent.internal.javassist.CtClassType.subclassOf(CtClassType.java:804)
	at com.alibaba.ttl.threadpool.agent.internal.transformlet.impl.TtlExecutorTransformlet.doTransform(TtlExecutorTransformlet.java:73)
	at com.alibaba.ttl.threadpool.agent.TtlTransformer.transform(TtlTransformer.java:58)
	at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
	at java.util.LinkedHashMap.keySet(LinkedHashMap.java:533)
	at java.io.ExpiringCache.cleanup(ExpiringCache.java:115)
	at java.io.ExpiringCache.get(ExpiringCache.java:76)
	at java.io.WinNTFileSystem.canonicalize(WinNTFileSystem.java:406)
	at java.io.File.getCanonicalPath(File.java:618)
	at java.io.File.getCanonicalFile(File.java:643)
	at sun.misc.URLClassPath$FileLoader.<init>(URLClassPath.java:1357)
	at sun.misc.URLClassPath$3.run(URLClassPath.java:570)
	at sun.misc.URLClassPath$3.run(URLClassPath.java:565)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.misc.URLClassPath.getLoader(URLClassPath.java:564)
	at sun.misc.URLClassPath.getLoader(URLClassPath.java:529)
	at sun.misc.URLClassPath.getNextLoader(URLClassPath.java:494)
	at sun.misc.URLClassPath.getResource(URLClassPath.java:248)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:304)
	at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
2021-01-18 11:54:57.610 SEVERE [main] TtlTransformer: Fail to transform class java/util/LinkedHashMap$LinkedKeyIterator, cause: java.lang.ClassCircularityError: java/util/LinkedHashMap$LinkedKeyIterator
java.lang.ClassCircularityError: java/util/LinkedHashMap$LinkedKeyIterator
	at java.util.LinkedHashMap$LinkedKeySet.iterator(LinkedHashMap.java:543)
	at java.io.ExpiringCache.cleanup(ExpiringCache.java:119)
	at java.io.ExpiringCache.get(ExpiringCache.java:76)
	at java.io.WinNTFileSystem.canonicalize(WinNTFileSystem.java:406)
	at java.io.File.getCanonicalPath(File.java:618)
	at java.io.FilePermission$1.run(FilePermission.java:224)
	at java.io.FilePermission$1.run(FilePermission.java:212)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.io.FilePermission.init(FilePermission.java:212)
	at java.io.FilePermission.<init>(FilePermission.java:299)
	at sun.net.www.protocol.file.FileURLConnection.getPermission(FileURLConnection.java:228)
	at sun.net.www.protocol.jar.JarFileFactory.getPermission(JarFileFactory.java:166)
	at sun.net.www.protocol.jar.JarFileFactory.getCachedJarFile(JarFileFactory.java:136)
	at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:91)
	at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122)
	at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:152)
	at java.net.URL.openStream(URL.java:1067)
	at java.lang.ClassLoader.getSystemResourceAsStream(ClassLoader.java:1324)
	at java.lang.Class.getResourceAsStream(Class.java:2221)
	at com.alibaba.ttl.threadpool.agent.internal.javassist.ClassClassPath.openClassfile(ClassClassPath.java:80)
	at com.alibaba.ttl.threadpool.agent.internal.javassist.ClassPoolTail.openClassfile(ClassPoolTail.java:334)
	at com.alibaba.ttl.threadpool.agent.internal.javassist.ClassPool.openClassfile(ClassPool.java:613)
	at com.alibaba.ttl.threadpool.agent.internal.javassist.CtClassType.getClassFile3(CtClassType.java:204)
	at com.alibaba.ttl.threadpool.agent.internal.javassist.CtClassType.getClassFile2(CtClassType.java:178)
	at com.alibaba.ttl.threadpool.agent.internal.javassist.CtClassType.getSuperclass(CtClassType.java:813)
	at com.alibaba.ttl.threadpool.agent.internal.javassist.CtClassType.subclassOf(CtClassType.java:804)
	at com.alibaba.ttl.threadpool.agent.internal.transformlet.impl.TtlExecutorTransformlet.doTransform(TtlExecutorTransformlet.java:73)
	at com.alibaba.ttl.threadpool.agent.TtlTransformer.transform(TtlTransformer.java:58)
	at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
	at java.util.LinkedHashMap$LinkedKeySet.iterator(LinkedHashMap.java:543)
	at java.io.ExpiringCache.cleanup(ExpiringCache.java:119)
	at java.io.ExpiringCache.get(ExpiringCache.java:76)
	at java.io.WinNTFileSystem.canonicalize(WinNTFileSystem.java:406)
	at java.io.File.getCanonicalPath(File.java:618)
	at java.io.File.getCanonicalFile(File.java:643)
	at sun.misc.URLClassPath$FileLoader.<init>(URLClassPath.java:1357)
	at sun.misc.URLClassPath$3.run(URLClassPath.java:570)
	at sun.misc.URLClassPath$3.run(URLClassPath.java:565)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.misc.URLClassPath.getLoader(URLClassPath.java:564)
	at sun.misc.URLClassPath.getLoader(URLClassPath.java:529)
	at sun.misc.URLClassPath.getNextLoader(URLClassPath.java:494)
	at sun.misc.URLClassPath.getResource(URLClassPath.java:248)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:304)
	at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
@oldratlee
Copy link
Member

oldratlee commented Jan 18, 2021

@kun1988


我没有Windows环境,排查起来有些困难。:")

试着改了一下,见 分支expt/class-pool-class-path

你在这个分支上maven install构建出TTL Jar来试一下,
看看有没有关系能不能解决问题? 谢谢 ♥️ @kun1988

@oldratlee oldratlee added ❓question Further information is requested 🔰 first nice issue 👍 labels Jan 18, 2021
@kun1988
Copy link
Author

kun1988 commented Jan 19, 2021

@kun1988

  • 请尽量多给一些信息,比如

    • 你运行的JDK版本
    • 你的运行方式
    • 等等
  • 方便整理一下可以复现问题的极简Demo工程吗?

我没有Windows环境,排查起来有些困难。:")

试着改了一下,见 分支expt/class-pool-class-path

你在这个分支上maven install构建出TTL Jar来试一下,
看看有没有关系能不能解决问题? 谢谢 ♥️ @kun1988

你好 我构建出来了还是一样的问题。

一会儿我新建一个简单的工程看看能否重新,能重现我就提交出来你们看看。

我这边JDK版本jdk1.8.0_271

@kun1988
Copy link
Author

kun1988 commented Jan 19, 2021

新创建一个项目没有问题,可能是不是是跟其他哪个库有冲突

@oldratlee
Copy link
Member

oldratlee commented Jan 19, 2021

新创建一个项目没有问题,可能是不是是跟其他哪个库有冲突

可以从你的应用一步一步减下来,每一步确保问题还在。
直到一个可以还复现问题的极简版。 @kun1988

这样也可以发现是不是哪个库冲突引起的。

# 这就是问题排查的一般过程 😀❤️

@kun1988
Copy link
Author

kun1988 commented Jan 22, 2021

实在是不明白
现在windows下面没问题了
但MAC下又出现NoClassDefFoundError问题了:

Failed to instantiate SLF4J LoggerFactory
Reported exception:
java.lang.NoClassDefFoundError: Could not initialize class sun.util.calendar.ZoneInfoFile
	at java.base/sun.util.calendar.ZoneInfo.getTimeZone(ZoneInfo.java:588)
	at java.base/java.util.TimeZone.getTimeZone(TimeZone.java:577)
	at java.base/java.util.TimeZone.setDefaultZone(TimeZone.java:682)
	at java.base/java.util.TimeZone.getDefaultRef(TimeZone.java:653)
	at java.base/java.util.TimeZone.getDefault(TimeZone.java:642)
	at java.base/java.util.Calendar.defaultTimeZone(Calendar.java:1679)
	at java.base/java.util.Calendar.getInstance(Calendar.java:1660)
	at java.base/java.text.SimpleDateFormat.initializeCalendar(SimpleDateFormat.java:676)
	at java.base/java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:620)
	at java.base/java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:599)
	at ch.qos.logback.core.util.CachingDateFormatter.<init>(CachingDateFormatter.java:33)
	at ch.qos.logback.classic.layout.TTLLLayout.<init>(TTLLLayout.java:25)
	at ch.qos.logback.classic.BasicConfigurator.configure(BasicConfigurator.java:48)
	at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:164)
	at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
	at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
	at tech.ailu.luxury.core.starter.util.NetworkUtil.<clinit>(NetworkUtil.java:33)
	at tech.ailu.luxury.admin.LuxuryAdminApplication.testIp(LuxuryAdminApplication.java:23)
	at tech.ailu.luxury.admin.LuxuryAdminApplication.main(LuxuryAdminApplication.java:17)
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class sun.util.calendar.ZoneInfoFile
	at java.base/sun.util.calendar.ZoneInfo.getTimeZone(ZoneInfo.java:588)
	at java.base/java.util.TimeZone.getTimeZone(TimeZone.java:577)
	at java.base/java.util.TimeZone.setDefaultZone(TimeZone.java:682)
	at java.base/java.util.TimeZone.getDefaultRef(TimeZone.java:653)
	at java.base/java.util.TimeZone.getDefault(TimeZone.java:642)
	at java.base/java.util.Calendar.defaultTimeZone(Calendar.java:1679)
	at java.base/java.util.Calendar.getInstance(Calendar.java:1660)
	at java.base/java.text.SimpleDateFormat.initializeCalendar(SimpleDateFormat.java:676)
	at java.base/java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:620)
	at java.base/java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:599)
	at ch.qos.logback.core.util.CachingDateFormatter.<init>(CachingDateFormatter.java:33)
	at ch.qos.logback.classic.layout.TTLLLayout.<init>(TTLLLayout.java:25)
	at ch.qos.logback.classic.BasicConfigurator.configure(BasicConfigurator.java:48)
	at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:164)
	at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
	at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
	at tech.ailu.luxury.core.starter.util.NetworkUtil.<clinit>(NetworkUtil.java:33)
	at tech.ailu.luxury.admin.LuxuryAdminApplication.testIp(LuxuryAdminApplication.java:23)
	at tech.ailu.luxury.admin.LuxuryAdminApplication.main(LuxuryAdminApplication.java:17)

Process finished with exit code 1

@kun1988
Copy link
Author

kun1988 commented Jan 22, 2021

不好意思,这次MAC的问题找到了:

IDEA自动给我选择了JDK11的问题

@oldratlee
Copy link
Member

oldratlee commented Jan 23, 2021

Quotation from @kun1988

但MAC下又出现NoClassDefFoundError问题了:

不好意思,这次MAC的问题找到了:
IDEA自动给我选择了JDK11的问题

NoClassDefFoundError即类找不到的问题,与TTL无关。
java.lang.ClassCircularityError错误是2个问题。


考虑到

  • ClassCircularityError错误的原因 可能是由外部的环境引起
  • 大家广泛使用中没有出现这样的问题

这个 Issue 先 Close。
如有进一步的信息或发现,大家请随时 Reopen 这个Issue。 @kun1988

@simake2017
Copy link

我也出现了这个问题

@oldratlee
Copy link
Member

我也出现了这个问题

@simake2017

尽量给出全的环境的信息 和 复现方式。

必现吗?

@oldratlee
Copy link
Member

@kun1988 发布了v2.12.3
https://github.com/alibaba/transmittable-thread-local/releases/tag/v2.12.3

包含这个问题的修复;可以试试对于你的情况,是不是解决了? ❤️

@oldratlee oldratlee changed the title 2.12.0版本在Windows下面启动会出现问题 2.12.0版本在Windows下面启动会出现ClassCircularityError Dec 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants