做一个SSH为基础框架的webapp小DEMO,复制了一把以前可以跑的代码,竟发现无法初始化数据源,报错如下:

[ERROR][org.springframework.web.context.ContextLoader][main] Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:610)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)

at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)

at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)

at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)

at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)

at org.apache.catalina.startup.Embedded.start(Embedded.java:825)

at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:558)

at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:255)

at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)

at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)

at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)

at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)

at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)

at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)

at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)

at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)

at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)

at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)

at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)

at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)

at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)

at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)

at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)

at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

Caused by: java.lang.NullPointerException

at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:207)

at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:76)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:160)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:132)

at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1822)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1780)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1865)

at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:247)

at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:373)

at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:358)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)

... 42 more

2015-2-1 16:45:08 org.apache.catalina.core.StandardContext listenerStart

由于其中部分有jar包更新版本,故以为是jar包更新所致,查了1个多小时,无果,一直报这个错。

于是将原来可以跑的DEMO给跑起来,发现确实是可以跑的。将jar包更新成新的小DEMO也是可以跑的。

最后查看lib目录,发现新jar包里面多了一个oralce14.jar数据库连接驱动包。一下子想起来了,在架构老DEMO的时候由于当时手动放过oralce14.jar到lib,之后又改用了oracle5.jar并且手动删除了对oralce14.jar的依赖,却没有删除lib下的oracle14.jar包。

由于自己贪一时之快,直接复制的。真是抄近路掉坑啊!以后长记性了,新项目一定要删干净lib包。

[ERROR][org.springframework.web.context.ContextLoader][main] Context initialization failed org.sprin的更多相关文章

  1. spring 使用@Valid校验数据出错DEBUG org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod - Failed to resolve argument 0 of type

    问题原因:在 @Valid 的那个参数后面紧跟着一个 BindingResult 的参数(一定要紧跟着) 参考来源:https://segmentfault.com/q/101000000838468 ...

  2. org.springframework.web.context.support.XmlWebApplicationContext.refresh Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreatio

    错误异常: 11-Apr-2019 18:07:14.006 警告 [RMI TCP Connection(5)-127.0.0.1] org.springframework.web.context. ...

  3. org.springframework.beans.factory.BeanCreationException,Invocation of init method failed,Context initialization failed

    G:\javaanzhuang\apache-tomcat-\bin\catalina.bat run [-- ::,] Artifact ssm_qingmu02_web:war exploded: ...

  4. Caused by: java.lang.ClassNotFoundException: org.springframework.web.filter.FormContentFilter

    又是一个报错,我写代码真的是可以,所有的bug都会被我遇到,所有的问题我都能踩一遍,以前上学的时候同学就喜欢问我问题,因为他们遇到的问题,我早就遇到了......... 看看报错内容: 2019-04 ...

  5. idea出现Error configuring application listener of class org.springframework.web.context.ContextLoader

    在IDEA中写spring mvc时出现Error configuring application listener of class org.springframework.web.context. ...

  6. Log4j使用教程 log4:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).

    1.Logger类 通过Logger类的静态方法Logger.getRootLogger得到RootLogger.所有其他的loggers是通过静态方法Logger.getLogger来实例化并获取的 ...

  7. 异常将上下文初始化事件发送到类的侦听器实例.[org.springframework.web.context.ContextLoaderListener] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class p

    严重: 异常将上下文初始化事件发送到类的侦听器实例.[org.springframework.web.context.ContextLoaderListener]org.springframework ...

  8. log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).

    一.异常描述: log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLo ...

  9. maven ClassNotFoundException: org.springframework.web.context.ContextLoader

    信息: Starting Servlet Engine: Apache Tomcat/6.0.32 2012-3-31 9:39:40 org.apache.catalina.core.Standar ...

随机推荐

  1. Linux 使用 bg 和 fg 切换任务运行状态

    将Linux任务转换到后台执行 平时在运行 Linux 任务时,在任务运行时又想运行其它任务,那么可以把任务切换到后台运行. 使用 ctrl+z 可以把当前的任务转入到后台,这时任务并没有被中止,可使 ...

  2. 第一个thinkphp入口文件

    ThinkPHP3.1.3_full已下载 网站根目录下编辑一个入口文件index.php <?php define('APP_NAME','Index'); //项目名称 define('AP ...

  3. Centos php项目发布问题

    LAMP环境,项目运行错误日志路径:/var/log/httpd 错误日志例如: [Sat Jul :: ] [error] [client , referer: http://192.168.100 ...

  4. 发现EF中字段错误

    在使用EF时,报错: 对一个或多个实体的验证失败.有关详细信息,请参见“EntityValidationErrors”属性 添加一个验证方法: 代码: using System; using Syst ...

  5. InitializingBean afterPropertiesSet

    package org.test.InitializingBean; import org.springframework.context.support.ClassPathXmlApplicatio ...

  6. Android Push Notification实现信息推送使用

    本贴在http://www.cnblogs.com/hanyonglu/archive/2012/03/16/2399655.html下略为改动. Apndroid Push Notification ...

  7. Custom IFormatProvider

    The following example shows how to write a custom IFormatProvider which you can use in methodString. ...

  8. for 穷举、迭代 while循环

    1.穷举: 把所有可能的情况都走一遍,使用if条件筛选出来满足条件的情况. 2.百鸡百钱:公鸡2文钱一只,母鸡1文钱一只,小鸡半文钱一只,总共只有100文钱,如何在凑够100只鸡的情况下刚好花完100 ...

  9. session 实现保存用户信息

    index.jsp <body> <div style="margin: 0 auto; width: 500px; text-align: center;"&g ...

  10. HDU 1890 区间反转

    http://acm.hdu.edu.cn/showproblem.php?pid=1890 Robotic Sort Problem Description Somewhere deep in th ...