SSH Commons Errors


Decription:

 

1.      Spring+log4j

Description:

ClassNotFoundException: org.springframework.web.util.Log4jConfigListener

or

Error configuring application listener of classorg.springframework.web.context.ContextLoaderListener 

java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener 

Solution:

Include the follow jars

Log4j-1.2.14.jar

Spring-web-3.2.0.RELEASE.jar

Spring-orm-3.2.0.RELEASE.jar

Clean the project and redeploy

Ref maven  pom.xml

Refweb.xml

2.      BasicDataSource

Description:

java.lang.ClassNotFoundException:org.apache.commons.dbcp.BasicDataSource

or

Exception sending context initialized event to listenerinstance of class org.springframework.web.context.ContextLoaderListener

org.springframework.beans.factory.CannotLoadBeanClassException:Cannot find class [org.apache.commons.dbcp.BasicDataSource] for bean with name'dataSource' defined in ServletContext resource[/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException:org.apache.commons.dbcp.BasicDataSource

atorg.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1263)

Solution:

Include the follow jar files

commons-pool.jar

commons-dbcp-1.4.jar

commons-collections-3.2.jar

Clean the project and reploy

Refpom.xml

3.      SpringObjectFactory

Description:

At starting tomcat we got the error:

Class: com.opensymphony.xwork2.spring.SpringObjectFactory

File: SpringObjectFactory.java

Method: getClassInstance

Line: 209 -com/opensymphony/xwork2/spring/SpringObjectFactory.java:209:-1

Caused by: java.lang.NullPointerException 

atcom.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:209)

Solution:

There2 reason

1. Includedstruts2-spring-plugin-2.1.8, but we didn’t use spring (and any spring profiles),delete this jar.

2. Projectusing spring, but we didn’t  add thespirngContext listener int web.xml

         <context-param>

        <param-name>contextConfigLocation</param-name>

        <param-value>/WEB-INF/applicationContext.xml</param-value>

</context-param>

<listener>

<listener-class>

org.springframework.web.context.ContextLoaderListener

</listener-class>

</listener>

Clean the project and reploy

4.      ConfigurableEnvironment

Description:

Exception sending context initialized event to listenerinstance of class org.springframework.web.context.ContextLoaderListener

java.lang.NoClassDefFoundError:org/springframework/core/env/ConfigurableEnvironment

atjava.lang.Class.getDeclaredConstructors0(Native Method)

Caused by: java.lang.ClassNotFoundException:org.springframework.core.env.ConfigurableEnvironment

Solution:

A: spring to maintain a consistent version of the jar

B: exclusion

<dependency>

  <groupId>org.springframework</groupId>

  <artifactId>spring-orm</artifactId>

  <version>${spring.version}</version>

  <exclusions>

      <exclusion>

          <groupId>org.springframework</groupId>

          <artifactId>spring-context</artifactId>

      </exclusion>

  </exclusions>

</dependency>

Clean the project and reploy

5.      Hibernate3 CacheProvider

Description:

Exception sending context initialized event to listenerinstance of class org.springframework.web.context.ContextLoaderListener

org.springframework.beans.factory.BeanCreationException:Error creating bean with name 'sessionFactory' defined in ServletContextresource [/WEB-INF/applicationContext.xml]: Initialization of bean failed;nested exception is java.lang.NoClassDefFoundError:org/hibernate/cache/CacheProvider

atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:532)

Caused by: java.lang.NoClassDefFoundError:org/hibernate/cache/CacheProvider

Caused by: java.lang.ClassNotFoundException:org.hibernate.cache.CacheProvider

Solution:

Because there is no longer cacheprovider class in hibernate4, cacheprovideronly int hibernate3. Change hibernate3 to hibernate4.

<bean id="sessionFactory"

        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">

        <property name="dataSource">

         <ref bean="dataSource" />

Clean the project and reploy

6.      34

Description:

Java:

Solution:

Include the follow jar files

         *.jar

Clean the project and reploy


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值