NutzCN Logo
问答 jboss启动的时候报IOC异常
发布于 2687天前 作者 qq_35bdc8ec 1991 次浏览 复制 上一个帖子 下一个帖子
标签:

ERROR stderr Exception in thread "Thread-154" org.nutz.ioc.IocException: [placeManager, daoIfManager, daoProvider] # FAIL to create Ioc Bean name=[daoProvider]

ERROR stderr at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:149)

ERROR stderr at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:218)

ERROR stderr at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24)

ERROR stderr at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:31)

ERROR stderr at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)

ERROR stderr at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:135)

ERROR stderr at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:218)

ERROR stderr at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24)

ERROR stderr at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:31)

ERROR stderr at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)

ERROR stderr at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:135)

ERROR stderr at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:218)

ERROR stderr at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:265)

16 回复

日志没贴全, 用"插入代码或日志片段" 按钮贴一下

好的,我改一下日记级别,再贴一下~谢谢你~

2017-08-14 14:07:28,292 DEBUG [org.nutz.ioc.impl.ScopeContext] (default task-16) Remove object 'daoProvider' from [app] 2017-08-14 14:07:28,292 DEBUG [org.nutz.ioc.impl.ScopeContext] (default task-16) Remove object 'daoIfManager' from [app] 2017-08-14 14:07:28,293 DEBUG [org.nutz.ioc.impl.ScopeContext] (default task-16) Remove object 'managerMgrService' from [app] 2017-08-14 14:07:28,295 DEBUG [org.nutz.ioc.impl.ScopeContext] (default task-16) Remove object 'agentMgrModule' from [app] 2017-08-14 14:07:28,295 WARN [org.nutz.mvc.impl.processor.FailProcessor] (default task-16) Error@/v1/agentmgr/agentmgrlogin :: org.nutz.ioc.IocException: IocBean[agentMgrModule] throw Exception when creating at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:149) at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210) at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:239) at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:116) at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27) at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15) at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44) at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67) at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31) at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202) at com.egoonet.lighting.yyzc.web.jwebui.commons.filters.NtzFilter.doFilter(NtzFilter.java:113) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:285) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:264) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:175) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:792) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.RuntimeException: IocBean[agentMgrModule] fail at field=[managerMgrService] at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:40) at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56) at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:135) ... 41 more Caused by: org.nutz.ioc.IocException: IocBean[managerMgrService] throw Exception when creating at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:149) at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210) at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24) at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32) ... 43 more Caused by: java.lang.RuntimeException: IocBean[managerMgrService] fail at field=[daoIfManager] at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:40) at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56) at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:135) ... 46 more Caused by: org.nutz.ioc.IocException: IocBean[daoIfManager] throw Exception when creating at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:149) at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210) at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24) at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32) ... 48 more Caused by: java.lang.RuntimeException: IocBean[daoIfManager] fail at field=[daoProvider] at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:40) at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56) at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:135) ... 51 more Caused by: org.nutz.ioc.IocException: IocBean[daoProvider] throw Exception when creating at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:149) at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210) at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24) at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32) ... 53 more Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: Could not initialize class com.egoonet.mcore.util.InterfaceScanner at org.nutz.lang.Lang.wrapThrow(Lang.java:184) at org.nutz.lang.Lang.wrapThrow(Lang.java:183) at org.nutz.ioc.trigger.MethodEventTrigger.trigger(MethodEventTrigger.java:21) at org.nutz.ioc.weaver.DefaultWeaver.onCreate(DefaultWeaver.java:72) at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:138) ... 56 more Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.egoonet.mcore.util.InterfaceScanner at com.egoonet.mcore.util.dao.DaoProvider.searchAllDaoCreatorIfNames(DaoProvider.java:64) at com.egoonet.mcore.util.dao.DaoProvider.init(DaoProvider.java:44) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.nutz.ioc.trigger.MethodEventTrigger.trigger(MethodEventTrigger.java:18) ... 58 more

麻烦您看看~

Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.egoonet.mcore.util.InterfaceScanner

这个类有啥特别呢??? 贴出来看看

package com.egoonet.mcore.util;

import java.util.Set;

import org.reflections.Reflections;
import org.reflections.scanners.MethodAnnotationsScanner;
import org.reflections.util.ClasspathHelper;
import org.reflections.util.ConfigurationBuilder;

/**
 * @author oilamp
 *
 */
public class InterfaceScanner {

	/**
	 * 
	 */
	public static Reflections reflections = new Reflections(new ConfigurationBuilder().setUrls(
	        ClasspathHelper.forPackage("com.egoonet")).addScanners(new MethodAnnotationsScanner()));
	
	/**
	 * @param classofT
	 * @return
	 */
	public static <T> Set<Class<? extends T>> getImplements(Class<T> classofT) {
		return reflections.getSubTypesOf(classofT);
	}
	
}

com.egoonet.mcore.util.dao.DaoProvider 这个贴一下

package com.egoonet.mcore.util.dao;

import java.lang.reflect.Modifier;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.nutz.dao.Dao;
import org.nutz.ioc.Ioc;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.log.Log;
import org.nutz.log.Logs;

import com.egoonet.mcore.util.InterfaceScanner;

/**
* NutzDao
* @author
*
*/
@IocBean(create="init")
public class DaoProvider {

private Log logger = Logs.get();

private Map<String, Dao> daoMap = new HashMap<String, Dao>();

private final String DEFAULT_DB_NAME       = "defaultDao";

private ThreadLocal<Dao> currentDao = new ThreadLocal<Dao>();

@Inject("refer:$Ioc")
private Ioc iocbus;

public DaoProvider() {
    logger.info("###################   DaoProvider");
}

public void init() {
    logger.info("begin init dao provider.");
    Collection<String> allDaoCreatorIfNames = searchAllDaoCreatorIfNames();
    String [] names = iocbus.getNames();
    for (String name : names) {
       if (!allDaoCreatorIfNames.contains(name.toLowerCase())) {
         continue;
       }
       Object o = iocbus.get(null, name);
       if (o instanceof DaoCreatorIf) {
         logger.info("init DaoCreatorIf [" + name + "].");
         DaoCreatorIf dc = (DaoCreatorIf) o;
         Map<String, Dao> map = dc.newDao();
         daoMap.putAll(map);
         logger.info("init DaoCreatorIf end, map is " + map);
       }
    }
    logger.info("init dao provider success.");
}

private Collection<String> searchAllDaoCreatorIfNames() {
    Set<String> allNames = new HashSet<String>();
    Set<Class<? extends DaoCreatorIf>> daoClasses = InterfaceScanner.getImplements(DaoCreatorIf.class);
    for (Class<?> clazz : daoClasses) {
       if (!Modifier.isInterface(clazz.getModifiers()) && !Modifier.isAbstract(clazz.getModifiers())) {
         allNames.add(clazz.getSimpleName().toLowerCase());
       }
    }
    return allNames;
}

/**
 * 杩斿洖榛樿鐨�NutzDao  
 * @return
 */
public Dao getDao() {
    return getDao(DEFAULT_DB_NAME);
}

/**
 * 杩斿洖鎸囧畾鍚嶅瓧鐨�NutzDao   
 * @param dbName
 * @return
 */
public Dao getDao(String dbName) {
    Dao d = daoMap.get(dbName);
    if (d == null) {
       synchronized (daoMap) {
         d = daoMap.get(dbName);
         if (d == null) {
          throw new RuntimeException("not support dao[" + dbName + "].");
         }
       }
    }
    return d;
}

public Dao currentDao() {
    return currentDao.get();
}

void setCurrentDao(Dao d) {
    if (d == null) {
       currentDao.remove();
    } else {
       currentDao.set(d);
    }
}

}

这一套在tomcat下面跑是没有问题的,这几天整在jboss-eap7里面就出现了这个问题。

最根本的那个异常, 还是没贴出来, 如果初始化失败,应该原因的. 日志就这么多?? 启动时候没报吗??

    Set<Class<? extends DaoCreatorIf>> daoClasses = InterfaceScanner.getImplements(DaoCreatorIf.class);
    for (Class<?> clazz : daoClasses) {
       if (!Modifier.isInterface(clazz.getModifiers()) && !Modifier.isAbstract(clazz.getModifiers())) {
         allNames.add(clazz.getSimpleName().toLowerCase());
       }
    }
    return allNames;

这段代码可以用 Scans.me().scanPackage替代,可以尝试一下

好的,我试试~
请问一下,这个问题能删除吗?

"这个问题能删除吗" 是什么意思??

就是我发的这个提问!“jboss启动的时候报IOC异常”

没有看到删除按钮~

是了,一样的异常~

你改了啥???

不支持删帖的.

换成了这个,Scans.me().scanPackage

贴现在的代码

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