【发布时间】:2014-04-09 09:41:55
【问题描述】:
我正在使用 jndi/db 别名来连接数据库。它工作正常.. 但是,我需要使用 Hibernate 来完成同样的工作......
当我使用以下属性时,我无法连接,
<property name="hibernate.connection.datasource">jdbc/ASPTADMINDEV</property>
在 resurce.xml 文件中,我正在使用这个,
(
<factories xmi:type="resources.jdbc:DataSource" xmi:id="DataSource_1233129165895" name="Oracle JDBC Driver DataSource" jndiName="jdbc/ASPTADMINDEV" description="New JDBC Datasource" providerType="Oracle JDBC Driver" authMechanismPreference="BASIC_PASSWORD" authDataAlias="ccixdmgr-nprd1-01-nodeMgr/GITPTDEV-ASPTADMIN-ASPTI" manageCachedHandles="false" logMissingTransactionContext="true" diagnoseConnectionUsage="false" relationalResourceAdapter="builtin_rra" statementCacheSize="10" datasourceHelperClassname="com.ibm.websphere.rsadapter.Oracle10gDataStoreHelper">
<propertySet xmi:id="J2EEResourcePropertySet_1233129165915">
<resourceProperties xmi:id="J2EEResourceProperty_1233129165915" name="driverType" type="java.lang.String" value="oci8" description="The type of the driver. The possible values are: thin, oci8." required="false"/>
<resourceProperties xmi:id="J2EEResourceProperty_1233129165916" name="oracleLogFileSizeLimit" type="java.lang.Integer" value="0" description="Oracle10g and beyond: The oracleLogFileSizeLimit specifies the maximum number of bytes to be written to any one file. Property is relevant only if trace file is specified. Default is unlimited" required="false"/>
<resourceProperties xmi:id="J2EEResourceProperty_1233129165917" name="oracleLogFileCount" type="java.lang.Integer" value="1" description="Oracle10g and beyond: The oracleLogFileCount specifies the number of files to use. Property is relevant only if trace file is specified. Default is 1." required="false"/>
<resourceProperties xmi:id="J2EEResourceProperty_1233129165918" name="oracleLogFileName" type="java.lang.String" value="" description="Oracle10g and beyond: The oracleLogFileName indicates which file to write the traces to" required="false"/>
<resourceProperties xmi:id="J2EEResourceProperty_1233129165919" name="oracleLogTraceLevel" type="java.lang.String" value="INFO" description="Oracle10g and beyond: The oracleLogTraceLevel specifies which message ">
......... and so
}
请让我知道我在这里做错了什么..
忘记粘贴错误;)..下面是错误,我得到了
INFO: JNDI InitialContext properties:{}
Apr 9, 2014 4:17:19 PM org.hibernate.connection.DatasourceConnectionProvider configure
SEVERE: Could not find datasource: java:comp/env/jdbc/ASPTADMINDEV
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
Initial SessionFactory creation failed.org.hibernate.HibernateException: Could not find datasource
at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
.
我需要改变什么吗?我正在使用以下属性
<property name="hibernate.connection.datasource">java:comp/env/jdbc/ASPTADMINDEV</property>
【问题讨论】:
-
应用部署在哪里:Tomcat还是应用服务器(哪一个)?开始自己调试,例如检查数据源是否正确注册(检查在你的应用服务器中)
-
哦,你在下面的评论中说你也有评论。有趣...您真的希望我们知道您的系统发生了什么错误吗?
-
@AndreiI 忘记粘贴错误。 ;)。我部署在 TOMCAT 服务器上,它抛出错误
标签: java oracle hibernate jdbc