代码之家  ›  专栏  ›  技术社区  ›  robyp7

将glassfish JEE8-weapp迁移到Wildfly10(Jboss)-eclipseLink不创建数据库表

  •  0
  • robyp7  · 技术社区  · 6 年前

    我正在wildfly 10中的jee8安全示例上安装一个开源项目,因为它只在glassfish中工作。 我的项目来源:

    https://github.com/robyp1/javaee8sec/

    您可以在src/jboss中找到配置文件和模块:

    https://github.com/robyp1/javaee8sec/tree/master/src/main/jboss

    我使用cargo maven 2插件下载一个wildfly10实例安装在我的 货物/目标目录。 我将hsqldb和eclipselink作为模块安装。 Wildfly正确地从EclipseLink jap持久性提供程序开始,而不是使用ibernate默认提供程序,但这似乎是我的持久性。xml不进行更改。

    为什么?

    <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
        <persistence-unit name="soteria" transaction-type="JTA">
            <jta-data-source>java:jboss/jdbc/soteria</jta-data-source>
            <!-- only for jboss -->
            <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
            <!-- TODO: parameterize this -->
            <properties>
                <property name="eclipselink.logging.level.sql" value="FINE"/>
                <property name="eclipselink.logging.parameters" value="true"/>
                <property name="eclipselink.logging.timestamp" value="true"/>
                <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
                <property name="eclipselink.ddl-generation.output-mode" value="database"/>
    
            </properties>
        </persistence-unit>
    </persistence>
    

    我将wildfly日志设置为调试:

    [INFO] [talledLocalContainer] 14:56:16,869 INFO  [org.jboss.as.jpa] (MSC service thread 1-6) WFLYJPA0002: Read persistence.xml for soteria
    [INFO] [talledLocalContainer] 14:56:16,884 DEBUG [io.undertow.session] (ServerService Thread Pool -- 65) Setting default session timeout to 1800
    [INFO] [talledLocalContainer] 14:56:16,894 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) persistence unit search for unitName=null referenced from class=id.swhp.javaee.soteria.business.account.boundary.AccountStore (annotation=@PersistenceContext)
    [INFO] [talledLocalContainer] 14:56:16,901 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) persistence unit search for unitName=null referenced from class=id.swhp.javaee.soteria.business.security.boundary.TokenScheduler (annotation=@PersistenceContext)
    [INFO] [talledLocalContainer] 14:56:16,901 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) persistence unit search for unitName=null referenced from class=id.swhp.javaee.soteria.business.security.boundary.TokenStore (annotation=@PersistenceContext)
    [INFO] [talledLocalContainer] 14:56:16,901 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) added javax.persistence.api:main dependency to javaee-soteria.war
    [INFO] [talledLocalContainer] 14:56:16,901 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) added org.jboss.as.jpa:main dependency to javaee-soteria.war
    [INFO] [talledLocalContainer] 14:56:16,901 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) added org.jboss.as.jpa.spi:main dependency to javaee-soteria.war
    [INFO] [talledLocalContainer] 14:56:16,901 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) added org.javassist:main dependency to javaee-soteria.war
    [INFO] [talledLocalContainer] 14:56:16,902 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) added org.eclipse.persistence:main dependency to javaee-soteria.war
    [INFO] [talledLocalContainer] 14:56:16,902 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) soteria is configured to use persistence provider 'org.eclipse.persistence.jpa.PersistenceProvider', adding an optional dependency on module 'org.eclipse.persistence'
    [INFO] [talledLocalContainer] 14:56:16,902 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) Adding dependency on PU service service jboss.persistenceunit."javaee-soteria.war#soteria" for component id.swhp.javaee.soteria.business.account.boundary.AccountStore
    [INFO] [talledLocalContainer] 14:56:16,902 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) Adding dependency on PU service service jboss.persistenceunit."javaee-soteria.war#soteria" for component javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV
    [INFO] [talledLocalContainer] 14:56:16,902 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) Adding dependency on PU service service jboss.persistenceunit."javaee-soteria.war#soteria" for component javax.servlet.jsp.jstl.tlv.ScriptFreeTLV
    [INFO] [talledLocalContainer] 14:56:16,902 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) Adding dependency on PU service service jboss.persistenceunit."javaee-soteria.war#soteria" for component id.swhp.javaee.soteria.business.security.control.PbkdfGenerator
    [INFO] [talledLocalContainer] 14:56:16,902 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) Adding dependency on PU service service jboss.persistenceunit."javaee-soteria.war#soteria" for component javax.faces.webapp.FacetTag
    [INFO] [talledLocalContainer] 14:56:16,902 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) Adding dependency on PU service service jboss.persistenceunit."javaee-soteria.war#soteria" for component org.omnifaces.ApplicationListener
    [INFO] [talledLocalContainer] 14:56:16,902 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) Adding dependency on PU service service jboss.persistenceunit."javaee-soteria.war#soteria" for component id.swhp.javaee.soteria.business.security.control.SHAGenerator
    [INFO] [talledLocalContainer] 14:56:16,902 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) Adding dependency on PU service service jboss.persistenceunit."javaee-soteria.war#soteria" for component javax.faces.webapp.FacesServlet
    [INFO] [talledLocalContainer] 14:56:16,903 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) Adding dependency on PU service service jboss.persistenceunit."javaee-soteria.war#soteria" for component id.swhp.javaee.soteria.application.servlet.AuthenticationFilter
    [INFO] [talledLocalContainer] 14:56:16,903 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) Adding dependency on PU service service jboss.persistenceunit."javaee-soteria.war#soteria" for component com.sun.faces.config.ConfigureListener
    [INFO] [talledLocalContainer] 14:56:16,903 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) Adding dependency on PU service service jboss.persistenceunit."javaee-soteria.war#soteria" for component id.swhp.javaee.soteria.business.security.boundary.TokenStore
    [INFO] [talledLocalContainer] 14:56:16,903 DEBUG [org.jboss.as.jpa] (MSC service thread 1-6) Adding dependency on PU service service jboss.persistenceunit."javaee-soteria.war#soteria" for component id.swhp.javaee.soteria.business.security.boundary.TokenScheduler
    [INFO] [talledLocalContainer] 14:56:16,904 DEBUG [org.jboss.as.server.deployment] (MSC service thread 1-6) Creating module: deployment.javaee-soteria.war:main
    [INFO] [talledLocalContainer] 14:56:16,904 DEBUG [org.jboss.as.server.deployment] (MSC service thread 1-6) Adding resource "/C:/Progetti/altri/javaee-soteria-master/target/cargo/configurations/wildfly10x/content/javaee-soteria.war" to module deployment.javaee-soteria.war:main
    [INFO] [talledLocalContainer] 14:56:16,906 DEBUG [org.jboss.as.server.deployment] (MSC service thread 1-6) Adding resource "/C:/Progetti/altri/javaee-soteria-master/target/cargo/configurations/wildfly10x/content/javaee-soteria.war/WEB-INF/classes" to module deployment.javaee-soteria.war:main
    [INFO] [talledLocalContainer] 14:56:16,906 DEBUG [org.jboss.as.server.deployment] (MSC service thread 1-6) Adding resource "/C:/Progetti/altri/javaee-soteria-master/target/cargo/configurations/wildfly10x/content/javaee-soteria.war/WEB-INF/lib/hsqldb-2.4.0.jar" to module deployment.javaee-soteria.war:main
    [INFO] [talledLocalContainer] 14:56:16,910 DEBUG [org.jboss.as.server.deployment] (MSC service thread 1-6) Adding resource "/C:/Progetti/altri/javaee-soteria-master/target/cargo/configurations/wildfly10x/content/javaee-soteria.war/WEB-INF/lib/javax.security.enterprise-1.0.jar" to module deployment.javaee-soteria.war:main
    [INFO] [talledLocalContainer] 14:56:16,919 DEBUG [io.undertow.request] (default I/O-3) Matched default handler path /cargocpc/index.html
    [INFO] [talledLocalContainer] 14:56:16,927 DEBUG [org.jboss.as.server.deployment] (MSC service thread 1-6) Adding resource "/C:/Progetti/altri/javaee-soteria-master/target/cargo/configurations/wildfly10x/content/javaee-soteria.war/WEB-INF/lib/javax.security.enterprise-api-1.1-b01-20170827.084736-2.jar" to module deployment.javaee-soteria.war:main
    [INFO] [talledLocalContainer] 14:56:16,938 DEBUG [org.jboss.as.server.deployment] (MSC service thread 1-6) Adding resource
    

    [INFO] [talledLocalContainer] 14:56:17,820 INFO  [org.eclipse.persistence.metadata] (ServerService Thread Pool -- 65) The access type for the persistent class [class id.swhp.javaee.soteria.business.security.entity.Token] is set to [FIELD].
    [INFO] [talledLocalContainer] 14:56:17,843 INFO  [org.eclipse.persistence.metadata] (ServerService Thread Pool -- 65) The target entity (reference) class for the many to one mapping element [field account] is being defaulted to: class id.swhp.javaee.soteria.business.account.entity.Account.
    [INFO] [talledLocalContainer] 14:56:17,843 INFO  [org.eclipse.persistence.metadata] (ServerService Thread Pool -- 65) The access type for the persistent class [class id.swhp.javaee.soteria.business.account.entity.Account] is set to [FIELD].
    [INFO] [talledLocalContainer] 14:56:17,849 INFO  [org.eclipse.persistence.metadata] (ServerService Thread Pool -- 65) The target entity (reference) class for the one to many mapping element [field tokens] is being defaulted to: class id.swhp.javaee.soteria.business.security.entity.Token.
    [INFO] [talledLocalContainer] 14:56:17,850 INFO  [org.eclipse.persistence.metadata] (ServerService Thread Pool -- 65) The alias name for the entity class [class id.swhp.javaee.soteria.business.security.entity.Token] is being defaulted to: Token.
    [INFO] [talledLocalContainer] 14:56:17,860 INFO  [org.eclipse.persistence.metadata] (ServerService Thread Pool -- 65) The column name for element [created] is being defaulted to: CREATED.
    [INFO] [talledLocalContainer] 14:56:17,861 INFO  [org.eclipse.persistence.metadata] (ServerService Thread Pool -- 65) The column name for element [description] is being defaulted to: DESCRIPTION.
    [INFO] [talledLocalContainer] 14:56:17,861 INFO  [org.eclipse.persistence.metadata] (ServerService Thread Pool -- 65) The column name for element [expiration] is being defaulted to: EXPIRATION.
    [INFO] [talledLocalContainer] 14:56:17,861 INFO  [org.eclipse.persistence.metadata] (ServerService Thread Pool -- 65) The column name for element [id] is being defaulted to: ID.
    [INFO] [talledLocalContainer] 14:56:17,865 INFO  [org.eclipse.persistence.metadata] (ServerService Thread Pool -- 65) The alias name for the entity class [class id.swhp.javaee.soteria.business.account.entity.Account] is being defaulted to: Account.
    [INFO] [talledLocalContainer] 14:56:17,865 INFO  [org.eclipse.persistence.metadata] (ServerService Thread Pool -- 65) The column name for element [password] is being defaulted to: PASSWORD.
    [INFO] [talledLocalContainer] 14:56:17,865 INFO  [org.eclipse.persistence.metadata] (ServerService Thread Pool -- 65) The column name for element [id] is being defaulted to: ID.
    [INFO] [talledLocalContainer] 14:56:17,865 INFO  [org.eclipse.persistence.metadata] (ServerService Thread Pool -- 65) The column name for element [email] is being defaulted to: EMAIL.
    [INFO] [talledLocalContainer] 14:56:17,865 INFO  [org.eclipse.persistence.metadata] (ServerService Thread Pool -- 65) The column name for element [username] is being defaulted to: USERNAME.
    [INFO] [talledLocalContainer] 14:56:17,876 INFO  [org.eclipse.persistence.metadata] (ServerService Thread Pool -- 65) The primary key column name for the mapping element [field account] is being defaulted to: ID.
    [INFO] [talledLocalContainer] 14:56:18,069 DEBUG [org.jboss.as.ejb3] (MSC service thread 1-3) Installing timer service for component TokenScheduler
    [INFO] [talledLocalContainer] 14:56:18,086 INFO  [org.jboss.weld.deployer] (MSC service thread 1-3) WFLYWELD0003: Processing weld deployment javaee-soteria.war
    [INFO] [talledLocalContainer] 14:56:18,125 DEBUG [org.jboss.weld.deployer] (MSC service thread 1-3) Discovered EXPLICIT BeanDeploymentArchive (javaee-soteria.war/WEB-INF/lib/omnifaces-2.6.4.jar)
    [INFO] [talledLocalContainer] 14:56:18,126 DEBUG [org.jboss.weld.deployer] (MSC service thread 1-3) Discovered EXPLICIT BeanDeploymentArchive (javaee-soteria.war/WEB-INF/classes)
    [INFO] [talledLocalContainer] 14:56:18,181 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-3) HV000001: Hibernate Validator 5.2.4.Final
    [INFO] [talledLocalContainer] 14:56:18,205 DEBUG [org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver] (MSC service thread 1-3) Found javax.persistence.Persistence on classpath containing 'getPersistenceUtil'. Assuming JPA 2 environment. Trying to instantiate JPA aware TraversableResolver
    [INFO] [talledLocalContainer] 14:56:18,206 DEBUG [org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver] (MSC service thread 1-3) Instantiated JPA aware TraversableResolver of type org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.
    

    您可以在此处找到所有日志服务器: https://github.com/robyp1/javaee8sec/blob/master/server_20180202.log 或更可读的格式: https://raw.githubusercontent.com/robyp1/javaee8sec/master/server_20180202.log

    wng是什么?

    非常感谢你

    罗伯托

    2 回复  |  直到 6 年前
        1
  •  0
  •   Simon Martinelli    6 年前

    WildFly使用Hiberate作为JPA提供者,而不是EclipseLink!

    因此,必须设置hibernate属性。hbm2ddl。像这样自动

    <property name="hibernate.hbm2ddl.auto" value="update"/>
    

    或者可以使用JPA标准属性javax。坚持不懈架构生成。数据库行动

    <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
    

    这将是可移植的,并且独立于JPA实现。

    您可以在Hibernate文档中找到所有选项:

    http://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html#configurations-hbmddl

        2
  •  0
  •   Chris Hunter-Johnson    6 年前

    可以在Wildfly上使用EclipseLink,这在参考指南中有记录。简单地说,您需要添加eclipse。然后,将jar作为模块设置一个属性,以便以下条目显示在standalone中。xml:

        <property name="eclipselink.archive.factory" value="org.jipijapa.eclipselink.JBossArchiveFactoryImpl"/>