qq_30420315
善哉尚在
2016-06-12 03:15
采纳率: 55.3%
浏览 2.5k
已采纳

java.lang.ClassNotFoundException问题

java.lang.ClassNotFoundException: com.xx.listener.InitialListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3770)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

web.xml中
<listener>
    <display-name>InitialListener</display-name>
    <listener-class>
        com.xx.listener.InitialListener
    </listener-class>
</listener>

类:
public class InitialListener implements ServletContextListener {
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(InitialListener.class);

//系统基本设置业务对象
private static final ISystemConfigService systemConfigService = (ISystemConfigService)SpringUtil.getObjectFromSpring("systemConfigService");

public void contextDestroyed(ServletContextEvent sce) {
    log.info("销毁系统监听器初始化参数");
}

public void contextInitialized(ServletContextEvent event) {
    log.info("初始化系统参数开始...");
    ServletContext application = event.getServletContext();
    //网站页面
    String domainName = application.getInitParameter("domainName");
    //页面没有检索到相关数据时,显示的提示信息
    String noDataMessage = application.getInitParameter("noDataMessage");
    application.setAttribute("noDataMessage", noDataMessage);
    application.setAttribute("baseUrl", domainName);
    application.setAttribute("siteUrl", "www." + domainName);
    //application.setAttribute("groupUrl", "www." + domainName);
    application.setAttribute("groupUrl", "http://211.149.196.53:30000");
    //全局上下文路径
    application.setAttribute("contextPath", application.getContextPath());
    application.setAttribute("fileBasePath", event.getServletContext().getRealPath("/"));
    application.setAttribute("fileDirectory", "temp");
    application.setAttribute("separator", File.separator);

    //获取网站设置的基本对象
    SystemConfig systemConfig = null;
    try {
        systemConfig = systemConfigService.querySystemConfig();
        if(systemConfig != null) {
            application.setAttribute(ContextConstants.SCOPE_SYSTEM_SETTING, systemConfig);
        }
    } catch(Exception e){
        log.info("初始化系统基本设置对象的时候出错: " + e.fillInStackTrace());
    }

    application.setAttribute("UPLOAD_SEPARATOR_VALUE", ContextConstants.UPLOAD_SEPARATOR_VALUE);
    log.info("初始化系统参数结束...");
}

}

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • u011606457
    _1_1_7_ 2016-06-12 03:18
    已采纳

    工程的依赖,类路径之类的检查一下,是否完备?

    点赞 评论

相关推荐