在进行Hibernate迁移时,遇到bean lib jar问题。如你所见,我附上了与bean复制器相关的所有罐子。
在遇到问题的运行时:
11:56:33,354 ERROR [BeanPopulator]
propertyName=handler
readerMethod=public javassist.util.proxy.MethodHandler com.v4common.shared.beans.usermanagement.User_$$_jvstb35_4c.getHandler()
setterMethod=public void com.v4common.shared.beans.usermanagement.User_$$_jvstb35_4c.setHandler(javassist.util.proxy.MethodHandler)
fromBean=com.v4common.shared.beans.usermanagement.User@1
toBean=com.v4common.shared.beans.usermanagement.User_$$_jvstb35_4c@0
net.sf.beanlib.BeanlibException: java.lang.NoSuchMethodException: org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.<init>()
at net.sf.beanlib.provider.replicator.BeanReplicator.replicateBean(BeanReplicator.java:169)
at net.sf.beanlib.hibernate3.Hibernate3JavaBeanReplicator.replicateBean(Hibernate3JavaBeanReplicator.java:71)
at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicateByBeanReplicatable(ReplicatorTemplate.java:125)
at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicate(ReplicatorTemplate.java:120)
at net.sf.beanlib.provider.BeanTransformer.transform(BeanTransformer.java:224)
at net.sf.beanlib.provider.BeanPopulator.doit(BeanPopulator.java:201)
at net.sf.beanlib.provider.BeanPopulator.processSetterMethod(BeanPopulator.java:172)
at net.sf.beanlib.provider.BeanPopulator.populate(BeanPopulator.java:270)
at net.sf.beanlib.provider.replicator.ReplicatorTemplate.populateBean(ReplicatorTemplate.java:174)
at net.sf.beanlib.provider.replicator.BeanReplicator.replicateBean(BeanReplicator.java:173)
at net.sf.beanlib.hibernate3.Hibernate3JavaBeanReplicator.replicateBean(Hibernate3JavaBeanReplicator.java:71)
at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicateByBeanReplicatable(ReplicatorTemplate.java:125)
at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicate(ReplicatorTemplate.java:120)
at net.sf.beanlib.provider.BeanTransformer.transform(BeanTransformer.java:224)
at net.sf.beanlib.provider.BeanPopulator.doit(BeanPopulator.java:201)
at net.sf.beanlib.provider.BeanPopulator.processSetterMethod(BeanPopulator.java:172)
at net.sf.beanlib.provider.BeanPopulator.populate(BeanPopulator.java:270)
at net.sf.beanlib.provider.replicator.ReplicatorTemplate.populateBean(ReplicatorTemplate.java:174)
at net.sf.beanlib.provider.replicator.BeanReplicator.replicateBean(BeanReplicator.java:173)
at net.sf.beanlib.hibernate3.Hibernate3JavaBeanReplicator.replicateBean(Hibernate3JavaBeanReplicator.java:71)
at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicateByBeanReplicatable(ReplicatorTemplate.java:125)
at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicate(ReplicatorTemplate.java:120)
at net.sf.beanlib.provider.BeanTransformer.transform(BeanTransformer.java:224)
at net.sf.beanlib.provider.BeanPopulator.doit(BeanPopulator.java:201)
at net.sf.beanlib.provider.BeanPopulator.processSetterMethod(BeanPopulator.java:172)
at net.sf.beanlib.provider.BeanPopulator.populate(BeanPopulator.java:270)
at net.sf.beanlib.provider.replicator.ReplicatorTemplate.populateBean(ReplicatorTemplate.java:174)
at net.sf.beanlib.provider.replicator.BeanReplicator.replicateBean(BeanReplicator.java:173)
at net.sf.beanlib.hibernate3.Hibernate3JavaBeanReplicator.replicateBean(Hibernate3JavaBeanReplicator.java:71)
at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicateByBeanReplicatable(ReplicatorTemplate.java:125)
at net.sf.beanlib.provider.replicator.ReplicatorTemplate.replicate(ReplicatorTemplate.java:120)
at net.sf.beanlib.provider.BeanTransformer.transform(BeanTransformer.java:224)
at net.sf.beanlib.hibernate.HibernateBeanReplicator.copy(HibernateBeanReplicator.java:133)
at net.sf.beanlib.hibernate.HibernateBeanReplicator.copy(HibernateBeanReplicator.java:111)
at com.v4common.shared.util.other.ConversionUtil.copyProperties(ConversionUtil.java:364)
at com.nextenders.dao.UserDetailsDao.fetchAllPostForUser(UserDetailsDao.java:3368)
at com.nextenders.dao.UserDetailsDao.processsRequest(UserDetailsDao.java:119)
at com.nextenders.common.DaoReceiver.processRequest(DaoReceiver.java:86)
at com.nextenders.common.DaoHandler.handleRequest(DaoHandler.java:12)
at com.nextenders.facadeimplementation.facade.UserFacade.fetchAllPostForUser(UserFacade.java:1526)
at com.nextenders.facadeimplementation.facade.UserFacade.getDataOnLogIn(UserFacade.java:2671)
at com.nextenders.facadeimplementation.facade.UserFacade.doLogin(UserFacade.java:2356)
at com.nextenders.server.LoginServlet.doPost(LoginServlet.java:304)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1097)
at com.nextenders.server.ExceptionHandler.doFilter(ExceptionHandler.java:28)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
at com.nextenders.server.BaseFilter.doFilter(BaseFilter.java:79)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:66)
at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
你可以在这里看到我的课程。
有关此的任何线索?
感谢您的帮助。
答案 0 :(得分:2)
我有一个相同的错误,我通过gettign一些源jar并应用一些更改来解决它。 erorr的根本原因是,通过不识别Javassist类,Beanlib尝试克隆包含处理程序方法的Javassist类。通常,它必须克隆祖先类。这就是UnEnhance类所做的 - 找到非Javassist的祖先。为了做到这一点,它需要能够告诉Javassist
创建了哪些类我的起点与你的起点并不完全相同,因为我们使用的是Beanlib的3.3.0beta20b版本,而你使用的是5.0.1beta。但是,我得到的堆栈跟踪与您显示的堆栈跟踪相同,因此解决方案也可能适用于您的情况。和你一样,我们使用的是Javassist版本3.18.1-GA
在BeanlibHibernate库中,类UnEnancer负责识别源自Javassist的类。
旧版Javassist生成的类名包含字符串“_ $$ javassist ”。
较新版本3.18.1-GA生成包含字符串“_ $$ _ jvst”的类。我可以在上面的示例中看到相同的字符串。
一个非常旧的版本生成以“”org.javassist.tmp“开头的类名”
方法isJavassistEnhanced使用OR条件来查找“旧”和“非常旧”的标准。这需要修改,因此当条件查找“新”字符串时,OR条件允许第三种情况。
在我更改它之前,这是UnEnhance.java中的代码:
private static final String JAVASSIST_STARTWITH = "org.javassist.tmp.";
private static final String JAVASSIST_INDEXOF = "_$$_javassist_";
/**
* Returns true if the given class is found to be a javassist enhanced class;
* false otherwise.
*/
private static boolean isJavassistEnhanced(Class c) {
String className = c.getName();
// pattern found in javassist 3.4 and 3.6's ProxyFactory
return className.startsWith(JAVASSIST_STARTWITH)
|| className.indexOf(JAVASSIST_INDEXOF) != -1
;
}
这是在我改变它之后:
private static final String JAVASSIST_STARTWITH = "org.javassist.tmp.";
private static final String JAVASSIST_INDEXOF = "_$$_javassist_";
private static final String HB4_JAVASSIST = "_$$_jvst" ;
/**
* Returns true if the given class is found to be a javassist enhanced class;
* false otherwise.
*/
private static boolean isJavassistEnhanced(Class c) {
String className = c.getName();
// pattern found in javassist 3.4 and 3.6's ProxyFactory
boolean isEnhanced =
className.startsWith(JAVASSIST_STARTWITH)
|| className.indexOf(JAVASSIST_INDEXOF) != -1
|| className.in`enter code here`dexOf(HB4_JAVASSIST) != -1 // 3.18.1-GA
;
return isEnhanced ;
}
我找到了以下来源:
有了这个改变,我可以把它当作Hibernate 4.2.6和GWT 2.5.0那样。我无法使DTO和newIdentifier功能正常工作,但显然Hibernate4GWT不需要这些功能