起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1352|回复: 1

[处理中1] 想在其他方法中获取连接对象报错

[复制链接]

49

主题

112

帖子

428

积分

中级会员

Rank: 3Rank: 3

积分
428
QQ
发表于 2016-9-29 10:17:47 | 显示全部楼层 |阅读模式
如何在其他方法中获取context连接,想在其他方法中调用
2016-09-29 10:15:04 获取数据库[scgj]连接失败,可能原因:数据库已经关闭或者数据源配置错误
javax.naming.NameNotFoundException: Name scgj is not bound in this Context
        at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
        at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
        at javax.naming.InitialContext.lookup(InitialContext.java:417)
        at com.justep.baas.data.DataUtils.getConnection(Unknown Source)
        at tongyingAdminbaas.GetMember.get(GetMember.java:46)
        at tongyingAdminbaas.GetMember.run(GetMember.java:27)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)
com.justep.baas.data.sql.SQLException: 获取数据库[scgj]连接失败,可能原因:数据库已经关闭或者数据源配置错误
        at com.justep.baas.data.DataUtils.getConnection(Unknown Source)
        at tongyingAdminbaas.GetMember.get(GetMember.java:46)
        at tongyingAdminbaas.GetMember.run(GetMember.java:27)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)
Caused by: javax.naming.NameNotFoundException: Name scgj is not bound in this Context
        at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
        at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
        at javax.naming.InitialContext.lookup(InitialContext.java:417)
        ... 5 more
2016-09-29 10:15:18
2016-09-29 10:15:18 获取数据库[scgj]连接失败,可能原因:数据库已经关闭或者数据源配置错误
javax.naming.NameNotFoundException: Name scgj is not bound in this Context
        at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
        at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
        at javax.naming.InitialContext.lookup(InitialContext.java:417)
        at com.justep.baas.data.DataUtils.getConnection(Unknown Source)
        at tongyingAdminbaas.GetMember.get(GetMember.java:46)
        at tongyingAdminbaas.GetMember.run(GetMember.java:27)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)
com.justep.baas.data.sql.SQLException: 获取数据库[scgj]连接失败,可能原因:数据库已经关闭或者数据源配置错误
        at com.justep.baas.data.DataUtils.getConnection(Unknown Source)
        at tongyingAdminbaas.GetMember.get(GetMember.java:46)
        at tongyingAdminbaas.GetMember.run(GetMember.java:27)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)
Caused by: javax.naming.NameNotFoundException: Name scgj is not bound in this Context
        at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
        at org.apache.naming.SelectorContext.lookup(SelectorContext.java:152)
        at javax.naming.InitialContext.lookup(InitialContext.java:417)
        ... 5 more


1

主题

3232

帖子

1174

积分

金牌会员

Rank: 6Rank: 6

积分
1174
QQ
发表于 2016-9-29 13:41:19 | 显示全部楼层
其他地方,具体是什么地方,现在报错了,数据库[scgj]连接失败,报错信息,是这个数据库连接失败,光看这些,看不出什么
在问题解决后,希望大家可以吧解决方法也分享一下,这样可以让更多的X5开发者共同进步,谢谢大家的知识共享
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2025-6-18 07:17 , Processed in 0.052083 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表