参与者有分,关于Struts2.0.11.1 + spring2.5.4 + Hibernate3.2.6整合问题

时间:2021-10-22 21:47:40
那位老大测试过:
http://cwiki.apache.org/S2WIKI/struts-2-spring-2-jpa-ajax.html
里面写的例子。

我把它的代码下载然后添加到eclipse以后不能运行。
不知道为什么请各位老兄帮忙。看到网上很多人说但没并没人解决

错误信息如下:
2008-6-23 14:49:01 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:quickstart' did not find a matching property.
2008-6-23 14:49:01 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: F:\webdevelop\ibm_sdk60\jre\bin;.;F:\webdevelop\ibm_sdk60\bin\..\jre\bin\j9vm;F:\webdevelop\ibm_sdk60\bin\..\jre\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\PROGRA~1\Borland\Delphi6\Bin;C:\PROGRA~1\Borland\Delphi6\Projects\Bpl;F:\webdevelop\ibm_sdk60\bin;
2008-6-23 14:49:01 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
2008-6-23 14:49:01 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 660 ms
2008-6-23 14:49:01 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
2008-6-23 14:49:01 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.16
2008-6-23 14:49:02 org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener "org.springframework.web.context.ContextLoaderListener" is already configured for this context. The duplicate definition has been ignored.
2008-6-23 14:49:02 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
Throwable occurred: java.lang.NoClassDefFoundError: org.apache.commons.logging.LogFactory
at org.springframework.web.context.ContextLoader.<clinit>(ContextLoader.java:146)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at org.springframework.web.context.ContextLoaderListener.createContextLoader(ContextLoaderListener.java:53)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:44)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
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:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:59)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:39)
at java.lang.reflect.Method.invoke(Method.java:612)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
... 20 more
2008-6-23 14:49:02 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
2008-6-23 14:49:02 org.apache.catalina.core.StandardContext start
SEVERE: Context [/quickstart] startup failed due to previous errors
2008-6-23 14:49:02 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
2008-6-23 14:49:02 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
2008-6-23 14:49:02 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/16  config=null
2008-6-23 14:49:02 org.apache.catalina.startup.Catalina start
INFO: Server startup in 778 ms

28 个解决方案

#1


该回复于2015-05-26 13:06:01被管理员删除

#2


org.apache.commons.logging.LogFactory 这个类找不到,看看你的包导对了没有

#3


引用 2 楼 zhj92lxs 的回复:
org.apache.commons.logging.LogFactory 这个类找不到,看看你的包导对了没有

#4


java.lang.NoClassDefFoundError: org.apache.commons.logging.LogFactory 

这个包名字是commons-logging-x.x.x.jar,导入一下

#5


Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory ,少了这个包吧,apache有个log包的,加进去就应该可以了

#6


引用 5 楼 yuanxulong198010 的回复:
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory ,少了这个包吧,apache有个log包的,加进去就应该可以了

#7


帮顶

#8


配置文件 ContextLoaderListener 重复配置 

检查配置文件了

#9


谢谢各位老大:导入commons-logging-1.0.4.jar以后又出现如下的错误:
2008-6-24 9:29:49 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:quickstart' did not find a matching property.
2008-6-24 9:29:49 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: F:\webdevelop\ibm_sdk60\jre\bin;.;F:\webdevelop\ibm_sdk60\bin\..\jre\bin\j9vm;F:\webdevelop\ibm_sdk60\bin\..\jre\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\PROGRA~1\Borland\Delphi6\Bin;C:\PROGRA~1\Borland\Delphi6\Projects\Bpl;F:\webdevelop\ibm_sdk60\bin;
2008-6-24 9:29:49 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
2008-6-24 9:29:49 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 650 ms
2008-6-24 9:29:49 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
2008-6-24 9:29:49 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.16
2008-6-24 9:29:50 org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener "org.springframework.web.context.ContextLoaderListener" is already configured for this context. The duplicate definition has been ignored.
2008-6-24 9:29:50 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
2008-6-24 9:29:50 org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
2008-6-24 9:29:50 org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.web.context.support.XmlWebApplicationContext@367a367a: display name [Root WebApplicationContext]; startup date [Tue Jun 24 09:29:50 CST 2008]; root of context hierarchy
2008-6-24 9:29:50 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
2008-6-24 9:29:50 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
INFO: Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@367a367a]: org.springframework.beans.factory.support.DefaultListableBeanFactory@3b203b20
2008-6-24 9:29:50 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3b203b20: defining beans [org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor#0,personService,entityManagerFactory,dataSource,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.config.internalTransactionAdvisor,personAction]; root of factory hierarchy
2008-6-24 9:29:50 org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
Throwable occurred: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Initialization of bean failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(AccessController.java:224)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:597)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:366)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
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:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:59)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:39)
at java.lang.reflect.Method.invoke(Method.java:612)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.NullPointerException
at org.springframework.core.GenericTypeResolver.getTypeVariableMap(GenericTypeResolver.java:144)
at org.springframework.core.GenericTypeResolver.resolveReturnType(GenericTypeResolver.java:93)
at org.springframework.beans.GenericTypeAwarePropertyDescriptor.getPropertyType(GenericTypeAwarePropertyDescriptor.java:58)
at java.beans.PropertyDescriptor.setWriteMethod(Unknown Source)
at java.beans.PropertyDescriptor.<init>(Unknown Source)
at org.springframework.beans.GenericTypeAwarePropertyDescriptor.<init>(GenericTypeAwarePropertyDescriptor.java:47)
at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:250)
at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:144)
at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:252)
at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:259)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterPropertyDescriptorsForDependencyCheck(AbstractAutowireCapableBeanFactory.java:1131)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:990)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470)
... 29 more

#10


2008-6-24 9:29:50 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
Throwable occurred: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Initialization of bean failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(AccessController.java:224)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:597)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:366)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
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:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:59)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:39)
at java.lang.reflect.Method.invoke(Method.java:612)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.NullPointerException
at org.springframework.core.GenericTypeResolver.getTypeVariableMap(GenericTypeResolver.java:144)
at org.springframework.core.GenericTypeResolver.resolveReturnType(GenericTypeResolver.java:93)
at org.springframework.beans.GenericTypeAwarePropertyDescriptor.getPropertyType(GenericTypeAwarePropertyDescriptor.java:58)
at java.beans.PropertyDescriptor.setWriteMethod(Unknown Source)
at java.beans.PropertyDescriptor.<init>(Unknown Source)
at org.springframework.beans.GenericTypeAwarePropertyDescriptor.<init>(GenericTypeAwarePropertyDescriptor.java:47)
at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:250)
at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:144)
at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:252)
at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:259)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterPropertyDescriptorsForDependencyCheck(AbstractAutowireCapableBeanFactory.java:1131)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:990)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470)
... 29 more
2008-6-24 9:29:50 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
2008-6-24 9:29:50 org.apache.catalina.core.StandardContext start
SEVERE: Context [/quickstart] startup failed due to previous errors
2008-6-24 9:29:50 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
2008-6-24 9:29:50 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
2008-6-24 9:29:50 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
2008-6-24 9:29:50 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/32  config=null
2008-6-24 9:29:50 org.apache.catalina.startup.Catalina start
INFO: Server startup in 1327 ms

#11


顶,Caused by: java.lang.NullPointerException 
根据上面的信息看,貌似在初始化容器失败,

#13


引用 2 楼 zhj92lxs 的回复:
org.apache.commons.logging.LogFactory 这个类找不到,看看你的包导对了没有

#14


Setting property 'source' to 'org.eclipse.jst.j2ee.server:quickstart' did not find a matching property. 

找找你的这个配置。

#15


检查一下环境变量看看

#16


少包吧

配置

#17


把你的applicationContext.xml拷贝出来看看

#18


applicationContext.xml内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

    <bean
        class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />

    <bean id="personService" class="quickstart.service.PersonServiceImpl" />

    <bean id="entityManagerFactory"
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="jpaVendorAdapter">
            <bean
                class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                <property name="database" value="MYSQL" />
                <property name="showSql" value="true" />
            </bean>
        </property>
    </bean>

    <bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://localhost:3306/quickstart" />
        <property name="username" value="root" />
        <property name="password" value="root" />
    </bean>

    <bean id="transactionManager"
        class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>

    <tx:annotation-driven transaction-manager="transactionManager" />

    <bean id="personAction" scope="prototype"
        class="quickstart.action.PersonAction">
        <constructor-arg ref="personService" />
    </bean>
</beans>

#19


web.xml 

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="person" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>person</display-name>
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>
            org.apache.struts2.dispatcher.FilterDispatcher
        </filter-class>
    </filter>

    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>


    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
  
</web-app>

#20


导入的jar
antlr-2.7.6.jar
asm.jar
asm-attrs.jar
cglib-2.1.3.jar
commons-collections-2.1.1.jar
commons-logging-1.0.4.jar
commons-logging-api-1.1.jar
dom4j-1.6.1.jar
ehcache-1.2.3.jar
ejb3-persistence.jar
freemarker-2.3.8.jar
hibernate3.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-entitymanager.jar
javassist.jar
jboss-archive-browsing.jar
jdbc2_0.stdext.jar
jta.jar
log4j-1.2.11.jar
mysql-connector-java-5.0.8-bin.jar
ognl-2.6.11.jar
spring.jar
struts2-core-2.0.11.1.jar
struts2-spring-plugin-2.0.11.1.jar
struts2-tiles-plugin-2.0.11.1.jar
titles-api-2.0.4.jar
titles-core-2.0.4.jar
titles-jsp-2.0.4.jar
xml-apis.jar
xwork-2.0.4.jar

#21


怎么感觉缺少配置呢
<bean id="personService" class="quickstart.service.PersonServiceImpl" /> 
里面你是否用了DAO,如果用了,没看到配置

如果没用,那么这里你应该注入entityManagerFactory呀,否则你是如何用entityManagerFactory来做增删改查的呢

#22


错误信息:
2008-6-24 10:43:27 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:quickstart' did not find a matching property.
2008-6-24 10:43:27 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: F:\webdevelop\ibm_sdk60\jre\bin;.;F:\webdevelop\ibm_sdk60\bin\..\jre\bin\j9vm;F:\webdevelop\ibm_sdk60\bin\..\jre\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\PROGRA~1\Borland\Delphi6\Bin;C:\PROGRA~1\Borland\Delphi6\Projects\Bpl;F:\webdevelop\ibm_sdk60\bin;
2008-6-24 10:43:27 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
2008-6-24 10:43:27 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 649 ms
2008-6-24 10:43:27 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
2008-6-24 10:43:27 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.16
2008-6-24 10:43:28 org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener "org.springframework.web.context.ContextLoaderListener" is already configured for this context. The duplicate definition has been ignored.

log4j:WARN No appenders could be found for logger (org.springframework.util.ClassUtils).
log4j:WARN Please initialize the log4j system properly.

上面红色部分是否影响?

2008-6-24 10:43:28 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
2008-6-24 10:43:28 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
Throwable occurred: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Initialization of bean failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(AccessController.java:224)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:597)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:366)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
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:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:59)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:39)
at java.lang.reflect.Method.invoke(Method.java:612)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.NullPointerException
at org.springframework.core.GenericTypeResolver.getTypeVariableMap(GenericTypeResolver.java:144)
at org.springframework.core.GenericTypeResolver.resolveReturnType(GenericTypeResolver.java:93)
at org.springframework.beans.GenericTypeAwarePropertyDescriptor.getPropertyType(GenericTypeAwarePropertyDescriptor.java:58)
at java.beans.PropertyDescriptor.setWriteMethod(Unknown Source)
at java.beans.PropertyDescriptor.<init>(Unknown Source)
at org.springframework.beans.GenericTypeAwarePropertyDescriptor.<init>(GenericTypeAwarePropertyDescriptor.java:47)
at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:250)
at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:144)
at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:252)
at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:259)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterPropertyDescriptorsForDependencyCheck(AbstractAutowireCapableBeanFactory.java:1131)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:990)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470)
... 29 more
2008-6-24 10:43:28 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
2008-6-24 10:43:28 org.apache.catalina.core.StandardContext start
SEVERE: Context [/quickstart] startup failed due to previous errors
2008-6-24 10:43:28 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
2008-6-24 10:43:28 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
2008-6-24 10:43:29 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
2008-6-24 10:43:29 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/46  config=null
2008-6-24 10:43:29 org.apache.catalina.startup.Catalina start
INFO: Server startup in 1280 ms

#23


我是刚刚学习,最近有个web项目.我看看了,就发现了这个代码感觉还可以,就试试。

关于struts spring hibernate等基础知识不是很了解只是看该代码试试

#24


那句红色的没什么影响,建议楼主还是自己一点一点配置出个例子吧

#25


异常太长打...

#26


自己解决

#27


log4j:WARN No appenders could be found for logger (org.springframework.util.ClassUtils). 
log4j:WARN Please initialize the log4j system properly. 

这个异常你可以不管他
不会影响你整个项目的

#28


引用 27 楼 god3626 的回复:
log4j:WARN No appenders could be found for logger (org.springframework.util.ClassUtils).
 log4j:WARN Please initialize the log4j system properly.

 这个异常你可以不管他
 不会影响你整个项目的


程序员为什么明明知道吸烟有害健康还是要吸,因为程序员不管WARN

#1


该回复于2015-05-26 13:06:01被管理员删除

#2


org.apache.commons.logging.LogFactory 这个类找不到,看看你的包导对了没有

#3


引用 2 楼 zhj92lxs 的回复:
org.apache.commons.logging.LogFactory 这个类找不到,看看你的包导对了没有

#4


java.lang.NoClassDefFoundError: org.apache.commons.logging.LogFactory 

这个包名字是commons-logging-x.x.x.jar,导入一下

#5


Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory ,少了这个包吧,apache有个log包的,加进去就应该可以了

#6


引用 5 楼 yuanxulong198010 的回复:
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory ,少了这个包吧,apache有个log包的,加进去就应该可以了

#7


帮顶

#8


配置文件 ContextLoaderListener 重复配置 

检查配置文件了

#9


谢谢各位老大:导入commons-logging-1.0.4.jar以后又出现如下的错误:
2008-6-24 9:29:49 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:quickstart' did not find a matching property.
2008-6-24 9:29:49 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: F:\webdevelop\ibm_sdk60\jre\bin;.;F:\webdevelop\ibm_sdk60\bin\..\jre\bin\j9vm;F:\webdevelop\ibm_sdk60\bin\..\jre\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\PROGRA~1\Borland\Delphi6\Bin;C:\PROGRA~1\Borland\Delphi6\Projects\Bpl;F:\webdevelop\ibm_sdk60\bin;
2008-6-24 9:29:49 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
2008-6-24 9:29:49 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 650 ms
2008-6-24 9:29:49 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
2008-6-24 9:29:49 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.16
2008-6-24 9:29:50 org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener "org.springframework.web.context.ContextLoaderListener" is already configured for this context. The duplicate definition has been ignored.
2008-6-24 9:29:50 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
2008-6-24 9:29:50 org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
2008-6-24 9:29:50 org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.web.context.support.XmlWebApplicationContext@367a367a: display name [Root WebApplicationContext]; startup date [Tue Jun 24 09:29:50 CST 2008]; root of context hierarchy
2008-6-24 9:29:50 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
2008-6-24 9:29:50 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
INFO: Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@367a367a]: org.springframework.beans.factory.support.DefaultListableBeanFactory@3b203b20
2008-6-24 9:29:50 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3b203b20: defining beans [org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor#0,personService,entityManagerFactory,dataSource,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.config.internalTransactionAdvisor,personAction]; root of factory hierarchy
2008-6-24 9:29:50 org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
Throwable occurred: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Initialization of bean failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(AccessController.java:224)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:597)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:366)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
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:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:59)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:39)
at java.lang.reflect.Method.invoke(Method.java:612)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.NullPointerException
at org.springframework.core.GenericTypeResolver.getTypeVariableMap(GenericTypeResolver.java:144)
at org.springframework.core.GenericTypeResolver.resolveReturnType(GenericTypeResolver.java:93)
at org.springframework.beans.GenericTypeAwarePropertyDescriptor.getPropertyType(GenericTypeAwarePropertyDescriptor.java:58)
at java.beans.PropertyDescriptor.setWriteMethod(Unknown Source)
at java.beans.PropertyDescriptor.<init>(Unknown Source)
at org.springframework.beans.GenericTypeAwarePropertyDescriptor.<init>(GenericTypeAwarePropertyDescriptor.java:47)
at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:250)
at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:144)
at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:252)
at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:259)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterPropertyDescriptorsForDependencyCheck(AbstractAutowireCapableBeanFactory.java:1131)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:990)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470)
... 29 more

#10


2008-6-24 9:29:50 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
Throwable occurred: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Initialization of bean failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(AccessController.java:224)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:597)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:366)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
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:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:59)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:39)
at java.lang.reflect.Method.invoke(Method.java:612)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.NullPointerException
at org.springframework.core.GenericTypeResolver.getTypeVariableMap(GenericTypeResolver.java:144)
at org.springframework.core.GenericTypeResolver.resolveReturnType(GenericTypeResolver.java:93)
at org.springframework.beans.GenericTypeAwarePropertyDescriptor.getPropertyType(GenericTypeAwarePropertyDescriptor.java:58)
at java.beans.PropertyDescriptor.setWriteMethod(Unknown Source)
at java.beans.PropertyDescriptor.<init>(Unknown Source)
at org.springframework.beans.GenericTypeAwarePropertyDescriptor.<init>(GenericTypeAwarePropertyDescriptor.java:47)
at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:250)
at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:144)
at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:252)
at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:259)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterPropertyDescriptorsForDependencyCheck(AbstractAutowireCapableBeanFactory.java:1131)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:990)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470)
... 29 more
2008-6-24 9:29:50 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
2008-6-24 9:29:50 org.apache.catalina.core.StandardContext start
SEVERE: Context [/quickstart] startup failed due to previous errors
2008-6-24 9:29:50 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
2008-6-24 9:29:50 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
2008-6-24 9:29:50 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
2008-6-24 9:29:50 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/32  config=null
2008-6-24 9:29:50 org.apache.catalina.startup.Catalina start
INFO: Server startup in 1327 ms

#11


顶,Caused by: java.lang.NullPointerException 
根据上面的信息看,貌似在初始化容器失败,

#12


#13


引用 2 楼 zhj92lxs 的回复:
org.apache.commons.logging.LogFactory 这个类找不到,看看你的包导对了没有

#14


Setting property 'source' to 'org.eclipse.jst.j2ee.server:quickstart' did not find a matching property. 

找找你的这个配置。

#15


检查一下环境变量看看

#16


少包吧

配置

#17


把你的applicationContext.xml拷贝出来看看

#18


applicationContext.xml内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

    <bean
        class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />

    <bean id="personService" class="quickstart.service.PersonServiceImpl" />

    <bean id="entityManagerFactory"
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="jpaVendorAdapter">
            <bean
                class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                <property name="database" value="MYSQL" />
                <property name="showSql" value="true" />
            </bean>
        </property>
    </bean>

    <bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://localhost:3306/quickstart" />
        <property name="username" value="root" />
        <property name="password" value="root" />
    </bean>

    <bean id="transactionManager"
        class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>

    <tx:annotation-driven transaction-manager="transactionManager" />

    <bean id="personAction" scope="prototype"
        class="quickstart.action.PersonAction">
        <constructor-arg ref="personService" />
    </bean>
</beans>

#19


web.xml 

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="person" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>person</display-name>
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>
            org.apache.struts2.dispatcher.FilterDispatcher
        </filter-class>
    </filter>

    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>


    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
  
</web-app>

#20


导入的jar
antlr-2.7.6.jar
asm.jar
asm-attrs.jar
cglib-2.1.3.jar
commons-collections-2.1.1.jar
commons-logging-1.0.4.jar
commons-logging-api-1.1.jar
dom4j-1.6.1.jar
ehcache-1.2.3.jar
ejb3-persistence.jar
freemarker-2.3.8.jar
hibernate3.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-entitymanager.jar
javassist.jar
jboss-archive-browsing.jar
jdbc2_0.stdext.jar
jta.jar
log4j-1.2.11.jar
mysql-connector-java-5.0.8-bin.jar
ognl-2.6.11.jar
spring.jar
struts2-core-2.0.11.1.jar
struts2-spring-plugin-2.0.11.1.jar
struts2-tiles-plugin-2.0.11.1.jar
titles-api-2.0.4.jar
titles-core-2.0.4.jar
titles-jsp-2.0.4.jar
xml-apis.jar
xwork-2.0.4.jar

#21


怎么感觉缺少配置呢
<bean id="personService" class="quickstart.service.PersonServiceImpl" /> 
里面你是否用了DAO,如果用了,没看到配置

如果没用,那么这里你应该注入entityManagerFactory呀,否则你是如何用entityManagerFactory来做增删改查的呢

#22


错误信息:
2008-6-24 10:43:27 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:quickstart' did not find a matching property.
2008-6-24 10:43:27 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: F:\webdevelop\ibm_sdk60\jre\bin;.;F:\webdevelop\ibm_sdk60\bin\..\jre\bin\j9vm;F:\webdevelop\ibm_sdk60\bin\..\jre\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\PROGRA~1\Borland\Delphi6\Bin;C:\PROGRA~1\Borland\Delphi6\Projects\Bpl;F:\webdevelop\ibm_sdk60\bin;
2008-6-24 10:43:27 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
2008-6-24 10:43:27 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 649 ms
2008-6-24 10:43:27 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
2008-6-24 10:43:27 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.16
2008-6-24 10:43:28 org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener "org.springframework.web.context.ContextLoaderListener" is already configured for this context. The duplicate definition has been ignored.

log4j:WARN No appenders could be found for logger (org.springframework.util.ClassUtils).
log4j:WARN Please initialize the log4j system properly.

上面红色部分是否影响?

2008-6-24 10:43:28 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
2008-6-24 10:43:28 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
Throwable occurred: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': Initialization of bean failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(AccessController.java:224)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:597)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:366)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
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:578)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:59)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:39)
at java.lang.reflect.Method.invoke(Method.java:612)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.NullPointerException
at org.springframework.core.GenericTypeResolver.getTypeVariableMap(GenericTypeResolver.java:144)
at org.springframework.core.GenericTypeResolver.resolveReturnType(GenericTypeResolver.java:93)
at org.springframework.beans.GenericTypeAwarePropertyDescriptor.getPropertyType(GenericTypeAwarePropertyDescriptor.java:58)
at java.beans.PropertyDescriptor.setWriteMethod(Unknown Source)
at java.beans.PropertyDescriptor.<init>(Unknown Source)
at org.springframework.beans.GenericTypeAwarePropertyDescriptor.<init>(GenericTypeAwarePropertyDescriptor.java:47)
at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:250)
at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:144)
at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:252)
at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:259)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterPropertyDescriptorsForDependencyCheck(AbstractAutowireCapableBeanFactory.java:1131)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:990)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:470)
... 29 more
2008-6-24 10:43:28 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
2008-6-24 10:43:28 org.apache.catalina.core.StandardContext start
SEVERE: Context [/quickstart] startup failed due to previous errors
2008-6-24 10:43:28 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
2008-6-24 10:43:28 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
2008-6-24 10:43:29 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
2008-6-24 10:43:29 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/46  config=null
2008-6-24 10:43:29 org.apache.catalina.startup.Catalina start
INFO: Server startup in 1280 ms

#23


我是刚刚学习,最近有个web项目.我看看了,就发现了这个代码感觉还可以,就试试。

关于struts spring hibernate等基础知识不是很了解只是看该代码试试

#24


那句红色的没什么影响,建议楼主还是自己一点一点配置出个例子吧

#25


异常太长打...

#26


自己解决

#27


log4j:WARN No appenders could be found for logger (org.springframework.util.ClassUtils). 
log4j:WARN Please initialize the log4j system properly. 

这个异常你可以不管他
不会影响你整个项目的

#28


引用 27 楼 god3626 的回复:
log4j:WARN No appenders could be found for logger (org.springframework.util.ClassUtils).
 log4j:WARN Please initialize the log4j system properly.

 这个异常你可以不管他
 不会影响你整个项目的


程序员为什么明明知道吸烟有害健康还是要吸,因为程序员不管WARN