0

Eclipse Indigo + JBoss 7.1+MySQLを使い始めました。私はJavaEEの初心者プログラマーです。だから、私はチュートリアルに問題があります:http ://www.youtube.com/watch?v=z55reyPqH44 。(これは、MySqlデータベースの使用方法の簡単な例です)。

したがって、EJB 3.1 JSF 2.0 JBOSS AS 7.1 MySQLを使用するこのプロジェクトと、これまたはこのような類似のプロジェクトをコンソールで実行している場合、「休止状態」に関する多くの問題が発生します。

コンソール:

15:12:46,808 WARN [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-3) HHH000181: No appropriate connection provider encountered, assuming application will be supplying connections 
15:12:46,914 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.persistenceunit."TestLogowanie.war#TestLogowanie": 
org.jboss.msc.service.StartException in service jboss.persistenceunit."TestLogowanie.war#TestLogowanie": Failed to start service 
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_01] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_01] 
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_01] 

Caused by: javax.persistence.PersistenceException: [PersistenceUnit: TestLogowanie] Unable to build EntityManagerFactory 
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914) 
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889) 
    at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) 
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) 
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) 
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] 
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] 
    ... 3 more 
Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set 
    at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:97) 
    at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:67) 
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:176) 
    at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75) 
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159) 
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) 
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71) 
    at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2270) 
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2266) 
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1735) 
    at org.hibernate.ejb.EntityManagerFactoryImpl.(EntityManagerFactoryImpl.java:84) 
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) 
    ... 9 more

15:12:47,142 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "TestLogowanie.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"TestLogowanie.war#TestLogowanie\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"TestLogowanie.war#TestLogowanie\": Failed to start service"}} 
15:12:47,191 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment TestLogowanie.war in 49ms 
15:12:47,193 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report JBAS014777: Services which failed to start: service jboss.persistenceunit."TestLogowanie.war#TestLogowanie": org.jboss.msc.service.StartException in service jboss.persistenceunit."TestLogowanie.war#TestLogowanie": Failed to start service
15:12:47,196 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"TestLogowanie.war#TestLogowanie\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"TestLogowanie.war#TestLogowanie\": Failed to start service"}}}}

申し訳ありませんが、今日コンピュータを再起動すると、問題がなくなったようです。私はコンソールのエラーを意味します。しかし、私は「HTTPステータス404」を持っているたびに。私のコンソールと画面を見てください。古いプロジェクト(CountryWebService)からJBossの開始サイトが削除される理由がわかりません。'SiteMYSQL'を起動したい。私はまだ別の問題を抱えています。JBoss 7.1サーバーを削除し、新しいTomcat 7を起動すると、JBossサイトで毎回ポート8080がビジーになります。たとえば8081などのTomcatのポートを変更する必要があります。

コンソール:

 10:55:37,826 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA
10:55:38,216 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA
10:55:38,277 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.0.Final "Thunder" starting
10:55:39,747 INFO  [org.xnio] XNIO Version 3.0.3.GA
10:55:39,760 INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
10:55:39,770 INFO  [org.jboss.remoting] JBoss Remoting version 3.2.2.GA
10:55:39,780 INFO  [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
10:55:39,901 INFO  [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
10:55:39,907 INFO  [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem
10:55:39,994 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
10:55:40,026 INFO  [org.jboss.as.connector] (MSC service thread 1-2) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.7.Final)
10:55:40,038 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem
10:55:40,048 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem
10:55:40,054 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem
10:55:40,073 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
10:55:40,074 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
10:55:40,134 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
10:55:40,373 INFO  [org.jboss.as.naming] (MSC service thread 1-3) JBAS011802: Starting Naming Service
10:55:40,379 INFO  [org.jboss.as.security] (MSC service thread 1-3) JBAS013100: Current PicketBox version=4.0.6.final
10:55:40,595 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-2) JBoss Web Services - Stack CXF Server 4.0.1.GA
10:55:40,706 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-2) JBAS015400: Bound mail session [java:jboss/mail/Default]
10:55:40,955 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-3) JBAS015012: Started FileSystemDeploymentService for directory C:\Users\Andrew\Desktop\Wojtek\Studia\sem7\jboss-as-7.1.0.Final\jboss-as-7.1.0.Final\standalone\deployments
10:55:40,974 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found SiteMYSQL.war in deployment directory. To trigger deployment create a file called SiteMYSQL.war.dodeploy
10:55:41,157 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100: Listening on localhost/127.0.0.1:4447
10:55:41,220 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-1) Starting Coyote HTTP/1.1 on http-localhost-127.0.0.1-8080
10:55:41,350 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [java:/Client]
10:55:41,351 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
10:55:41,415 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100: Listening on /127.0.0.1:9999
10:55:41,597 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "SiteMYSQL.war"
10:55:41,765 INFO  [org.jboss.as.jpa] (MSC service thread 1-1) JBAS011401: Read persistence.xml for SiteMYSQL
10:55:42,402 INFO  [org.jboss.as.jpa] (MSC service thread 1-3) JBAS011402: Starting Persistence Unit Service 'SiteMYSQL.war#SiteMYSQL'
10:55:42,619 INFO  [org.hibernate.annotations.common.Version] (MSC service thread 1-3) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
10:55:42,629 INFO  [org.hibernate.Version] (MSC service thread 1-3) HHH000412: Hibernate Core {4.0.1.Final}
10:55:42,650 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-3) HHH000206: hibernate.properties not found
10:55:42,657 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-3) HHH000021: Bytecode provider name : javassist
10:55:42,678 INFO  [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-3) HHH000204: Processing PersistenceUnitInfo [
    name: SiteMYSQL
    ...]
10:55:42,923 INFO  [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-3) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
10:55:43,208 INFO  [org.hibernate.dialect.Dialect] (MSC service thread 1-3) HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
10:55:43,230 INFO  [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC service thread 1-3) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory
10:55:43,236 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (MSC service thread 1-3) HHH000397: Using ASTQueryTranslatorFactory
10:55:43,281 INFO  [org.hibernate.validator.util.Version] (MSC service thread 1-3) Hibernate Validator 4.2.0.Final
10:55:43,694 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-3) Initializing Mojarra 2.1.5 (SNAPSHOT 20111202) for context '/SiteMYSQL'
10:55:46,140 INFO  [org.jboss.web] (MSC service thread 1-3) JBAS018210: Registering web context: /SiteMYSQL
10:55:46,147 INFO  [org.jboss.as] (MSC service thread 1-1) JBAS015874: JBoss AS 7.1.0.Final "Thunder" started in 8818ms - Started 179 of 253 services (72 services are passive or on-demand)
10:55:46,258 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "SiteMYSQL.war"

画面:

http://imgur.com/Peja7

4

2 に答える 2

0

persistence.xmlには、次のものがあります。

    <jta-data-source>jdbc:mysql://localhost:3306/Client</jta-data-source>

それは間違っている。これは JDBC URL ではなく、JBoss が提供するデータソースを識別する JNDI URL である必要があります。

私の(作業中の)プロジェクトでは、私はこれを持っていますpersistence.xml

    <jta-data-source>jdbc/catalogueDS</jta-data-source>

そしてこれでstandalone.xml

<subsystem xmlns="urn:jboss:domain:datasources:1.0">
    <datasources>
        <datasource jndi-name="java:/jdbc/catalogueDS" pool-name="catalogueDS" enabled="true" use-java-context="true">
            <connection-url>jdbc:h2:data/catalogueDS</connection-url>
            <driver>h2</driver>
            <security>
                <user-name />
                <password />
            </security>
            <statement>
                <track-statements>TRUE</track-statements>
            </statement>
        </datasource>

        <drivers>
            <driver name="h2" module="com.h2database.h2">
                <xa-datasource-class>org.h2.jdbcx.JdbcDataSource
                </xa-datasource-class>
            </driver>
        </drivers>
    </datasources>
</subsystem>

ご覧のとおり、 in はjta-data-sourcein とpersistence.xml一致しjndi-nameますstandalone.xml

于 2012-12-12T17:46:55.863 に答える
-1

Persistence.xml は、戦争のルート フォルダー META-INF に配置する必要があります (英語で申し訳ありません)。

于 2014-02-12T10:11:37.247 に答える