我們無法使從部署在Java應用程序DB2數據庫連接‘自由Java的’使用JNDI資源在Bluemix問題JNDI資源初始化 - DB連接@「雲DB2 - BLUEMIX
它是不能夠。初始化資源。
我的server.xml文件是
"<dataSource id="eVotingDataSource" jdbcDriverRef="db2-driver" jndiName="jdbc/DatabaseName" type="javax.sql.DataSource">
<properties.db2.jcc id="eVotingDataSource-props" databaseName="*******" user="db2inst1" password="******" portNumber="50001" serverName="********" sslConnection="true"/>
</dataSource>
<jdbcDriver id="db2-driver" libraryRef="db2-library"/>
<library id="db2-library">
<fileset id="db2-fileset" dir="${server.config.dir}/lib" includes="db2jcc4.jar db2jcc_license_cu.jar"/>
</library>
web.xml文件
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/DatabaseName</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
applicationContext.xml文件
<jee:jndi-lookup id="eVotingDataSource"
JNDI名稱= 「JDBC /數據庫名」 預期型= 「javax.sql.DataSource中」/>
下面是消息的輸出。登錄
org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.nl.abnamro.evoting.dao.IssuerDAOImpl.eVotingSessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eVotingSessionFactory' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'eVotingDataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eVotingDataSource': Invocation of init method failed; nested exception is javax.naming.NamingException: CWWKN0008E: An object could not be obtained for name jdbc/DatabaseName.
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eVotingDataSource': Invocation of init method failed; nested exception is javax.naming.NamingException: CWWKN0008E: An object could not be obtained for name jdbc/DatabaseName.
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eVotingMailSource': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Intermediate context does not exist: mail/Session
當我們加載我們收到以下錯誤的應用程序:
Error 500: javax.servlet.ServletException: Filter [springSecurityFilterChain]: could not be initialized
您能否協助?
是否爲Liberty服務器配置了jndi-1.0功能? – Alasdair
嗨...是的......它被添加到server.xml文件 – Sakthikumar