最近正在学习spring3.0 但是配置文件怎么也看不懂 也不知道从哪儿开始进行配置?

解决方案 »

  1.   

    建议先从web.xml看。。然后spring的配置文件大概就是dao依赖sessionfactory。service依赖dao。。action依赖service、、、
      

  2.   

    2011-8-30 15:36:43 org.springframework.web.context.ContextLoader initWebApplicationContext
    严重: Context initialization failed
    org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [hibernate/hibernate.property] cannot be opened because it does not exist
    at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:78)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:624)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:599)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:398)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
    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:593)
    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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    Caused by: java.io.FileNotFoundException: class path resource [hibernate/hibernate.property] cannot be opened because it does not exist
    at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:141)
    at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:181)
    at org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:161)
    at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:69)
    ... 21 more
    2011-8-30 15:36:43 org.apache.catalina.core.StandardContext listenerStart
    严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [hibernate/hibernate.property] cannot be opened because it does not exist
    at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:78)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:624)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:599)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:398)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
    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:593)
    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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    Caused by: java.io.FileNotFoundException: class path resource [hibernate/hibernate.property] cannot be opened because it does not exist
    at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:141)
    at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:181)
    at org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:161)
    at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:69)
    ... 21 more
    2011-8-30 15:36:43 org.apache.catalina.core.StandardContext start
    严重: Error listenerStart
    2011-8-30 15:36:43 org.apache.catalina.core.StandardContext start
    严重: Context [/SpringMvc] startup failed due to previous errors
    2011-8-30 15:36:43 org.apache.catalina.core.ApplicationContext log
    信息: Closing Spring root WebApplicationContext
    2011-8-30 15:36:43 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
    严重: A web application created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [XML bean definition resources currently being loaded]) and a value of type [null] (value [null]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
    2011-8-30 15:36:43 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
    严重: A web application created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [Prototype beans currently in creation]) and a value of type [null] (value [null]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
      

  3.   

    我用spring 和hibernate 模仿着比人的程序写了代码但一起服务就报上面的异常 怎么就找不到hibernate.property的文件呢 我应该把hibernate.property放在哪儿啊
    applicationContext.xml里是这么写的,<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
    <list>
    <value>classpath:/hibernate/hibernate.property</value>
    </list>
    </property>
    我用的是eclipse4.0 
    我在conf下建了一个名为hibernate的文件夹折后把把hibernate的配置文件放里了
    我刚开是接触hibernate和spring  哪位朋友帮我看看?
      

  4.   

    在src下面建立文件夹hibernate,在此文件夹下放你的hibernate.property。
    我是根据你的配置文件说的哈。
      

  5.   

    把conf设置为源文件夹,与src一样,效果同楼上
      

  6.   

    org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [hibernate/hibernate.property] cannot be opened because it does not exist
    我试过了还是不行呢 还是这个异常 哎
      

  7.   

    org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [hibernate/hibernate.property] cannot be opened because it does not exist   我试过了放在conf下面也不行  这个异常应该就是找不到我的配置文件吧?  
       
      

  8.   

    你好,我也刚接触spring3 mvc做项目,一点头绪都没有,可以给我一个事例吗,谢谢!!QQ:394951514