spring3+struts2+JPA配置时出现 Unable to find file 警告,求解答。

19 篇文章 0 订阅
15 篇文章 0 订阅

2012-04-21 16:51:10,984 WARN  org.hibernate.ejb.packaging.InputStreamZippedJarVisitor.doProcessElements:61 - Unable to find file (ignored): jndi:/localhost/yesplm2/
java.io.FileNotFoundException: jndi:/localhost/yesplm2/
 at org.apache.naming.resources.DirContextURLConnection.getInputStream(DirContextURLConnection.java:385)
 at java.net.URL.openStream(URL.java:1009)
 at org.hibernate.ejb.packaging.InputStreamZippedJarVisitor.doProcessElements(InputStreamZippedJarVisitor.java:57)
 at org.hibernate.ejb.packaging.AbstractJarVisitor.getMatchingEntries(AbstractJarVisitor.java:146)
 at org.hibernate.ejb.packaging.NativeScanner.getClassesInJar(NativeScanner.java:128)
 at org.hibernate.ejb.Ejb3Configuration.addScannedEntries(Ejb3Configuration.java:467)
 at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:828)
 at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:582)
 at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:72)
 at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
 at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:398)
 at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:275)
 at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:139)
 at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.<init>(PersistenceExceptionTranslationInterceptor.java:79)
 at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.<init>(PersistenceExceptionTranslationAdvisor.java:70)
 at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:99)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1439)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1408)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
 at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:710)
 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:410)
 at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
 at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
 at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
 at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
 at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1095)
 at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1617)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
 at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
 at java.util.concurrent.FutureTask.run(FutureTask.java:138)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:619)
2012-04-21 16:51:12,921 INFO  org.hibernate.tool.hbm2ddl.SchemaValidator.validate:121 - Running schema validator
2012-04-21 16:51:12,921 INFO  org.hibernate.tool.hbm2ddl.SchemaValidator.validate:129 - fetching database metadata
2012-04-21 16:51:12,968 INFO  org.hibernate.tool.hbm2ddl.TableMetadata.<init>:65 - table found: yespm.person
2012-04-21 16:51:12,968 INFO  org.hibernate.tool.hbm2ddl.TableMetadata.<init>:66 - columns: [first_name, last_name, emplid]

 

WEB-INF/web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="struts2springjpa" version="2.5">
  <display-name>Struts 2 Spring JPA Example</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  <filter>
    <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
    <filter-class>
            org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
        </filter-class>
  </filter>
  <filter-mapping>
    <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext.xml</param-value>
  </context-param>
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
</web-app>

 

META-INF/persistence.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistencehttp://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
             version="2.0">
    <!-- this persistence unit is for the web application -->
    <persistence-unit name="springJpaPersistenceUnit" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <non-jta-data-source>java:comp/env/jdbc/yespm</non-jta-data-source>
       
        <class>com.yesrj.ppm.global.system.model.Person</class>
  
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
            <property name="hibernate.hbm2ddl.auto" value="validate"/>
            <property name="hibernate.show_sql" value="true"/>
            <property name="hibernate.format_sql" value="true"/>
            <property name="hibernate.use_sql_comments" value="true" />
            <!--
   <property name="hibernate.connection.provider_class" value="org.hibernate.connection.ProxoolConnectionProvider"/>
   <property name="hibernate.proxool.pool_alias" value="MysqlPool"/>
   <property name="hibernate.proxool.xml" value="proxool.xml"/>
            -->
         </properties>
    </persistence-unit>

</persistence>

 

META-INF/proxool.xml

<?xml version="1.0" encoding="utf-8"?>
<something-else-entirely>
 <proxool>
  <alias>MysqlPool</alias>
  
  <driver-url>jdbc:mysql://localhost:3306/yespm</driver-url>
  <driver-class>com.mysql.jdbc.Driver</driver-class>
  <driver-properties>
   <property name="user" value="root" />
   <property name="password" value="root" />
  </driver-properties>
  
  <house-keeping-sleep-time>90000</house-keeping-sleep-time>
  <prototype-count>5</prototype-count>
  <maximum-connection-count>100</maximum-connection-count>
  <minimum-connection-count>10</minimum-connection-count>
 </proxool>
</something-else-entirely>

WEB-INF/classes/applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:jdbc="http://www.springframework.org/schema/jdbc"
       xsi:schemaLocation="
            http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/aop
            http://www.springframework.org/schema/aop/spring-aop.xsd
            http://www.springframework.org/schema/tx
            http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
            http://www.springframework.org/schema/jdbc
            http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context-3.0.xsd">
   
    <!-- scans the classpath for annotated components (including @Repostory
    and @Service  that will be auto-registered as Spring beans  -->         
    <context:component-scan base-package="com.yesrj.ppm.global.system" />

    <!-- methods or classes needing to run in a complete transaction will
    be annotated with Transactional -->
    <tx:annotation-driven />

  <!-- Creates a data source that can provide a connection to in-memory embedded database populated
 with test data
 see: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/ch12s08.html   -->
 
    <!-- This will ensure that hibernate or jpa exceptions are automatically translated into
         Spring's generic DataAccessException hierarchy for those classes annotated with Repository
         For example see PersonDaoJpa-->
    <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
   
    <!-- JPA Entity Manager Factory -->
    <bean id="entityManagerFactory"
          class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
          <property name="persistenceXmlLocation" value="META-INF/persistence.xml" />
       <property name="persistenceUnitName" value="springJpaPersistenceUnit" />     
 </bean>
   
    <!-- bean post-processor for JPA annotations -->
    <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />

 
    <!-- Transaction Config -->
    <bean id="transactionManager"
          class="org.springframework.orm.jpa.JpaTransactionManager">
          <property name="entityManagerFactory" ref="entityManagerFactory"/>
 </bean>
    <!-- use declarative transaction management  -->
    <tx:annotation-driven  transaction-manager="transactionManager"/>
 
 </beans>

 

 

WEB-INF/classes/struts.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

 <constant name="struts.devMode" value="true" />

 <package name="system" extends="struts-default">

  <interceptors>
   <interceptor-stack name="appDefaultStack">
    <interceptor-ref name="defaultStack">
     <param name="exception.logEnabled">true</param>
     <param name="exception.logLevel">ERROR</param>
    </interceptor-ref>
   </interceptor-stack>
  </interceptors>

  <default-interceptor-ref name="appDefaultStack" />

  <global-results>
   <result name="error">/error.jsp</result>
  </global-results>


  <global-exception-mappings>
   <exception-mapping exception="java.lang.Exception"
    result="error" />
  </global-exception-mappings>

  <action name="personFinder"
   class="com.yesrj.plm2.global.system.action.PersonFinder" method="execute">
   <result name="success">/personinfo.jsp</result>
  </action>

  <action name="allPersonsFinder"
   class="com.yesrj.plm2.global.system.action.AllPersonsFinder" method="execute">

   <result name="success">/personsinfo.jsp</result>

  </action>

  <action name="*PersonUpdate"
   class="com.yesrj.plm2.global.system.action.PersonUpdater" method="{1}">

   <result name="input">/inputpersonupdate.jsp</result>
   <result name="success">/personupdated.jsp</result>

  </action>

  <action name="personDelete"
   class="com.yesrj.plm2.global.system.action.PersonDeleter" method="execute">

   <result name="success">/persondeleted.jsp</result>

  </action>

  <action name="*PersonSave" class="com.yesrj.plm2.global.system.action.PersonSaver"
   method="{1}">

   <result name="input">/inputpersonsave.jsp</result>
   <result name="success">/personsaved.jsp</result>

  </action>
  
 </package>

</struts>

 

WEB-INF/classes/下还有log4j.xml和log4j.dtd,跟它们应该没关系吧。

 

求解答。

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值