openshift。不要部署WAR

时间:2015-02-14 21:40:08

标签: java hibernate tomcat openshift

我在openshift上创建了应用程序。 Tomcat 7 + maven + spring + hibernate + postgresql。 当我部署战争时,我得到一个没有信息的空白页面。

----------

   <?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:context="http://www.springframework.org/schema/context"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">

    <context:annotation-config/>
    <context:component-scan base-package="ru.marketirs.model"/>

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

    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">

        <property name="driverClassName" value="org.postgresql.Driver"/>

<!--        <property name="url" value="jdbc:postgresql://127.11.140.130:5432/test"/>
        <property name="username" value="admingsrszvi"/>
        <property name="password" value="pGCU-r-_raI2"/>-->



<!--    <property name="url" value="jdbc:postgresql://localhost:5433/marketirs"/>
        <property name="username" value="postgres"/>
        <property name="password" value="123"/>-->

        <property name="url" value="jdbc:postgresql://${env.OPENSHIFT_POSTGRESQL_DB_HOST}:${env.OPENSHIFT_POSTGRESQL_DB_PORT}/${env.OPENSHIFT_APP_NAME}"/>
        <property name="password" value="${env.OPENSHIFT_POSTGRESQL_DB_PASSWORD}"/>
        <property name="username" value="${env.OPENSHIFT_POSTGRESQL_DB_USERNAME}"/>

    </bean>

    <bean id="jpaDialect" class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/>

    <bean id="jpaVendorAdapter"
          class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
        <property name="database" value="POSTGRESQL"/>
        <property name="databasePlatform" value="org.hibernate.dialect.PostgreSQL9Dialect"/>
    </bean>

    <bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
          id="entityManagerFactory">
        <property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml"/>
        <property name="persistenceUnitName" value="ru.marketirs.model.persistence.unit"/>
        <property name="dataSource" ref="dataSource"/>
        <property name="jpaVendorAdapter" ref="jpaVendorAdapter"/>
        <property name="jpaDialect" ref="jpaDialect"/>
    </bean>

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

</bean


----------

persiste

    <?xml version="1.0" encoding="utf-8"?>
<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/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
             version="2.0">
    <persistence-unit name="ru.marketirs.model.persistence.unit">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>


        <properties>
            <property name="hibernate.hbm2ddl.auto" value="create"/>
        </properties>
    </persistence-unit>

</persistence>

mvc - dispather-servlet

    <beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">

    <mvc:annotation-driven/>
    <context:component-scan base-package="ru.marketirs.controllers"/>
    <!--<mvc:resources mapping="/resources/**" location="/" />-->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/pages/"/>
        <property name="suffix" value=".jsp"/>
    </bean>

    <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
       <property name="messageConverters">
           <list>
               <ref bean="jsonMessageConverter" />
           </list>
       </property>

    </bean>
    <bean id="jsonMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
</beans>

logs:

    SEVERE: Error getConfigured
Feb 14, 2015 3:48:55 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/ma] startup failed due to previous errors
Feb 14, 2015 3:48:55 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/openshift/54dfa48c4382ec78800000dc/app-root/runtime/dependencies/jbossews/webapps/ma.war has finished in 3,411 ms
Feb 14, 2015 3:48:55 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-127.2.136.129-8080"]
Feb 14, 2015 3:48:55 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3635 ms
Feb 14, 2015 3:56:54 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-127.2.136.129-8080"]
Feb 14, 2015 3:56:54 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Feb 14, 2015 3:56:54 PM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-127.2.136.129-8080"]
Feb 14, 2015 3:56:54 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-127.2.136.129-8080"]
Feb 14, 2015 3:57:11 PM org.apache.catalina.startup.Catalina addClusterRuleSet
INFO: Cluster RuleSet not found due to [java.lang.ClassNotFoundException: org.apache.catalina.ha.ClusterRuleSet]. Cluster configuration disabled.
"jbossews.log" 1236L, 107911C                                                      832,1         67%
Feb 14, 2015 3:48:53 PM org.apache.catalina.startup.ContextConfig parseWebXml
SEVERE: Occurred at line 12 column 15
Feb 14, 2015 3:48:54 PM org.apache.catalina.startup.ContextConfig configureStart
SEVERE: Marking this application unavailable due to previous error(s)
Feb 14, 2015 3:48:55 PM org.apache.tomcat.util.modeler.Registry registerComponent
SEVERE: Null component Catalina:type=DataSource,context=/ma,host=localhost,class=javax.sql.DataSource,name="jdbc/PostgreSQLDS"
Feb 14, 2015 3:48:55 PM org.apache.tomcat.util.modeler.Registry registerComponent
SEVERE: Null component Catalina:type=DataSource,context=/ma,host=localhost,class=javax.sql.DataSource,name="jdbc/MySQLDS"
Feb 14, 2015 3:48:55 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error getConfigured
Feb 14, 2015 3:48:55 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/ma] startup failed due to previous errors
Feb 14, 2015 3:48:55 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/openshift/54dfa48c4382ec78800000dc/app-root/runtime/dependencies/jbossews/webapps/ma.war has finished in 3,411 ms
Feb 14, 2015 3:48:55 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-127.2.136.129-8080"]
Feb 14, 2015 3:48:55 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3635 ms
Feb 14, 2015 3:56:54 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-127.2.136.129-8080"]
Feb 14, 2015 3:56:54 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Feb 14, 2015 3:56:54 PM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-127.2.136.129-8080"]
Feb 14, 2015 3:56:54 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-127.2.136.129-8080"]
Feb 14, 2015 3:57:11 PM org.apache.catalina.startup.Catalina addClusterRuleSet
INFO: Cluster RuleSet not found due to [java.lang.ClassNotFoundException: org.apache.catalina.ha.ClusterRuleSet]. Cluster configuration disabled.
Feb 14, 2015 3:57:11 PM org.apache.catalina.startup.Catalina addClusterRuleSet
INFO: Cluster RuleSet not found due to [java.lang.ClassNotFoundException: org.apache.catalina.ha.ClusterRuleSet]. Cluster configuration disabled.
Feb 14, 2015 3:57:12 PM 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: /opt/rh/postgresql92/root/usr/lib64:/usr/java/packages/lib/i386:/lib:/usr/lib
Feb 14, 2015 3:57:12 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-127.2.136.129-8080"]
Feb 14, 2015 3:57:12 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1754 ms
Feb 14, 2015 3:57:12 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Feb 14, 2015 3:57:12 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.54
Feb 14, 2015 3:57:13 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/openshift/54dfa48c4382ec78800000dc/app-root/runtime/dependencies/jbossews/webapps/ma.war
Feb 14, 2015 3:57:14 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
@
                                                                                                                                                                                          832,1         68%
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648)
        at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1561)
        at org.apache.catalina.startup.ContextConfig.parseWebXml(ContextConfig.java:1812)
        at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1250)
        at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:876)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:374)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5355)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1880)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet
        at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:849)
        at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:201)
        at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1063)
        ... 29 more
Feb 14, 2015 4:11:59 PM org.apache.catalina.startup.ContextConfig parseWebXml
SEVERE: Occurred at line 12 column 15
Feb 14, 2015 4:11:59 PM org.apache.catalina.startup.ContextConfig configureStart
SEVERE: Marking this application unavailable due to previous error(s)
Feb 14, 2015 4:12:01 PM org.apache.tomcat.util.modeler.Registry registerComponent
SEVERE: Null component Catalina:type=DataSource,context=/ma,host=localhost,class=javax.sql.DataSource,name="jdbc/PostgreSQLDS"
Feb 14, 2015 4:12:01 PM org.apache.tomcat.util.modeler.Registry registerComponent
SEVERE: Null component Catalina:type=DataSource,context=/ma,host=localhost,class=javax.sql.DataSource,name="jdbc/MySQLDS"
Feb 14, 2015 4:12:01 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error getConfigured
Feb 14, 2015 4:12:01 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/ma] startup failed due to previous errors
Feb 14, 2015 4:12:02 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/openshift/54dfa48c4382ec78800000dc/app-root/runtime/dependencies/jbossews/webapps/ma.war has finished in 4,571 ms
Feb 14, 2015 4:12:02 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-127.2.136.129-8080"]
Feb 14, 2015 4:12:02 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4829 ms

我看到了什么 - http://main-marketirs.rhcloud.com/

更新 - 我从maven dep中删除了catalina.jar和servlet-api。

战争部署,但我得到502代理错误: 代理服务器从上游服务器收到无效响应。 代理服务器无法处理请求GET /.

原因:从远程服务器读取错误

日志:

INFO: Starting service Catalina


    1,1       Наверху
ssivated, specify a unique value for property 'hibernate.ejb.entitymanager_factory_name'
2015-02-15 11:39:36 INFO  ClassPathXmlApplicationContext:513 - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1ca4644: startup date [Sun Feb 15 11:39:36 EST 2015]; root of context hierarchy
2015-02-15 11:39:44 INFO  XmlBeanDefinitionReader:316 - Loading XML bean definitions from class path resource [META-INF/beans.xml]
2015-02-15 11:40:29 INFO  AutowiredAnnotationBeanPostProcessor:141 - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2015-02-15 11:40:36 INFO  DriverManagerDataSource:133 - Loaded JDBC driver: org.postgresql.Driver
2015-02-15 11:40:36 INFO  LocalContainerEntityManagerFactoryBean:332 - Building JPA container EntityManagerFactory for persistence unit 'ru.marketirs.model.persistence.unit'
2015-02-15 11:40:36 INFO  LogHelper:46 - HHH000204: Processing PersistenceUnitInfo [
        name: ru.marketirs.model.persistence.unit
        ...]
2015-02-15 11:41:14 INFO  Dialect:145 - HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL9Dialect
2015-02-15 11:41:14 INFO  LobCreatorBuilder:123 - HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2015-02-15 11:42:20 INFO  ASTQueryTranslatorFactory:47 - HHH000397: Using ASTQueryTranslatorFactory
                                                                                                                                                                                          2663,1      Внизу
2015-02-15 11:39:29 WARN  EntityManagerFactoryRegistry:80 - HHH000436: Entity manager factory name (ru.marketirs.model.persistence.unit) is already registered.  If entity manager will be clustered or passivated, specify a unique value for property 'hibernate.ejb.entitymanager_factory_name'
2015-02-15 11:39:36 INFO  ClassPathXmlApplicationContext:513 - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1ca4644: startup date [Sun Feb 15 11:39:36 EST 2015]; root of context hierarchy
2015-02-15 11:39:44 INFO  XmlBeanDefinitionReader:316 - Loading XML bean definitions from class path resource [META-INF/beans.xml]
2015-02-15 11:40:29 INFO  AutowiredAnnotationBeanPostProcessor:141 - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2015-02-15 11:40:36 INFO  DriverManagerDataSource:133 - Loaded JDBC driver: org.postgresql.Driver
2015-02-15 11:40:36 INFO  LocalContainerEntityManagerFactoryBean:332 - Building JPA container EntityManagerFactory for persistence unit 'ru.marketirs.model.persistence.unit'
2015-02-15 11:40:36 INFO  LogHelper:46 - HHH000204: Processing PersistenceUnitInfo [
        name: ru.marketirs.model.persistence.unit
        ...]
2015-02-15 11:41:14 INFO  Dialect:145 - HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL9Dialect
2015-02-15 11:41:14 INFO  LobCreatorBuilder:123 - HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2015-02-15 11:42:20 INFO  ASTQueryTranslatorFactory:47 - HHH000397: Using ASTQueryTranslatorFactory
                                                                                   2663,1      Внизу
2015-02-15 11:38:07 INFO  ClassPathXmlApplicationContext:513 - Refreshing org.springframework.contextt
.support.ClassPathXmlApplicationContext@19aec75: startup date [Sun Feb 15 11:38:07 EST 2015]; root off
 context hierarchy
2015-02-15 11:38:07 INFO  XmlBeanDefinitionReader:316 - Loading XML bean definitions from class path
resource [META-INF/beans.xml]
2015-02-15 11:38:13 INFO  AutowiredAnnotationBeanPostProcessor:141 - JSR-330 'javax.inject.Inject' ann
notation found and supported for autowiring
2015-02-15 11:38:14 INFO  DriverManagerDataSource:133 - Loaded JDBC driver: org.postgresql.Driver
2015-02-15 11:38:14 INFO  LocalContainerEntityManagerFactoryBean:332 - Building JPA container EntityMM
anagerFactory for persistence unit 'ru.marketirs.model.persistence.unit'
2015-02-15 11:38:14 INFO  LogHelper:46 - HHH000204: Processing PersistenceUnitInfo [
        name: ru.marketirs.model.persistence.unit
        ...]
2015-02-15 11:38:18 INFO  Dialect:145 - HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL9Dii
alect
2015-02-15 11:38:18 INFO  LobCreatorBuilder:123 - HHH000424: Disabling contextual LOB creation as cree
ateClob() method threw error : java.lang.reflect.InvocationTargetException
2015-02-15 11:38:23 INFO  ASTQueryTranslatorFactory:47 - HHH000397: Using ASTQueryTranslatorFactory
2015-02-15 11:39:12 INFO  SchemaExport:343 - HHH000227: Running hbm2ddl schema export
2015-02-15 11:39:13 ERROR SchemaExport:425 - HHH000389: Unsuccessful: alter table Product add constraa
int FK_4pyli7u3k5igu1skcb1g7x5xe foreign key (type_id) references Categorpr
2015-02-15 11:39:13 ERROR SchemaExport:426 - ERROR: constraint "fk_4pyli7u3k5igu1skcb1g7x5xe" for rell
ation "product" already exists
2015-02-15 11:39:13 INFO  SchemaExport:405 - HHH000230: Schema export complete
2015-02-15 11:39:29 WARN  EntityManagerFactoryRegistry:80 - HHH000436: Entity manager factory name (rr
u.marketirs.model.persistence.unit) is already registered.  If entity manager will be clustered or paa
ssivated, specify a unique value for property 'hibernate.ejb.entitymanager_factory_name'
2015-02-15 11:39:36 INFO  ClassPathXmlApplicationContext:513 - Refreshing org.springframework.contextt
.support.ClassPathXmlApplicationContext@1ca4644: startup date [Sun Feb 15 11:39:36 EST 2015]; root off
 context hierarchy
2015-02-15 11:39:44 INFO  XmlBeanDefinitionReader:316 - Loading XML bean definitions from class path
resource [META-INF/beans.xml]
2015-02-15 11:40:29 INFO  AutowiredAnnotationBeanPostProcessor:141 - JSR-330 'javax.inject.Inject' ann
notation found and supported for autowiring
2015-02-15 11:40:36 INFO  DriverManagerDataSource:133 - Loaded JDBC driver: org.postgresql.Driver
2015-02-15 11:40:36 INFO  LocalContainerEntityManagerFactoryBean:332 - Building JPA container EntityMM
anagerFactory for persistence unit 'ru.marketirs.model.persistence.unit'
2015-02-15 11:40:36 INFO  LogHelper:46 - HHH000204: Processing PersistenceUnitInfo [
        name: ru.marketirs.model.persistence.unit
        ...]
2015-02-15 11:41:14 INFO  Dialect:145 - HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL9Dii
alect
2015-02-15 11:41:14 INFO  LobCreatorBuilder:123 - HHH000424: Disabling contextual LOB creation as cree
ateClob() method threw error : java.lang.reflect.InvocationTargetException
2015-02-15 11:42:20 INFO  ASTQueryTranslatorFactory:47 - HHH000397: Using ASTQueryTranslatorFactory
                                                                                   2663,1      Внизу
2015-02-15 11:38:07 INFO  ClassPathXmlApplicationContext:513 - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@19aec75: startup date [Sun Feb 15 11:38:07 EST 2015]; root of context hierarchy
2015-02-15 11:38:07 INFO  XmlBeanDefinitionReader:316 - Loading XML bean definitions from class path resource [META-INF/beans.xml]
2015-02-15 11:38:13 INFO  AutowiredAnnotationBeanPostProcessor:141 - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2015-02-15 11:38:14 INFO  DriverManagerDataSource:133 - Loaded JDBC driver: org.postgresql.Driver
2015-02-15 11:38:14 INFO  LocalContainerEntityManagerFactoryBean:332 - Building JPA container EntityManagerFactory for persistence unit 'ru.marketirs.model.persistence.unit'
2015-02-15 11:38:14 INFO  LogHelper:46 - HHH000204: Processing PersistenceUnitInfo [
        name: ru.marketirs.model.persistence.unit
        ...]
2015-02-15 11:38:18 INFO  Dialect:145 - HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL9Dialect
2015-02-15 11:38:18 INFO  LobCreatorBuilder:123 - HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2015-02-15 11:38:23 INFO  ASTQueryTranslatorFactory:47 - HHH000397: Using ASTQueryTranslatorFactory
2015-02-15 11:39:12 INFO  SchemaExport:343 - HHH000227: Running hbm2ddl schema export
2015-02-15 11:39:13 ERROR SchemaExport:425 - HHH000389: Unsuccessful: alter table Product add constraint FK_4pyli7u3k5igu1skcb1g7x5xe foreign key (type_id) references Categorpr
2015-02-15 11:39:13 ERROR SchemaExport:426 - ERROR: constraint "fk_4pyli7u3k5igu1skcb1g7x5xe" for relation "product" already exists
2015-02-15 11:39:13 INFO  SchemaExport:405 - HHH000230: Schema export complete
2015-02-15 11:39:29 WARN  EntityManagerFactoryRegistry:80 - HHH000436: Entity manager factory name (ru.marketirs.model.persistence.unit) is already registered.  If entity manager will be clustered or passivated, specify a unique value for property 'hibernate.ejb.entitymanager_factory_name'
2015-02-15 11:39:36 INFO  ClassPathXmlApplicationContext:513 - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1ca4644: startup date [Sun Feb 15 11:39:36 EST 2015]; root of context hierarchy
2015-02-15 11:39:44 INFO  XmlBeanDefinitionReader:316 - Loading XML bean definitions from class path resource [META-INF/beans.xml]
2015-02-15 11:40:29 INFO  AutowiredAnnotationBeanPostProcessor:141 - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2015-02-15 11:40:36 INFO  DriverManagerDataSource:133 - Loaded JDBC driver: org.postgresql.Driver
2015-02-15 11:40:36 INFO  LocalContainerEntityManagerFactoryBean:332 - Building JPA container EntityManagerFactory for persistence unit 'ru.marketirs.model.persistence.unit'
2015-02-15 11:40:36 INFO  LogHelper:46 - HHH000204: Processing PersistenceUnitInfo [
        name: ru.marketirs.model.persistence.unit
        ...]
2015-02-15 11:41:14 INFO  Dialect:145 - HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL9Dialect
2015-02-15 11:41:14 INFO  LobCreatorBuilder:123 - HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
2015-02-15 11:42:20 INFO  ASTQueryTranslatorFactory:47 - HHH000397: Using ASTQueryTranslatorFactory

upd 3

https://github.com/tigraboris/MarketirsFull.git

可能是网络或pom文件有问题吗? 日志:     2015-02-15 15:24:31 INFO LocalContainerEntityManagerFactoryBean:332 - 为持久性单元'ru.marketirs.model.persistence.unit'构建JPA容器EntityManagerFactory     2015-02-15 15:24:31 INFO LogHelper:46 - HHH000204:处理PersistenceUnitInfo [         name:ru.marketirs.model.persistence.unit         ...]     2015-02-15 15:26:00 INFO方言:145 - HHH000400:使用方言:org.hibernate.dialect.PostgreSQL9Dialect     2015-02-15 15:26:00 INFO LobCreatorBuilder:123 - HHH000424:禁用上下文LOB创建为createClob()方法引发错误:java.lang.reflect.InvocationTargetException

2 个答案:

答案 0 :(得分:0)

您有CategoryProduct映射中的错误或不一致的数据库状态

 2015-02-15 11:39:12 INFO SchemaExport:343 - HHH000227: Running hbm2ddl schema export 
 2015-02-15 11:39:13 ERROR SchemaExport:425 - HHH000389: Unsuccessful: alter table Product add constraint FK_4pyli7u3k5igu1skcb1g7x5xe foreign key (type_id) references Categorpr 
 2015-02-15 11:39:13 ERROR SchemaExport:426 - ERROR: constraint "fk_4pyli7u3k5igu1skcb1g7x5xe" for relation "product" already exists

Hibernate尝试创建新的外键约束并失败,因为另一个已经存在。检查有关约束fk_4pyli7u3k5igu1skcb1g7x5xe的数据库。您可以尝试删除它并使用hbm2ddl = update让hibernate添加约束。另一个步骤可能是尝试hbm2ddl = verify。这样,hibernate会告诉你模型与db表关系相比有什么问题。

无论如何,你已经修复了你的初始问题,但现在面对另一个/下一个。

答案 1 :(得分:0)

问题是tomcat的未修正版本。我在版本8中构建,但服务器需要版本7。