exce打不开ption in thread "main" org.hibernate.exce打不开ption.GenericJDBCexce打不开ption: Could not open co

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
您的访问请求被拒绝 403 Forbidden - ITeye技术社区
您的访问请求被拒绝
亲爱的会员,您的IP地址所在网段被ITeye拒绝服务,这可能是以下两种情况导致:
一、您所在的网段内有网络爬虫大量抓取ITeye网页,为保证其他人流畅的访问ITeye,该网段被ITeye拒绝
二、您通过某个代理服务器访问ITeye网站,该代理服务器被网络爬虫利用,大量抓取ITeye网页
请您点击按钮解除封锁&Exception in thread &Timer-1& java.lang.UnsatisfiedLinkError_百度知道
Exception in thread &Timer-1& java.lang.UnsatisfiedLinkError
com.util.loadLibrary(Unknown Source)
at com:11)
at iyaya.&lt.java.util.publish(run:107)
at net.TimerThread.InternetETimer-1&quot.run.library.util.path
at java.lang.mainLoop(Unknown Source)
at java:60)
at com:184)
at com.lang.java.loadJacobLibrary(LibraryLclinit&gt.loadLibrary(Unknown Source)
at java.javaException in thread &quot.loadLibrary0(Unknown Source)
at java.java:45)
at com.run(TimeTask:54)
at com.(JSUtil..TimeT(JacobObject.jacob.TimerThread.lang.java.JSUtil.16-M1-x86 in java.LibraryLoader:17)
at java.(InternetExplorer.jiffie.java.&lt.java.sf.auto.ClassLoader.JacobOinit&gt.util.AutoPublish.publish(AutoPublish.Rinit&gt.jacob.&lt.UnsatisfiedLinkError: no jacob-1
提问者采纳
15-M4-x86将jacob-1.dll文件.Program Files&#92;WINDOWS&#92;));看看打印出来的文件夹里是否有 jacob-1.out。;Java&#92.getProperty(&看看打印出来的那个文件夹是否有jacob-1.println(System.15-M4-x86。没有的话加进去基本上就好使了。然后在运行基本上就好使了;jdk1.out.dll文件.path&quot.6.path&quot.0_06&#92.15-M4-x86.println(S));C;system32下反正能向到的地方都放进去:&#92。如果再不好使在MyEclipse的main方法下打印System:&#92。如果没有再在tomcat或者jboss里启动打印System.getProperty(&bin.library.dll文件拷贝到C
其他类似问题
为您推荐:
其他1条回答
library.out.println(S看看打印出来的那个文件夹是否有jacob-1;)).getProperty(&quot.path&java在tomcat或者jboss里启动打印System
没有,我下载了,这个要放到什么地方去?
dll的话丢到system32就好
timer的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁Exception in thread &main& org.hibernate.exception.GenericJDBCException: Could not open connection_百度知道
Exception in thread &main& org.hibernate.exception.GenericJDBCException: Could not open connection
自学hibernate框架,J2SE+oracle 10g,运行出现异常,求解答
提问者采纳
没有连上oracle数据库,你写段本地测试代码,你看是不是数据库服务器没启动或者用户名密码错了
PL&#47;SQL 可以操作数据库
我是说用代码没连接好,不是管理工具,你的连接数据库的代码有问题,这么说明白了吗
提问者评价
感谢您的回答,解决了
其他类似问题
为您推荐:
hibernate的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
您的访问请求被拒绝 403 Forbidden - ITeye技术社区
您的访问请求被拒绝
亲爱的会员,您的IP地址所在网段被ITeye拒绝服务,这可能是以下两种情况导致:
一、您所在的网段内有网络爬虫大量抓取ITeye网页,为保证其他人流畅的访问ITeye,该网段被ITeye拒绝
二、您通过某个代理服务器访问ITeye网站,该代理服务器被网络爬虫利用,大量抓取ITeye网页
请您点击按钮解除封锁&2987人阅读
JavaEE(74)
org.hibernate.MappingException: Unknown entity: cn.itcast.hibernate717.helloworld.Person
hibernate框架根本不知道Person这个持久化类的存在
Caused by: java.sql.SQLException: Field 'id' doesn't have a default value
如果主键的生成策略采取的是identity,而数据库中表的主键不是自动生成机制,则报这样的错误
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [cn.itcast.hibernate717.helloworld.Person#1]
如果在hibernate中,有两个对象,但是其ID&#20540;是相同的,这样的情况在hibernate中是不允许出现& (在hibernate中,强调对象的唯一性)
Caused by: java.sql.BatchUpdateException: Cannot delete or update a parent row: a foreign key constraint fails (`test/orders`, CONSTRAINT `FKC3DF62E58940CCE2` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`id`))
违反了主外键约束的原则
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: cn.itcast.hibernate717.manytomany.Student
错误产生的原因:
在多对多时,代码中写了两个对象。程序的意图是通过级联的方式把这两个对象全部保存到数据库相应的表中。但是级联在映射文件中不存在,这个时候hibernate只会认session.save中的参数代表的对象
而另外一个对象则认为是瞬态的对象,所以会报如此的错误
在使用hibernate时,报了 Could not parse configuration: /hibernate.cfg.xml
这很有可能是hibernate.cfg.xml文件出错
此时可以先用浏览器打开 hibernate.cfg.xml文件 看看能不能正常显示,如果不能,则说明配置文件编写有问题(比如DTD的url错误,标签错误等),改正相应的错误后就不报异常了
1、错误一:在项目中要有commons-logging.jar,不然会报以下错误。
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
2、错误二、
如果你添加了ehcache-1.5.0.jar,但是没有加ehcache.xml,这时候将报错。
slf4j-api-1.5.10.jar日志包,EhCache依赖
slf4j-jdk14-1.5.10.jar日志包,EhCache依赖
java.lang.NoClassDefFoundError: edu/emory/mathcs/backport/java/util/concurrent/BlockingQueue
在junit.test里提示错误:nested exception is java.lang.NoClassDefFoundError:
edu/emory/mathcs/backport/java/util/concurrent/BlockingQueue
原因:没有包含:backport-util-concurrent.jar
在spring/lib/concurrent/加上即可。
3、开始创建项目的时候都要把各种字符集统一
项目名右击---&properties---&Text file encoding(控制文本文件内部的字符集,最好开始也要定义好)。
window--&preferences--&General--&Content Type的内容也要首先确定好。
Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
Caused by: java.lang.reflect.InvocationTargetException
Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for data in class cn.edu.hactcm.test.hibernate.Event
这种错误是把配置文件中的名字写错了的缘故。
5、易错点:
在给Date配置属性的时候,需要制定数据类型,并且列名要改一下,应为date为数据库的关键字。
org.hibernate.HibernateException: No CurrentSessionContext configured!
&at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:683)
SessionFactory 对象的创建代价很昂贵,它是线程安全的对象,它为所有的应用程序线程所共享。它只创建一次,通常是在应用程序启动的时候,由一个 Configuraion 的实例来创建。
Session 对象的创建代价比较小,是非线程安全的,对于单个请求,单个会话、单个的 工作单元而言,它只被使用一次,然后就丢弃。只有在需要的时候,一个 Session 对象 才会获取一个 JDBC 的 Connection(或一个Datasource)对象,因此假若不使用的时候它不消费任何资源。
此外我们还要考虑数据库事务。数据库事务应该尽可能的短,降低数据库中的锁争用。数据库长事务会阻止你的应用程序扩展到高的并发负载。因此,假若在用户思考期间让数据库事务开着,直到整个工作单元完成才关闭这个事务,这绝不是一个好的设计。
一个操作单元(Unit of work)的范围是多大?单个的 Hibernate Session 能跨越多个数据库事务吗?还是一个 Session 的作用范围对应一个数据库事务的范围?应该何时打开 Session,何时关闭 Session,你又如何划分数据库事务的边界呢?我们将在后续章节解决这些问题。
org.hibernate.HibernateException: No CurrentSessionContext configured!
&at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:683)
&at cn.edu.hactcm.test.hibernate.EventManager.CreateAndStoreEvent(EventManager.java:12)
&at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
错误原因:在hibernate.cfg.xml中没有配置正确,如果是web应用增加配置
&property name=&current_session_context_class&&jta&/property&
如果是Java应用,增加如下配置
&property name=&current_session_context_class&&thread&/property&
不能自动创建表
需要加上&property name=&hbm2ddl.auto&&update&/property&
错误7,事务提交(commit)之后session就已经关闭了,不用再写session.close()了。
严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
清空部署的项目重新启动。
14:57:53,624 ERROR ContextLoader:215 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\software\apache-tomcat-6.0.14\webapps\hactcmOA\WEB-INF\classes\applicationContext.xml]: Invocation o nested exception
is java.lang.NoClassDefFoundError: javax/persistence/EntityListeners
&at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
Caused by: java.lang.NoClassDefFoundError: javax/persistence/EntityListeners
&at org.hibernate.cfg.annotations.reflection.JPAMetadataProvider.getDefaults(JPAMetadataProvider.java:96)
Hibernate3.6依赖hibernate-jpa-2.0-api-1.0.0.Final.jar。应该把这个导进去。然后再remove deployment(移除部署好的向项目重新部署即可。)
&Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
说明配置Web.xml中的
&listener&
&&listener-class&org.springframework.web.context.ContextLoaderListener&/listener-class&
&/listener&
需要日志包
19:09:59,958 ERROR ContextLoader:215 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'genericServiceImpl' defined in file [D:\software\apache-tomcat-6.0.14\webapps\hactcmOA\WEB-INF\classes\cn\edu\hactcm\bean\GenericServiceImpl.class]: Instantiation of bean
nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [cn.edu.hactcm.bean.GenericServiceImpl]: Constru nested exception is java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl
cannot be cast to java.lang.Class
&at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
&at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [cn.edu.hactcm.bean.GenericServiceImpl]: Constru nested exception is java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl
cannot be cast to java.lang.Class
&at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115)
Caused by: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class
&at cn.edu.hactcm.bean.GenericDaoImpl.&init&(GenericDaoImpl.java:33)
19:09:59 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'genericServiceImpl' defined in file [D:\software\apache-tomcat-6.0.14\webapps\hactcmOA\WEB-INF\classes\cn\edu\hactcm\bean\GenericServiceImpl.class]: Instantiation of bean
nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [cn.edu.hactcm.bean.GenericServiceImpl]: Constru nested exception is java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl
cannot be cast to java.lang.Class
&at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [cn.edu.hactcm.bean.GenericServiceImpl]: Constru nested exception is java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl
cannot be cast to java.lang.Class
&at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115)
&at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
&at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877)
&... 40 more
Caused by: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class
&at cn.edu.hactcm.bean.GenericDaoImpl.&init&(GenericDaoImpl.java:33)
这种错误的原因是:在写事务的时候&
@Transactional
@SuppressWarnings(&unchecked&)
public class GenericDaoImpl&T& implements GenericDao&T& {
而写下面的时候写成如下的了。
public class GenericServiceImpl&T& extends GenericDaoImpl&T& implements GenericService&T& {
应该写成:
@Transactional
public class GenericServiceImpl&T& extends GenericDaoImpl&T& implements GenericService&T& {
org.apache.jasper.JasperException: /left.jsp(73,8) Attribute cssClass invalid for tag action according to TLD
原因:在&s:actioin&标签中不能写cssClass属性
&s:form action=&universityAction_collegeAdd.action&&
应该写成:&s:form action=&/universityAction_collegeAdd.action&&要加上“/”.s
org.hibernate.HibernateException:*** is not valid without active transaction
这种错误是因为使用的是getCurrentSession导致的,解决这种问题的办法是将getCurrentSession
改成openSession()这样就可以解决着种问题了。
这种错误适应为在hibernate.hbm.xml中配置了如下参数:
&property name=&current_session_context_class&&thread&/property&
将这一句删除后就没有问题了。
因为struts.xml中&action/&的中class的名称不是Action的名称导致错误
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'chapterDaoImpl':
Injection of re nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file
[D:\software\apache-tomcat-6.0.14\webapps\hactcmOA\WEB-INF\classes\applicationContext.xml]:
Invocation o nested exception is org.hibernate.MappingException:
Repeated column in mapping for entity: cn.edu.hactcm.domain.Major column:
secondaryAcademy_id (should be mapped with insert=&false& update=&false&)
&set name=&users&&
&&key column=&secondaryAcademy_id& not-null=&true&/&
&&one-to-many class=&User&/&
去掉:not-null=&true&
org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
原因代码写成了:
//院校只能有一个,从数据库中找出这个大学对象,然后将它存进去。
&&University university = universityService.get(2L);
&&model.setUniversity(university);
&&secondaryAcademyService.save(model);
&&universityService.delete(1L);
当get了的时候开启了一个session,delete了的时候又开启了一个session.
如果在many-to-one端加上了 not-null=&true&。并且这着时候在&one-to-many&对应的set结合中加了inverse=&true&
如果没有对应的外键,这时候将报如下错误:
org.hibernate.PropertyValueException: not-null property references a null or transient value: cn.edu.hactcm.domain.SecondaryAcademy.university
&&& org.hibernate.engine.Nullability.checkNullability(Nullability.java:100)
org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to load class for JSP
如果把如下标签写成如下的了,会出现以上错误。
&s:a action=&${pageContext.request.contextPath}/secondaryAcademyAction_deleteSecondaryAcademy?id=%{id}&&删除&/s:a&
改错办法是:
去掉:${pageContext.request.contextPath}/
21:00:52,568 DEBUG ConnectionManager:464 - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
21:00:52,568 DEBUG ConnectionManager:325 - transaction completed on session with on_close con be sure to close the session to release JDBC resources!
Exception in thread &main& org.springframework.transaction.TransactionSystemException: Could not commit H nested exception is org.hibernate.TransactionException: Transaction not successfully started
&at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:659)
&at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:709)
Caused by: org.hibernate.TransactionException: Transaction not successfully started
&at org.hibernate.mit(JDBCTransaction.java:127)
错误原因是:
&&Session session = sessionFactory.getCurrentSession();
&&Transaction tx = session.beginTransaction();
&&// 获取题型信息
&&List&Type& types = XmlUtils.getTypes();
&&Iterator&Type& iterator = types.iterator();
&&while (iterator.hasNext()) {
&&&Type type = iterator.next();
&&&session.save(type);
&&session.flush();
&&session.clear();
&&session.close();
这里的Session session = sessionFactory.getCurrentSession();不能和session.flush();session.clear();tx.commit();session.close();同时使用
错误21:Caused by: com.mchange.v2.resourcepool.ResourcePoolException: Attempted to use a closed or broken resource pool
解决方案1:重启mysql。
解决这个异常需要修改设置成如下:
&property name=&acquireRetryAttempts&&
&&& &value&30&/value&
&/property&
&property name=&acquireRetryDelay&&
&&& &value&100&/value&
&/property&
&property name=&breakAfterAcquireFailure&&
&&& &value&false&/value&
&/property&
- acquireRetryAttempts
Default: 30
Defines how many times c3p0 will try to acquire a new Connection from the database before giving up. If this value is less than or equal to zero, c3p0 will keep trying to fetch a Connection indefinitely
- acquireRetryDelay
Default: 1000
Milliseconds, time c3p0 will wait between acquire attempts.
- breakAfterAcquireFailure
Default: false
If true, a pooled DataSource will declare itself broken and be permanently closeed if a Connection cannot be obtained from the database after making acquireRetryAttempts to acquire one. If false, failure to obtain a Connection will cause all Threads waiting
for the pool to acquire a Connection to throw an Exception, but the DataSource will remain valid, and will attempt to acquire again following a call to getConnection().
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
因为在通过登陆名和密码方式查询用户时写成了:
return (User)getSession().createQuery(
&&&&&FROM & &#43; clazz.getSimpleName() //查询哪个表
&&&&&#43; & u WHERE u.loginName = ? and u.password = ?&)//查询条件
&&&&.setParameter(0, loginName)& //登录名
&&&&.setParameter(1, password)//注意这里的password要经过三次MD5加密。
&&&&.list()
&&&&.get(0);&
而这里包括空&#20540;得情况。要对List集合先进行判断,如果list集合有元素,才能通过.get(0)方式去,如果为空,那么用get(0)的时候就会出错。
Stacktraces
java.lang.NumberFormatException: null
&&& java.lang.Long.parseLong(Long.java:372)
&&& java.lang.Long.parseLong(Long.java:461)
&&& cn.edu.hactcm.web.action.ChapterAction.deleteKnowledgePoint(ChapterAction.java:199)
这种错误可能是因为传入的&#20540;是空&#20540;造成的。
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: cn.edu.hactcm.domain.Chapter.knowledgePoints, no session or session was closed
&at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:383)
错误原因:hibernate 延迟加载的错误 failed to lazily initialize a collection of role
解决办法:
1、设置lazy=false
2、就是使用filter,过滤所有的链接
如果在使用filter的时候,要配置事务处理,否则会导致session处于只读状态而不能做修改、删除的动作
&&&filter-name&hibernateFilter&/filter-name&
&&&filter-class&
&&org.springframework.orm.hibernate.support.OpenSessionInViewFilter
&&&/filter-class&
&&/filter&
&&filter-mapping&
&&&filter-name&hibernateFilter&/filter-name&
&&&url-pattern&*.do&/url-pattern&
&&/filter-mapping&
&/web-app&
我的解决办法如:
&set name=&knowledgePoints& inverse=&true& cascade=&all-delete-orphan& lazy=&false&&
&&key column=&chapter_id&/&
&&one-to-many class=&KnowledgePoint&/&
在后面加了一个lazy=&false&属性。
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 2-byte UTF-8 sequence.
分析,这个问题的主要原因是xml文件中声明的编码与xml文件本身保存时的编码不一致。比如你的声明是
&?xml version=&1.0& encoding=&UTF-8&?&
但是却以ANSI&#26684;式编码保存,尽管并没有乱码出现,但是xml解析器是无法解析的。
解决办法就是重新设置xml文件保存时的编码与声明的一致
java.lang.IllegalArgumentException: id to load is required for loading
出现这样的错误一般是我们的某个字段为null,使用log或system返回来看看!!
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:989134次
积分:17597
积分:17597
排名:第328名
原创:743篇
转载:402篇
评论:99条
(26)(5)(6)(3)(1)(6)(4)(12)(14)(3)(18)(29)(28)(17)(23)(12)(7)(18)(51)(46)(76)(93)(57)(42)(12)(27)(11)(25)(16)(23)(5)(6)(23)(64)(51)(9)(15)(18)(23)(17)(11)(9)(32)(41)(14)(74)(21)(1)
阅读:6571
文章:32篇
阅读:37149

我要回帖

更多关于 exce打不开 的文章

 

随机推荐