$$和<生成>是什么在java stacktrace中意味着什么? [英] What does $$ and <generated> means in java stacktrace?

查看:143
本文介绍了$$和<生成>是什么在java stacktrace中意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很多时候我得到像这样的堆栈跟踪(请参阅箭头中的混淆行):

Many times I get stacktraces like this one (please see the arrow for the confusing line):

org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [PRIMARY]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
                at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:164)
                at org.springframework.orm.hibernate5.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:741)
                at org.springframework.orm.hibernate5.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:589)
                at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:761)
                at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730)
                at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:485)
                at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)
                at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
                at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
                at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
--------->      at com.panpwr.admin.services.detector.SimpleDetectorPersistenceService$$EnhancerBySpringCGLIB$$66303639.saveComplexRuleAndActionTemplates(<generated>)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
...
...
...

$$符号是什么,生成是什么意思?
com.panpwr.admin.services.detector.SimpleDetectorPersistenceService $$ EnhancerBySpringCGLIB $$ 66303639.saveComplexRuleAndActionTemplates(< generated>)

What Does the $$ sign, and what is the 'generated' means in this line? com.panpwr.admin.services.detector.SimpleDetectorPersistenceService$$EnhancerBySpringCGLIB$$66303639.saveComplexRuleAndActionTemplates(<generated>)

为什么它只说执行的方法而不是它中的行?

And why it only says the executed method but not the line in it?

推荐答案

$ 是类名中允许的字符。

$ is an allowed character in class names.

名称 SimpleDetectorPersistenceService $$ EnhancerBySpringCGLIB $$ 66303639 提示它是一个由Spring在运行时动态生成的类使用CGLIB的框架。

The name SimpleDetectorPersistenceService$$EnhancerBySpringCGLIB$$66303639 hints that it is a class which was dynamically generated at runtime by Spring framework using CGLIB.

他们使用 $$ 和一个数字偏移量来使这个类名唯一,以避免与现有的类。

They use $$ and a numeric offset to make this class name unique to avoid conflicts with existing classes.

stracktrace中的字符串(< generated>)也是由 CGLIB

当CGLIB在运行时创建一个类时,它使用< generated> ; 作为源文件名称的占位符。然后,堆栈跟踪只是打印此字符串而不是真实的源文件和行号。

The string (<generated>) in the stracktrace too was generated by CGLIB:
When CGLIB creates a class at runtime it uses <generated> as placeholder for the name of the source file. The stacktrace then simply prints this string instead of the real source file and line number.

这篇关于$$和&lt;生成&gt;是什么在java stacktrace中意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆