首页 > 解决方案 > 在 websphere 应用服务器中为 neo4j 创建数据源时出错

问题描述

我试图在 websphere 应用程序服务器中为 neo4j 创建数据源,但连接失败。对此的任何指示都会有所帮助。

使用以下参数创建的 JDBC 驱动程序:

使用以下内容创建的数据源:

自定义属性:

根据https://github.com/neo4j-contrib/neo4j-jdbc中提供的指针添加属性

这是日志中的错误:

java.lang.Exception:DSRA8101E:DataSource 类不能用作单阶段:ClassCastException:org.neo4j.jdbc.bolt.BoltDriver 与 javax.sql.ConnectionPoolDataSource 不兼容 [5/27/19 13:12:41:533 UTC ] 00000111 SystemErr R 在 com.ibm.ws.rsadapter.AdapterUtil.createDataStoreAdapterException(AdapterUtil.java:441) [5/27/19 13:12:41:533 UTC] 00000111 SystemErr R 在 com.ibm.ws.rsadapter。 DSConfigHelper.getPooledConnection(DSConfigHelper.java:1340)

标签: neo4jwebspheredatasource

解决方案


为将来可能会找到这篇文章的其他人澄清一下 - 是否可以直接配置到 java.sql.Driver 取决于是否使用 WebSphere Application Server 传统与 Liberty。

在传统的 WebSphere Application Server 中可以使用一种更间接的方法,它涉及围绕驱动程序模拟 ConnectionPoolDataSource 类。它在相关的堆栈溢出帖子下进行了讨论。

使用 Liberty 18.0.0.3 及更高版本,可以直接配置仅指定 URL 的数据源,此知识中心文档下提供了示例。

这是 Liberty 中的示例数据源配置,

<featureManager>
  <feature>jdbc-4.2</feature>
  <feature>jndi-1.0</feature>
  ... other features
</featureManager>

<dataSource jndiName="jdbc/neo4j" containerAuthDataRef="neo4jAuth">
  <jdbcDriver libraryRef="neo4j"/>
  <properties URL="jdbc:neo4j:bolt://localhost:7687"/>
</dataSource>

<authData id="neo4jAuth" user="neo4j" password="password"/>

<library>
  <file name="C:/drivers/neo4j/neo4j-jdbc-driver-3.3.1.jar"/>
</library>

推荐阅读