hibernate createClob() java.lang.reflect.InvocationTargetException错误处理

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010652906/article/details/72832345

通常这种错误出现在spring hibernate框架中,错误是因为jar包引用版本问题不同

比如spring-jdbc.jar 版本是4.0的,引用的commons-dbcp却是1.2的,这样更换相应的commons-dbcp1.4版本就不会出现

Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException

这样的错误。

java.lang.reflect.InvocationTargetException

04-09

今天遇到一个问题,一天了还没解决希望大虾帮助,在tomcat下是没有问题的,只在weblogic服务器下有这个问题rnrnjava.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor2945.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:325) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) at com.neusoft.framework.filter.ServletFilter.doFilter(ServletFilter.java:27) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74) at com.neusoft.framework.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:32) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3288) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3254) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2163) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2089) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1513) at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256) at weblogic.work.ExecuteThread.run(ExecuteThread.java:221) Caused by: java.lang.NoClassDefFoundError: com/sun/media/imageio/stream/RawImageInputStream at com.sun.media.imageioimpl.plugins.raw.RawImageReaderSpi.canDecodeInput(Unknown Source) at javax.imageio.ImageIO$CanDecodeInputFilter.filter(ImageIO.java:567) at javax.imageio.spi.FilterIterator.advance(ServiceRegistry.java:810) at javax.imageio.spi.FilterIterator.next(ServiceRegistry.java:828) at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:528) at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:513) at javax.imageio.ImageIO.read(ImageIO.java:1443) at javax.imageio.ImageIO.read(ImageIO.java:1352) at com.neusoft.util.PhotoBo.compressPic(PhotoBo.java:41) at com.neusoft.trace.portalmaintain.service.impl.NewsPhotoServiceImpl.addNewsPhoto(NewsPhotoServiceImpl.java:39) at com.neusoft.trace.portalmaintain.action.NewsPhotoAction.editSave(NewsPhotoAction.java:159) at com.neusoft.trace.portalmaintain.action.NewsPhotoAction.handle(NewsPhotoAction.java:54) at com.neusoft.framework.base.action.BaseAction.execute(BaseAction.java:94) ... 68 more

java.lang.reflect.InvocationTargetException???

12-07

[color=#FF0000]使用hibernate4+oracle11g学习hibernate一对多关联关系,程序运行出现异常。不知道怎么解决,请大家帮忙?[/color]rn[b]下面是hibernate配置文件:[/b]rn[code=java]rnrnrnrn rn oracle.jdbc.driver.OracleDriverrn jdbc:oracle:thin:@localhost:1521:orclrn adminrn adminrnrn truernrn rn rn rn[/code]rn[b]下面是hibernate工具类:[/b]rn[code=java]package com.pb.hibernate.util;rnrnimport org.hibernate.HibernateException;rnimport org.hibernate.SessionFactory;rnimport org.hibernate.cfg.Configuration;rnimport org.hibernate.service.ServiceRegistry;rnimport org.hibernate.service.ServiceRegistryBuilder;rnrnpublic class HibernateUtil rn private static SessionFactory sessionFactory;rn private static ServiceRegistry serviceRegistry;rn public static SessionFactory congigureSessionFactory() throws HibernateException rn Configuration configuration = new Configuration().configure();rn serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();rn sessionFactory = configuration.buildSessionFactory(serviceRegistry);rn return sessionFactory;rn rn[/code]rn[b]下面是Grade持久化类:[/b]rn[code=java]package com.pb.hibernate.po;rnrnimport java.util.HashSet;rnimport java.util.Set;rnrnpublic class Grade rn private int gid;rn private String gname;rn private String gdesc;rn private Set students = new HashSet();rnrn public int getGid() rn return gid;rn rnrn public void setGid(int gid) rn this.gid = gid;rn rnrn public String getGname() rn return gname;rn rnrn public void setGname(String gname) rn this.gname = gname;rn rnrn public String getGdesc() rn return gdesc;rn rnrn public void setGdesc(String gdesc) rn this.gdesc = gdesc;rn rnrn public Set getStudents() rn return students;rn rnrn public void setStudents(Set students) rn this.students = students;rn rnrnrn[/code]rn[b]下面是Grade映射文件:[/b]rn[code=java]rnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn[/code]rn[b]下面是Student持久化类:[/b]rn[code=java]package com.pb.hibernate.po;rnrnpublic class Student rn private int sid;rn private String sanme;rn private String sex;rnrn public int getSid() rn return sid;rn rnrn public void setSid(int sid) rn this.sid = sid;rn rnrn public String getSanme() rn return sanme;rn rnrn public void setSanme(String sanme) rn this.sanme = sanme;rn rnrn public String getSex() rn return sex;rn rnrn public void setSex(String sex) rn this.sex = sex;rn rnrn[/code]rn[b]下面是Student映射文件:[/b]rn[code=java]rnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn[/code]rn[b]测试类:[/b]rn[code=java]package com.pb.hibernate.po;rnrnimport org.hibernate.Session;rnimport org.hibernate.Transaction;rnrnimport com.pb.hibernate.util.HibernateUtil;rnrnpublic class Test rnrn public static void main(String[] args) rn save();rn rnrn public static void save() rn Grade g = new Grade();rn g.setGid(110701);rn g.setGname("计应一班");rn g.setGdesc("计算机专业应用一班");rnrn Student stu1 = new Student();rn stu1.setSid(11070101);rn stu1.setSanme("张华");rn stu1.setSex("男");rnrn Student stu2 = new Student();rn stu2.setSid(11070125);rn stu2.setSanme("刘萍");rn stu2.setSex("女");rnrn g.getStudents().add(stu1);rn g.getStudents().add(stu1);rnrn Session session = HibernateUtil.congigureSessionFactory().openSession();rn Transaction tr = session.beginTransaction();rn session.save(g);rn session.save(stu1);rn session.save(stu2);rn tr.commit();rn session.close();rn rn[/code]rn运行异常情况:rn2014-12-7 12:46:48 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreationrnINFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetExceptionrn2014-12-7 12:46:48 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateServicernINFO: HHH000399: Using default transaction strategy (direct JDBC transactions)rn2014-12-7 12:46:48 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory rnINFO: HHH000397: Using ASTQueryTranslatorFactoryrnException in thread "main" org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersisterrn at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:185)rn at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135)rn at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:385)rn at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1769)rn at com.pb.hibernate.util.HibernateUtil.congigureSessionFactory(HibernateUtil.java:15)rn at com.pb.hibernate.po.Test.save(Test.java:33)rn at com.pb.hibernate.po.Test.main(Test.java:11)rnCaused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]rn at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:138)rn at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:188)rn at org.hibernate.tuple.entity.EntityMetamodel.(EntityMetamodel.java:341)rn at org.hibernate.persister.entity.AbstractEntityPersister.(AbstractEntityPersister.java:507)rn at org.hibernate.persister.entity.SingleTableEntityPersister.(SingleTableEntityPersister.java:146)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:513)rn at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:163)rn ... 6 morernCaused by: java.lang.reflect.InvocationTargetExceptionrn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:513)rn at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:135)rn ... 15 morernCaused by: org.hibernate.PropertyNotFoundException: Could not find a getter for sname in class com.pb.hibernate.po.Studentrn at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:316)rn at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:310)rn at org.hibernate.mapping.Property.getGetter(Property.java:321)rn at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:436)rn at org.hibernate.tuple.entity.AbstractEntityTuplizer.(AbstractEntityTuplizer.java:200)rn at org.hibernate.tuple.entity.PojoEntityTuplizer.(PojoEntityTuplizer.java:82)rn ... 20 morern[color=#FF0000]大家帮忙看看是哪出错了?[/color]

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试

关闭