简体   繁体   English

javax.naming.NameNotFoundException:具有SQL Server的JBOSS上的env / jdbc / DataSource

[英]javax.naming.NameNotFoundException: env/jdbc/DataSource on JBOSS with SQL Server

The JNDI name in my domain.xml is 我的domain.xml中的JNDI名称是

The Context.lookup has been defined as follows: Context.lookup的定义如下:

dsName = "java:comp/env"; dsName =“ java:comp / env”;

Context ctx = (Context) new javax.naming.InitialContext(); 上下文ctx =(上下文)new javax.naming.InitialContext();

Context envCtx = (Context)ctx.lookup(dsName); 上下文envCtx =(Context)ctx.lookup(dsName);

DataSource ds = (DataSource)envCtx.lookup("jdbc/DataSource"); 数据源ds =(DataSource)envCtx.lookup(“ jdbc / DataSource”);

conn = ds.getConnection(); conn = ds.getConnection();

I'm getting the following exception when connected to SQLserver with the following configuration where as it is working fine with Oracle.The lookup name somehow is not validated properly and connection object is getting null. 当使用以下配置连接到SQLserver时,出现以下异常,因为它可以与Oracle很好地工作。查找名称以某种方式未得到正确验证,并且连接对象为null。

javax.naming.NameNotFoundException: env/jdbc/DataSource javax.naming.NameNotFoundException:env / jdbc / DataSource

ERROR [stderr] (ServerService Thread Pool -- 78) at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:104) org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:104)上的错误[stderr](ServerService线程池-78)

ERROR [stderr] (ServerService Thread Pool -- 78) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:197) java.lang.NullPointerException org.jboss.as.naming.NamingContext.lookup(NamingContext.java:197)上的错误[stderr](ServerService线程池-78)

Even Tried with something like 甚至尝试过类似的东西

DataSource ds = (DataSource)envCtx.lookup("java:comp/env/jdbc/DataSource"); 数据源ds =(DataSource)envCtx.lookup(“ java:comp / env / jdbc / DataSource”);

Could anyone suggest on this. 任何人都可以对此提出建议。

Thanks 谢谢

Check the logs and/or the JNDI tree in the administration console. 在管理控制台中检查日志和/或JNDI树。

Try these: 试试这些:

"java:DataSource"
"java:jboss/datasources/DataSource"

If not, please paste here the data source config section in the config file (eg standalone.xml) 如果没有,请在此处将配置文件中的“数据源配置”部分粘贴到此处(例如standalone.xml)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SQL Server 2014无法在JBOSS EAP 6.4数据源配置中连接 - SQL Server 2014 fail to connect in JBOSS EAP 6.4 datasource configuration 需要帮助为JBoss EAP 6.1.0创建SQL Server数据源 - Need help creating SQL Server datasource for JBoss EAP 6.1.0 无法在 JBoss EAP 7.2 中添加 SQL 服务器数据源 - Unable to add SQL Server DataSource in JBoss EAP 7.2 SQL Server的数据源Microsoft JDBC驱动程序(AlwaysOn可用性组) - Datasource Microsoft JDBC Driver for SQL Server (AlwaysOn Availability Groups) Spring Boot-SQL Server连接问题(ExistingValue必须是javax.sql.DataSource的实例) - Spring boot - Sql Server connection issue(ExistingValue must be an instance of javax.sql.DataSource) 如何在JBoss中配置SQL Server数据源以使用特定的Active Directory用户进行连接? - How do I configure a SQL Server datasource in JBoss to connect using a specific Active Directory user? 如何在JBoss EAP 6中的XA数据源上指定SQL Server数据库实例名称? - How to specify SQL Server database instance name on XA datasource in JBoss EAP 6? Hibernate / SQL Server:无法创建请求的服务[org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] - Hibernate/SQL Server: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] 将JDBC与SQL Server连接 - Connect JDBC with SQL Server Java JDBC-> SQL Server - Java JDBC -> SQL Server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM