Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jboss 7 Datasource configured correctly...But unable to connect

 
Vinit Parakh
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I have been successfully able to configure the datasource in jboss to mysql. But however when i deploy the ejb jar file in deplyoments...it does get deployed but i am getting the following error :




01:34:39,286 INFO [org.jboss.modules] JBoss Modules version 1.0.2.GA
01:34:39,982 INFO [org.jboss.msc] JBoss MSC version 1.0.1.GA
01:34:40,104 INFO [org.jboss.as] JBoss AS 7.0.2.Final "Arc" starting
01:34:42,453 WARN [org.jboss.as] No security realm defined for native management service, all access will be unrestricted.
01:34:42,481 INFO [org.jboss.as] creating http management service using network interface (management) port (9990)
01:34:43,011 WARN [org.jboss.as] No security realm defined for http management service, all access will be unrestricted.
01:34:43,108 INFO [org.jboss.as.logging] Removing bootstrap log handlers
01:34:43,149 INFO [org.jboss.as.connector.subsystems.datasources] (Controller Boot Thread) Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
01:34:43,182 INFO [org.jboss.as.connector.subsystems.datasources] (Controller Boot Thread) Deploying JDBC-compliant driver class org.h2.Driver (version 1.2)
01:34:43,224 INFO [org.jboss.as.clustering.infinispan.subsystem] (Controller Boot Thread) Activating Infinispan subsystem.
01:34:43,561 INFO [org.jboss.as.naming] (Controller Boot Thread) JBAS011800: Activating Naming Subsystem
01:34:43,595 INFO [org.jboss.as.naming] (MSC service thread 1-4) JBAS011802: Starting Naming Service
01:34:43,623 INFO [org.jboss.as.osgi] (Controller Boot Thread) JBAS011910: Activating OSGi Subsystem
01:34:43,702 INFO [org.jboss.as.security] (Controller Boot Thread) Activating Security Subsystem
01:34:43,721 INFO [org.jboss.remoting] (MSC service thread 1-3) JBoss Remoting version 3.2.0.Beta2
01:34:43,880 INFO [org.xnio] (MSC service thread 1-3) XNIO Version 3.0.0.Beta3
01:34:43,909 INFO [org.xnio.nio] (MSC service thread 1-3) XNIO NIO Implementation Version 3.0.0.Beta3
01:34:44,668 INFO [org.apache.catalina.core.AprLifecycleListener] (MSC service thread 1-3) The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;native
01:34:44,719 INFO [org.jboss.as.ee] (Controller Boot Thread) Activating EE subsystem
01:34:46,419 INFO [org.jboss.as.remoting] (MSC service thread 1-4) Listening on /127.0.0.1:9999
01:34:47,388 INFO [org.jboss.as.jmx.JMXConnectorService] (MSC service thread 1-1) Starting remote JMX connector
01:34:47,488 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-2) Starting Coyote HTTP/1.1 on http--0.0.0.0-8080
01:34:47,971 INFO [org.jboss.as.connector] (MSC service thread 1-3) Starting JCA Subsystem (JBoss IronJacamar 1.0.3.Final)
01:34:48,128 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) Bound data source [java:/mydb]
01:34:48,128 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) Bound data source [java:jboss/datasources/ExampleDS]
01:34:48,167 INFO [org.jboss.as.deployment] (MSC service thread 1-1) Started FileSystemDeploymentService for directory C:\Users\vinit\Desktop\jboss-as-web-7.0.2.Final\jboss-as-web-7.0.2.Final\standalone\deployments
01:34:48,247 INFO [org.jboss.as] (Controller Boot Thread) JBoss AS 7.0.2.Final "Arc" started in 9591ms - Started 98 of 153 services (55 services are passive or on-demand)
01:34:48,301 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "FirstEjb3Tutorial.jar"
01:34:48,465 INFO [org.jboss.jpa] (MSC service thread 1-4) read persistence.xml for FirstEjb3Tutorial
01:34:48,503 INFO [org.jboss.as.jpa] (MSC service thread 1-4) added javax.persistence.api, javaee.api, org.jboss.as.jpa, org.javassist dependencies to FirstEjb3Tutorial.jar
01:34:48,505 INFO [org.jboss.as.jpa] (MSC service thread 1-4) added (default provider) org.hibernate dependency to application deployment (since 1 PU(s) didn't specify jboss.as.jpa.providerModule)
01:34:48,506 INFO [org.jboss.as.jpa] (MSC service thread 1-4) added org.hibernate dependency to application deployment
01:34:48,737 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named BookTestBean in deployment unit deployment "FirstEjb3Tutorial.jar" are as follows:

java:global/FirstEjb3Tutorial/BookTestBean!de.laliluna.library.BookTestBeanRemote
java:app/FirstEjb3Tutorial/BookTestBean!de.laliluna.library.BookTestBeanRemote
java:module/BookTestBean!de.laliluna.library.BookTestBeanRemote
java:global/FirstEjb3Tutorial/BookTestBean!de.laliluna.library.BookTestBeanLocal
java:app/FirstEjb3Tutorial/BookTestBean!de.laliluna.library.BookTestBeanLocal
java:module/BookTestBean!de.laliluna.library.BookTestBeanLocal

01:34:51,379 ERROR [org.hibernate.tool.hbm2ddl.SchemaValidator] (MSC service thread 1-2) HHH00300:Could not complete schema validation: java.sql.SQLException: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/mydb
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:137)
at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:67) [hibernate-entitymanager-4.0.0.CR2.jar:4.0.0.CR2]
at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:50) [hibernate-core-4.0.0.CR2.jar:4.0.0.CR2]
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:146) [hibernate-core-4.0.0.CR2.jar:4.0.0.CR2]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:446) [hibernate-core-4.0.0.CR2.jar:4.0.0.CR2]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1722) [hibernate-core-4.0.0.CR2.jar:4.0.0.CR2]
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:76) [hibernate-entitymanager-4.0.0.CR2.jar:4.0.0.CR2]
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899) [hibernate-entitymanager-4.0.0.CR2.jar:4.0.0.CR2]
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:884) [hibernate-entitymanager-4.0.0.CR2.jar:4.0.0.CR2]
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) [hibernate-entitymanager-4.0.0.CR2.jar:4.0.0.CR2]
at org.jboss.as.jpa.service.PersistenceUnitService.createContainerEntityManagerFactory(PersistenceUnitService.java:143) [jboss-as-jpa-7.0.2.Final.jar:7.0.2.Final]
at org.jboss.as.jpa.service.PersistenceUnitService.start(PersistenceUnitService.java:77) [jboss-as-jpa-7.0.2.Final.jar:7.0.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [:1.6.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [:1.6.0]
at java.lang.Thread.run(Thread.java:619) [:1.6.0]
Caused by: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/mydb
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:394)
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:367)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:467)
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:129)
... 16 more
Caused by: javax.resource.ResourceException: IJ000658: Unexpected throwable while trying to create a connection: null
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:349)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:392)
at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:357)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:351)
... 19 more
Caused by: javax.resource.ResourceException: Could not create connection
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:277)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:235)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:706)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:321)
... 22 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'mydb'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [:1.6.0]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [:1.6.0]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [:1.6.0]
at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [:1.6.0]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:943)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4113)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1308)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2336)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2369)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2153)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [:1.6.0]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [:1.6.0]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [:1.6.0]
at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [:1.6.0]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:249)
... 25 more

01:34:51,654 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "FirstEjb3Tutorial.jar"

As it is seen the datasource has been bound but still it says unable to connect. What is it that i am doing wrong ? Do i need to create a database with the name mydb in mysql???
I am mew to jboss 7 as well as mysql . I was successfully able to run the same application on jboss 4.2 with oracle database. But now i would like to shift to mysql with jboss7.

Any kind of help or suggestions highly welcomed.


My persistence.xml file :

<?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" version="1.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

<persistence-unit name="FirstEjb3Tutorial">
<jta-data-source>java:/mydb</jta-data-source>
<properties>

<property name="hibernate.hbm2ddl.auto" value="validate"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.archive.autodetection" value="class"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect" />

</properties>
</persistence-unit>
</persistence>
Thank You in Advance,
Vectors.
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'mydb'


Do i need to create a database with the name mydb in mysql???


Yes. The server will not create a database for the application*. So you'll have to do it yourself.

* Hibernate can create tables for you in the database (but usually not recommended for production), but you still have to create atleast an empty database for that to happen.
 
Vinit Parakh
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank JaiKiran....Really appreciate your help....That helped and my earlier error is gone.

But i am getting a new error now, This is the error log...

18:26:28,295 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.persistenceunit."FirstEjb3Tutorial.jar#FirstEjb3Tutorial": org.jboss.msc.service.StartException in service jboss.persistenceunit."FirstEjb3Tutorial.jar#FirstEjb3Tutorial": Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [:1.6.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [:1.6.0]
at java.lang.Thread.run(Thread.java:619) [:1.6.0]

Caused by: javax.persistence.PersistenceException: [PersistenceUnit: FirstEjb3Tutorial] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:908)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:884)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.jboss.as.jpa.service.PersistenceUnitService.createContainerEntityManagerFactory(PersistenceUnitService.java:143)
at org.jboss.as.jpa.service.PersistenceUnitService.start(PersistenceUnitService.java:77)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
... 3 more

Caused by: org.hibernate.HibernateException: Missing table: REVINFO
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1263)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:446)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1722)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:76)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899)
... 9 more

My Persistence.xml :

<?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" version="1.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

<persistence-unit name="FirstEjb3Tutorial">
<provider>org.hibernate.ejb.HibernatePersistence</provider>

( I HAVE ADDED THIS LINE TO MY PERSISTENCE.XML AS IT WAS SUGGESTED ON ONE OF THE FORUMS TO AVOID THE FIRST ERROR...BUT TO NO USE......I AM STILL GETTING THE SAME ERROR )

<jta-data-source>java:/mydb</jta-data-source>
<properties>

<property name="hibernate.hbm2ddl.auto" value="validate"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.archive.autodetection" value="class"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect" />

<!-- property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" / -->


</properties>
</persistence-unit>
</persistence>

I guess there is some problem with the database(mydb) i created....but i am new to mysql.....
Please Help.

Thanks in Advance,
Vectors.
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Caused by: org.hibernate.HibernateException: Missing table: REVINFO


I'm in the process of trying to figure out what causes that issue, since it has already been reported more than once now.
 
Vinit Parakh
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey JaiKiran ,

Thanks a lot....I will be waiting for your reply. I guess there is some problem with the way I create database (mydb).
 
Vinit Parakh
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Jaikiran,

Did you get anything on revinfo table not found...I am still stuck at the same point.
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vinit Parakh wrote:
Did you get anything on revinfo table not found...I am still stuck at the same point.


http://community.jboss.org/message/634119#634119. You can also find a workaround in that thread.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic