NutzCN Logo
问答 非mvc环境获取dao:init datasource error,不明的原因导致驱动程序造成失败
发布于 236天前 作者 qq_a96bd60c 552 次浏览 复制 上一个帖子 下一个帖子
标签:

报错日志:

15:24:31.699 [main] ERROR c. alibaba . druid. pool. DruidDataSource一init datasource error
tion不明的原因导致驱动程序造成失败, 请回报这个例外。
at org.postgresql. Driver . connect(Oriver. fava:272) ~[ postgresql -42.1.4. jre7. jar:42.1.4. jre7]
at com. alibaba . druid. pool. DruidAbstractDataSource . createPhysicalConnection(DruidAbstractDataSource. java:1326) ~[druid-0.2.19. jar:0.2.19]at com. alibaba . druid.pool. DruidAbstractDataSource. createPhysica IConnection(oruidAbstractDatasource. iava:1382) ~[druid-8.2.19. jar:0.2.19 ]at com. alibaba . druid . pool . DruidDataSource . init DruidDatasource java:512) [druid-0.2.19. jar:0.2.19]
at com. alibaba. druid.pool. DruidDataSourcegetconnection(ruidOatasource.1ava:783) [druid-8.2.19. jar:8.2.19 ]at com. alibaba . druid. pool. DruidDataSource . getComnection OruidDataSource. fava:779) [druid-8.2.19.jar:8.2.19]
t com. alibaba . druid. pool. DruidDataSource . getConnection(OruidDataSource.java190) [druid-0.2.19. jar:8.2.19]t org.nutz.trans.Trans getConnectionAuto(Trans. java1252) [nutz-core-1.48.3. jar ina]t org. nutz.dao. jdbc.Jdbcs.getExpertdbcs. iava:97y [nutz-dao-1.48.3. jar:na ]
at org . nutz . dao. impl. DaoSupport. setDataSource(OaoSupport. java:167 ) [nutz-dao-1.48.3. jar:na]at sun.reflect.NativeMethodAccessorImpl. invokee(Native Hethod) ~[na:1.8.0 121]
sun. reflect . NativeMethodAccessor Impl. invoke(Nativele thodAccessonImpl. java:62) ~[na:1.8.0 121]
at sun.reflect DelegatingMethodAccessorImpl. invoke(DelegatingMethodAccessorImpl. java143) ~[na:1.8.8 121]at java. lang reflect .Method. invoke(Methad. java:498) ~[na:1.8.0 121]
at org. nutz .lang . inject . InjectBysetter . inject(InjectBysetter fava:26) [nutz core 1.48.3. jar na]at org nutz. ioc.weaver.FieldInjector . inject(FieldInector. iava:24) [nutz-core-1.48.3. jar:na ]at org.nutz.ioc.weaver .Defaultweaver.fillDefaultieaver. java:56) [nutz-core-1.48.3. jar :na]
at org. nutz. ioc.objectProxy get(objectProxy. java:63) [nutz-core-1.48.3. jar :na]at org. nutz.ioc. impl.NutIoc. get(NutIoc. java:194) [nutz-core-1.48.3. jar ina ]at org. nutz. ioc. impl.NutIoc. get(NutIoc. iava;199) [nutz-core-1.48.3.jar :na]at org.nutz. ioc. impl. NutIoc.get(NutIoc. java:133) [nutz-core-1. 48.3.jar:na]at com. geor . aum. server . job. ClearJob. <clinit>(ClearJab. java:29) [classes/ :na
at com. geor . aum. server . job. SchedulerLoader load(Schedulerloader.java132) [classes/ :na]at com. geor . aum . server . AppLauncher . launch(AppLauncher java:26) [classes/ :na]t com. geor. aum. server .AppLauncher . main(Applauncher : java:41) [ classes/ :na]
Caused by: java. lang.Str ingIndexOutofBoundsException: String index out of range: -824264796
java . lang . string . checkBounds(String: java:381) ~[na:1.8.0 121]at java.lang string. <init>(String. java:425) ~[na:1.8.8 121]
at org.postgresql. core Encoding decode(Encoding. java:284) ~[postgresql -42.1.4. jre7.jar:42.1.4.jre7]
t org. postgresql . core . EncodingPredictor . decode (EncodingPredictor. java:196) ~[ postgresq1-42.1.4. jre7. jar:42.1.4. jre7]t org. postgresql. core . PGstream. receiveErrorst

代码:

public class ClearJob implements Job {

	static Logger log = Loggers.get();
	public static Dao dao;
	public static Ioc ioc;

	static {
		try {
			if (null == ioc) {
				ioc = new NutIoc(new ComboIocLoader("*js", "config/settings/datasource.js"));
				log.debug("获取ioc成功!");
			}
			if (null == dao) {
				dao = ioc.get(Dao.class);
				log.debug("获取dao成功!");
			}
		} catch (ClassNotFoundException e) {
			log.error("ioc异常", e);
		}
	}

	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		try {
4 回复

用的就是ioc = new NutIoc(new ComboIocLoader("*anoo", ...))的方式,绝大多数情况下是正常的,只有一次debug的时候报了这个错,init datasource error,下标越界

druid的bug吧,更新一下

添加回复
请先登陆
回到顶部