neo4j - 在 websphere 应用服务器中为 neo4j 创建数据源时出错
问题描述
我试图在 websphere 应用程序服务器中为 neo4j 创建数据源,但连接失败。对此的任何指示都会有所帮助。
使用以下参数创建的 JDBC 驱动程序:
- 名称:neo4j 驱动程序
- 类路径:neo4j jdbc jar/neo4j-jdbc-driver-3.3.1.jar 的路径
- 实现类名:org.neo4j.jdbc.Driver
使用以下内容创建的数据源:
- jndi 名称:jdbc/neo4j
自定义属性:
- 身份验证:容器
- 类型:javax.sql.DataSource
- 用户名:neo4j
- 密码:密码
- url:jdbc:neo4j:bolt://localhost:port
- removeAbandonedOnBorrow : 真
- 关闭方法:关闭
根据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)
解决方案
为将来可能会找到这篇文章的其他人澄清一下 - 是否可以直接配置到 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>
推荐阅读
- javascript - EmberJS:从服务发送事件到路由?
- javascript - 为什么附加不起作用?this.append 不是函数
- postgresql - TimescaleDB 在第一次插入旧数据后压缩块
- flutter - 如何将图像提供程序转换为颤振中的图像以便在画布中使用?
- composer-php - 在 Windows 10 上安装 Compser 的步骤
- c# - 忽略 Web 浏览器控件“找不到”错误
- java - 参数匹配器的使用无效。如果此方法使用另一种私有方法,我该如何测试它?
- android-studio - android studio 模拟器无法选择
- java - 无法从 Angular 应用程序中的 vertx3-eventbus-client 向后端的 vertx SockJs 发送消息
- node.js - “路径”参数必须是字符串类型。接收类型对象nodejs google云存储对象上传