gpt4 book ai didi

mysql - 找不到表 : users during JBoss 6 startup

转载 作者:行者123 更新时间:2023-11-29 02:35:36 25 4
gpt4 key购买 nike

我对 JBoss、EJB3、hibernate 和 MySQL 还很陌生。

我正在尝试编写一个示例代码来使用 JPA 和 hibernate 来持久化一个 bean。

我正在关注 http://docs.jboss.org/hibernate/entitymanager/3.6/reference/en/html/ , 第二章 http://docs.jboss.org/hibernate/entitymanager/3.6/reference/en/html/configuration.html#d0e215关于如何配置 hibernate 。

完成 hibernate、MySQL 和 JBoss 的配置指南后,我收到以下错误(当我设置 <property name="hibernate.hbm2ddl.auto" value="validate"/> 时),这表明它无法连接/找到架构和/或表。

12:08:31,486 INFO [DatabaseMetadata] 表未找到:用户

如果我删除上述属性,那么 JBoss 将不会在启动期间提示,但一旦我尝试在 bean 上调用 persist() 时它就会提示该表不存在。

根据我对指南的理解,我不需要 orm.xml 或 hibernate.cfg.xml,只要我在 persistence.xml 文件中指出所有必要的属性,这就是我所做的(试图保持简单和可管理)。但是,经过几天的故障排除后,我无法成功保留该 bean。

这是我的 persistence.xml 文件:

<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="ejb3-persistence-unit" transaction-type="JTA">
<jta-data-source>java:/DefaultDS</jta-data-source>
<class>com.sf.bean.UserBean</class>
<properties>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/HRIS"/>
<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.connection.password" value="root"/>
<!-- JDBC connection pool (use the built-in) -->
<property name="hibernate.connection.pool_size" value="1"/>
<!-- SQL dialect -->
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<!-- Enable Hibernate's automatic session context management -->
<property name="hibernate.current_session_context_class" value="thread"/>
<!-- Disable the second-level cache -->
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
<!-- Echo all executed SQL to stdout -->
<property name="hibernate.use_sql_comments" value="true"/>
<property name="hibernate.show_sql" value="true"/>
<!-- validate the database schema on startup -->
<property name="hibernate.transaction.auto_close_session" value="true"/>
<property name="hibernate.hbm2ddl.auto" value="validate"/>
</properties>
</persistence-unit>
</persistence>

这是 server.log 的输出

    12:08:05,110 INFO  [AbstractServer] Starting: JBossAS [6.0.0.Final "Neo"]
12:08:06,914 INFO [ServerInfo] Java version: 1.6.0_24,Apple Inc.
12:08:06,915 INFO [ServerInfo] Java Runtime: Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
12:08:06,915 INFO [ServerInfo] Java VM: Java HotSpot(TM) 64-Bit Server VM 19.1-b02-334,Apple Inc.
12:08:06,915 INFO [ServerInfo] OS-System: Mac OS X 10.6.7,x86_64
12:08:06,916 INFO [ServerInfo] VM arguments: -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Xdebug -Xrunjdwp:transport=dt_socket,address=8989,suspend=n,server=y -Dhibernate.show_sql=true -Dprogram.name=run.sh -Djava.library.path=/Users/sfdeveloper/dev/jboss-6.0.0.Final/bin/native/lib64 -Djava.endorsed.dirs=/Users/sfdeveloper/dev/jboss-6.0.0.Final/lib/endorsed
12:08:06,978 INFO [JMXKernel] Legacy JMX core initialized
12:08:12,915 INFO [AbstractServerConfig] JBoss Web Services - Stack CXF Server 3.4.1.GA
.............
............. {lines deleted}
.............
12:08:26,628 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
12:08:26,866 INFO [PersistenceUnitDeployment] Starting persistence unit persistence.unit:unitName=jboss-ejb3-timerservice-mk2.jar#timerdb
12:08:27,133 INFO [Version] Hibernate Commons Annotations 3.2.0.Final
12:08:27,145 INFO [Environment] Hibernate 3.6.0.Final
**12:08:27,148 INFO [Environment] hibernate.properties not found**
12:08:27,152 INFO [Environment] Bytecode provider name : javassist
12:08:27,158 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
12:08:27,309 INFO [Version] Hibernate EntityManager 3.6.0.Final
12:08:27,342 INFO [Ejb3Configuration] Processing PersistenceUnitInfo [
name: timerdb
...]
12:08:27,399 WARN [Ejb3Configuration] Persistence provider caller does not implement the EJB3 spec correctly.PersistenceUnitInfo.getNewTempClassLoader() is null.
12:08:27,495 INFO [AnnotationBinder] Binding entity from annotated class: org.jboss.ejb3.timerservice.mk2.persistence.TimerEntity
12:08:27,608 INFO [EntityBinder] Bind entity org.jboss.ejb3.timerservice.mk2.persistence.TimerEntity on table timer
12:08:28,433 INFO [AnnotationBinder] Binding entity from annotated class: org.jboss.ejb3.timerservice.mk2.persistence.TimeoutMethod
12:08:28,442 INFO [EntityBinder] Bind entity org.jboss.ejb3.timerservice.mk2.persistence.TimeoutMethod on table timeout_method
12:08:28,511 INFO [AnnotationBinder] Binding entity from annotated class: org.jboss.ejb3.timerservice.mk2.persistence.CalendarTimerEntity
12:08:28,513 INFO [EntityBinder] Bind entity org.jboss.ejb3.timerservice.mk2.persistence.CalendarTimerEntity on table calendar_timer
12:08:28,590 INFO [Version] Hibernate Validator 3.1.0.GA
12:08:28,670 INFO [Version] Hibernate Validator 4.1.0.Final
12:08:28,693 INFO [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
12:08:28,936 INFO [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
12:08:28,942 INFO [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
12:08:28,950 INFO [HibernateSearchEventListenerRegister] Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
12:08:28,963 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
12:08:28,968 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
12:08:28,973 INFO [SettingsFactory] Database ->
name : HSQL Database Engine
version : 1.8.0
major : 1
minor : 8
12:08:28,974 INFO [SettingsFactory] Driver ->
name : HSQL Database Engine Driver
version : 1.8.0
major : 1
minor : 8
12:08:29,048 INFO [Dialect] Using dialect: org.hibernate.dialect.HSQLDialect
12:08:29,077 INFO [JdbcSupportLoader] Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
12:08:29,105 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransactionFactory
12:08:29,111 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
12:08:29,114 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
12:08:29,114 INFO [SettingsFactory] Automatic flush during beforeCompletion(): disabled
12:08:29,114 INFO [SettingsFactory] Automatic session close at end of transaction: disabled
12:08:29,114 INFO [SettingsFactory] JDBC batch size: 15
12:08:29,114 INFO [SettingsFactory] JDBC batch updates for versioned data: disabled
12:08:29,116 INFO [SettingsFactory] Scrollable result sets: enabled
12:08:29,116 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): disabled
12:08:29,116 INFO [SettingsFactory] Connection release mode: auto
12:08:29,118 INFO [SettingsFactory] Default batch fetch size: 1
12:08:29,118 INFO [SettingsFactory] Generate SQL with comments: disabled
12:08:29,118 INFO [SettingsFactory] Order SQL updates by primary key: disabled
12:08:29,118 INFO [SettingsFactory] Order SQL inserts for batching: disabled
12:08:29,119 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
12:08:29,123 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
12:08:29,123 INFO [SettingsFactory] Query language substitutions: {}
12:08:29,123 INFO [SettingsFactory] JPA-QL strict compliance: enabled
12:08:29,123 INFO [SettingsFactory] Second-level cache: enabled
12:08:29,124 INFO [SettingsFactory] Query cache: disabled
12:08:29,125 INFO [SettingsFactory] Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
12:08:29,134 INFO [RegionFactoryCacheProviderBridge] Cache provider: org.hibernate.cache.HashtableCacheProvider
12:08:29,136 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
12:08:29,136 INFO [SettingsFactory] Cache region prefix: persistence.unit:unitName=jboss-ejb3-timerservice-mk2.jar#timerdb
12:08:29,136 INFO [SettingsFactory] Structured second-level cache entries: disabled
12:08:29,149 INFO [SettingsFactory] Echoing all SQL to stdout
12:08:29,151 INFO [SettingsFactory] Statistics: disabled
12:08:29,151 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
12:08:29,151 INFO [SettingsFactory] Default entity-mode: pojo
12:08:29,151 INFO [SettingsFactory] Named query checking : enabled
12:08:29,151 INFO [SettingsFactory] Check Nullability in Core (should be disabled when Bean Validation is on): disabled
12:08:29,188 INFO [SessionFactoryImpl] building session factory
12:08:29,520 INFO [SessionFactoryObjectFactory] Factory name: persistence.unit:unitName=jboss-ejb3-timerservice-mk2.jar#timerdb
12:08:29,523 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
12:08:29,527 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: persistence.unit:unitName=jboss-ejb3-timerservice-mk2.jar#timerdb
12:08:29,527 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
12:08:29,537 INFO [SchemaUpdate] Running hbm2ddl schema update
12:08:29,538 INFO [SchemaUpdate] fetching database metadata
12:08:29,540 INFO [SchemaUpdate] updating schema
12:08:29,544 INFO [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
12:08:29,584 INFO [TableMetadata] table found: PUBLIC.TIMEOUTMETHOD_METHODPARAMS
12:08:29,584 INFO [TableMetadata] columns: [methodparams, timeoutmethod_id]
12:08:29,585 INFO [TableMetadata] foreign keys: [fkf294c964b7de2d8a]
12:08:29,585 INFO [TableMetadata] indexes: [sys_idx_55]
12:08:29,610 INFO [TableMetadata] table found: PUBLIC.CALENDAR_TIMER
12:08:29,610 INFO [TableMetadata] columns: [scheduleexprtimezone, scheduleexprsecond, autotimer, scheduleexprstartdate, scheduleexprminute, scheduleexprhour, timeoutmethod_id, id, scheduleexprdayofmonth, scheduleexprenddate, scheduleexprmonth, scheduleexprdayofweek, scheduleexpryear]
12:08:29,611 INFO [TableMetadata] foreign keys: [fk2b697f04b7de2d8a, fk2b697f04e6e6ef93]
12:08:29,611 INFO [TableMetadata] indexes: [sys_idx_57, sys_idx_48, sys_idx_59]
12:08:29,627 INFO [TableMetadata] table found: PUBLIC.TIMEOUT_METHOD
12:08:29,628 INFO [TableMetadata] columns: [id, methodname, declaringclass]
12:08:29,628 INFO [TableMetadata] foreign keys: []
12:08:29,628 INFO [TableMetadata] indexes: [sys_idx_50]
12:08:29,647 INFO [TableMetadata] table found: PUBLIC.TIMER
12:08:29,647 INFO [TableMetadata] columns: [id, previousrun, initialdate, repeatinterval, timedobjectid, timerstate, nextdate, info]
12:08:29,647 INFO [TableMetadata] foreign keys: []
12:08:29,648 INFO [TableMetadata] indexes: [sys_idx_52]
12:08:29,650 INFO [SchemaUpdate] schema update complete
12:08:29,656 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
12:08:29,879 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
12:08:29,920 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=MySQLDB' to JNDI name 'java:MySQLDB'
12:08:30,140 INFO [xnio] XNIO Version 2.1.0.CR2
12:08:30,149 INFO [nio] XNIO NIO Implementation Version 2.1.0.CR2
12:08:30,408 INFO [remoting] JBoss Remoting version 3.1.0.Beta2
12:08:30,569 INFO [TomcatDeployment] deploy, ctxPath=/
12:08:30,661 INFO [BeanInstantiatorDeployerBase] Installed org.jboss.ejb3.instantiator.impl.Ejb31SpecBeanInstantiator@7760116b into MC at org.jboss.ejb.bean.instantiator/Simple/Simple-server/UserServiceImpl
12:08:30,672 WARN [InterceptorInfoRepository] EJBTHREE-1852: InterceptorInfoRepository is deprecated
12:08:31,216 INFO [JBossASKernel] Created KernelDeployment for: Simple-server.jar
12:08:31,220 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3
12:08:31,221 INFO [JBossASKernel] with dependencies:
12:08:31,221 INFO [JBossASKernel] and demands:
12:08:31,221 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService; Required: Described
12:08:31,221 INFO [JBossASKernel] jboss-injector:topLevelUnit=Simple.ear,unit=Simple-server.jar,bean=UserServiceImpl; Required: Described
12:08:31,222 INFO [JBossASKernel] jboss-switchboard:appName=Simple,module=Simple-server,name=UserServiceImpl; Required: Create
12:08:31,222 INFO [JBossASKernel] persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit; Required: Described
12:08:31,222 INFO [JBossASKernel] and supplies:
12:08:31,222 INFO [JBossASKernel] jndi:Simple/UserServiceImpl/local-com.sf.service.user.UserService
12:08:31,222 INFO [JBossASKernel] jndi:UserServiceImpl
12:08:31,222 INFO [JBossASKernel] jndi:Simple/UserServiceImpl/local
12:08:31,222 INFO [JBossASKernel] Class:com.sf.service.user.UserService
12:08:31,227 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3) to KernelDeployment of: Simple-server.jar
12:08:31,366 INFO [PersistenceUnitDeployment] Starting persistence unit persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit
12:08:31,368 INFO [Ejb3Configuration] Processing PersistenceUnitInfo [
name: ejb3-persistence-unit
...]
12:08:31,369 WARN [Ejb3Configuration] Persistence provider caller does not implement the EJB3 spec correctly.PersistenceUnitInfo.getNewTempClassLoader() is null.
12:08:31,370 INFO [AnnotationBinder] Binding entity from annotated class: com.sf.bean.UserBean
12:08:31,370 INFO [EntityBinder] Bind entity com.sf.bean.UserBean on table users
12:08:31,379 INFO [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
12:08:31,386 INFO [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
12:08:31,389 INFO [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
12:08:31,405 INFO [HibernateSearchEventListenerRegister] Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
12:08:31,407 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
12:08:31,407 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
12:08:31,439 INFO [SettingsFactory] Database ->
name : HSQL Database Engine
version : 1.8.0
major : 1
minor : 8
12:08:31,440 INFO [SettingsFactory] Driver ->
name : HSQL Database Engine Driver
version : 1.8.0
major : 1
minor : 8
12:08:31,442 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
12:08:31,443 INFO [JdbcSupportLoader] Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
12:08:31,444 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransactionFactory
12:08:31,444 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
12:08:31,445 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
12:08:31,445 INFO [SettingsFactory] Automatic flush during beforeCompletion(): disabled
12:08:31,445 INFO [SettingsFactory] Automatic session close at end of transaction: enabled
12:08:31,445 INFO [SettingsFactory] JDBC batch size: 15
12:08:31,445 INFO [SettingsFactory] JDBC batch updates for versioned data: disabled
12:08:31,446 INFO [SettingsFactory] Scrollable result sets: enabled
12:08:31,446 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): disabled
12:08:31,446 INFO [SettingsFactory] Connection release mode: auto
12:08:31,446 INFO [SettingsFactory] Maximum outer join fetch depth: 2
12:08:31,446 INFO [SettingsFactory] Default batch fetch size: 1
12:08:31,447 INFO [SettingsFactory] Generate SQL with comments: enabled
12:08:31,447 INFO [SettingsFactory] Order SQL updates by primary key: disabled
12:08:31,447 INFO [SettingsFactory] Order SQL inserts for batching: disabled
12:08:31,447 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
12:08:31,448 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
12:08:31,448 INFO [SettingsFactory] Query language substitutions: {}
12:08:31,448 INFO [SettingsFactory] JPA-QL strict compliance: enabled
12:08:31,448 INFO [SettingsFactory] Second-level cache: enabled
12:08:31,449 INFO [SettingsFactory] Query cache: disabled
12:08:31,449 INFO [SettingsFactory] Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
12:08:31,449 INFO [RegionFactoryCacheProviderBridge] Cache provider: org.hibernate.cache.NoCacheProvider
12:08:31,452 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
12:08:31,453 INFO [SettingsFactory] Cache region prefix: persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit
12:08:31,453 INFO [SettingsFactory] Structured second-level cache entries: disabled
12:08:31,453 INFO [SettingsFactory] Echoing all SQL to stdout
12:08:31,453 INFO [SettingsFactory] Statistics: disabled
12:08:31,454 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
12:08:31,454 INFO [SettingsFactory] Default entity-mode: pojo
12:08:31,454 INFO [SettingsFactory] Named query checking : enabled
12:08:31,454 INFO [SettingsFactory] Check Nullability in Core (should be disabled when Bean Validation is on): disabled
12:08:31,461 INFO [SessionFactoryImpl] building session factory
12:08:31,472 INFO [SessionFactoryObjectFactory] Factory name: persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit
12:08:31,472 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
12:08:31,475 INFO [NamingHelper] Creating subcontext: persistence.unit:unitName=Simple.ear
12:08:31,476 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit
12:08:31,476 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
12:08:31,480 INFO [SchemaValidator] Running schema validator
12:08:31,480 INFO [SchemaValidator] fetching database metadata
12:08:31,482 INFO [DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
**12:08:31,486 INFO [DatabaseMetadata] table not found: users
12:08:31,488 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit state=Create: javax.persistence.PersistenceException: [PersistenceUnit: ejb3-persistence-unit] Unable to build EntityManagerFactory**
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:911) [:3.6.0.Final]
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) [:3.6.0.Final]
at org.jboss.jpa.builder.DefaultCEMFBuilder.build(DefaultCEMFBuilder.java:47) [:1.0.2-alpha-3]
at org.jboss.as.jpa.scanner.HackCEMFBuilder.build(HackCEMFBuilder.java:49) [:6.0.0.Final]
at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:275) [:1.0.2-alpha-3]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_24]
………..
at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at java.lang.Thread.run(Thread.java:680) [:1.6.0_24]
Caused by: org.hibernate.HibernateException: Missing table: users
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1310) [:3.6.0.Final]
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139) [:3.6.0.Final]
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:376) [:3.6.0.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842) [:3.6.0.Final]
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:902) [:3.6.0.Final]
... 79 more

12:08:31,541 INFO [service] Removing bootstrap log handlers
12:08:31,645 ERROR [ProfileServiceBootstrap] Failed to load profile:: org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "jboss-switchboard:appName=Simple,module=Simple-web" is missing the following dependencies:
Dependency "jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3" (should be in state "Installed", but is actually in state "PreInstall")
Deployment "jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3" is missing the following dependencies:
Dependency "<UNKNOWN jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3>" (should be in state "Installed", but is actually in state "** UNRESOLVED Demands 'persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit' **")
Deployment "jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3_endpoint" is missing the following dependencies:
Dependency "jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3" (should be in state "Installed", but is actually in state "PreInstall")
Deployment "jboss.web.deployment:war=/ejb3" is missing the following dependencies:
Dependency "jboss-switchboard:appName=Simple,module=Simple-web" (should be in state "Installed", but is actually in state "Deploy")

DEPLOYMENTS IN ERROR:
Deployment "persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit" is in error due to the following reason(s): org.hibernate.HibernateException: Missing table: users
Deployment "<UNKNOWN jboss.j2ee:ear=Simple.ear,jar=Simple-server.jar,name=UserServiceImpl,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'persistence.unit:unitName=Simple.ear/Simple-server.jar#ejb3-persistence-unit' **

at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1228) [:2.2.0.GA]
at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:905) [:2.2.0.GA]
at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:87) [:6.0.0.Final]
at org.jboss.profileservice.deployment.ProfileDeployerPluginRegistry.checkAllComplete(ProfileDeployerPluginRegistry.java:107) [:0.2.2]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:135) [:6.0.0.Final]
at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.Final]
at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]
at java.lang.Thread.run(Thread.java:680) [:1.6.0_24]

12:08:31,669 INFO [org.apache.coyote.http11.Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
12:08:31,672 INFO [org.apache.coyote.ajp.AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
12:08:31,672 INFO [org.jboss.bootstrap.impl.base.server.AbstractServer] JBossAS [6.0.0.Final "Neo"] Started in 26s:559ms

这是显示架构和表格的工作台屏幕截图: enter image description here

非常感谢任何帮助,- 旧金山的开发者。

最佳答案

  1. 您的数据库中没有表
  2. 您已设置hibernate.hbm2ddl.auto=validate

这意味着该异常是合乎逻辑的——hibernate 会尝试查找您的实体是否有它们对应的表,如果没有找到,则报告一个问题

要修复它,您有两种选择:

  1. 设置hibernate.hbm2ddl.auto=update。这将创建(和更新)数据库架构以匹配实体。
  2. 手动创建表格(不太可取,imo,但意见分歧)

关于mysql - 找不到表 : users during JBoss 6 startup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5532165/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com