[Persistence, JBoss/CMP, Hibernate, Database] - "Could not obtain connection metadata' when generating Hiber
by gbadavidson
I am attempting to use Hibernate with JSF/Facelets on the JBoss AS. When the application attempts to build the Hibernate Session Factory an error is thrown "Could not obtain connection metadata", yet the driver is listed a few lines eariler in the log. Here is the relevent lines from the log and then the Hibernate configuration file. :
|
| 10:13:20,146 INFO [Configuration] configuring from resource: /hibernate.cfg.xml
| 10:13:20,146 INFO [Configuration] Configuration resource: /hibernate.cfg.xml
| 10:13:20,209 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/person/Phone.hbm.xml
| 10:13:20,287 INFO [HbmBinder] Mapping class: person.Phone -> phone
| 10:13:20,302 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/person/Personrolexref.hbm.xml
| 10:13:20,302 INFO [HbmBinder] Mapping class: person.Personrolexref -> personrolexref
| 10:13:20,302 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/person/Personaddressxref.hbm.xml
| 10:13:20,334 INFO [HbmBinder] Mapping class: person.Personaddressxref -> personaddressxref
| 10:13:20,334 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/person/Role.hbm.xml
| 10:13:20,334 INFO [HbmBinder] Mapping class: person.Role -> role
| 10:13:20,334 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/person/Person.hbm.xml
| 10:13:20,349 INFO [HbmBinder] Mapping class: person.Person -> person
| 10:13:20,349 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/person/Address.hbm.xml
| 10:13:20,349 INFO [HbmBinder] Mapping class: person.Address -> address
| 10:13:20,349 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/person/Personcoursexref.hbm.xml
| 10:13:20,365 INFO [HbmBinder] Mapping class: person.Personcoursexref -> personcoursexref
| 10:13:20,365 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/person/Personphonexref.hbm.xml
| 10:13:20,365 INFO [HbmBinder] Mapping class: person.Personphonexref -> personphonexref
| 10:13:20,365 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/course/Coursecategoryxref.hbm.xml
| 10:13:20,365 INFO [HbmBinder] Mapping class: course.Coursecategoryxref -> coursecategoryxref
| 10:13:20,365 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/course/Course.hbm.xml
| 10:13:20,380 INFO [HbmBinder] Mapping class: course.Course -> course
| 10:13:20,380 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/course/Courseprogresshistory.hbm.xml
| 10:13:20,380 INFO [HbmBinder] Mapping class: course.Courseprogresshistory -> courseprogresshistory
| 10:13:20,380 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/course/Category.hbm.xml
| 10:13:20,396 INFO [HbmBinder] Mapping class: course.Category -> category
| 10:13:20,396 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/course/Visibility.hbm.xml
| 10:13:20,396 INFO [HbmBinder] Mapping class: course.Visibility -> visibility
| 10:13:20,396 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/course/Slide.hbm.xml
| 10:13:20,412 INFO [HbmBinder] Mapping class: course.Slide -> slide
| 10:13:20,412 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/course/Rating.hbm.xml
| 10:13:20,412 INFO [HbmBinder] Mapping class: course.Rating -> rating
| 10:13:20,412 INFO [Configuration] Configured SessionFactory: null
| 10:13:20,490 INFO [DriverManagerConnectionProvider] Using Hibernate built-in connection pool (not for production use!)
| 10:13:20,490 INFO [DriverManagerConnectionProvider] Hibernate connection pool size: 20
| 10:13:20,490 INFO [DriverManagerConnectionProvider] autocommit mode: false
| 10:13:20,505 INFO [DriverManagerConnectionProvider] using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/MiracleMind
| 10:13:20,505 INFO [DriverManagerConnectionProvider] connection properties: {user=root, password=root}
| 10:13:20,505 WARN [SettingsFactory] Could not obtain connection metadata
| java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/MiracleMind
| at java.sql.DriverManager.getConnection(Unknown Source)
| at java.sql.DriverManager.getConnection(Unknown Source)
| at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
| at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
| at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2063)
| at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1298)
| at com.bellecrestsoftware.hibernate.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:31)
| at com.bellecrestsoftware.hibernate.BaseHibernateDAO.getSession(BaseHibernateDAO.java:13)
| at com.bellecrestsoftware.person.PersonDAO.findByProperty(PersonDAO.java:89)
|
|
|
|
| <!DOCTYPE hibernate-configuration PUBLIC
| "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
| "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
|
| <!-- Generated by MyEclipse Hibernate Tools. -->
| <hibernate-configuration>
|
| <session-factory>
| <property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
| <property name="connection.username">root</property>
| <property name="connection.url">
| jdbc:mysql://localhost:3306/MiracleMind
| </property>
| <property name="dialect">
| org.hibernate.dialect.MySQLDialect
| </property>
| <property name="myeclipse.connection.profile">
| New MySQL
| </property>
| <property name="hbm2ddl.auto">update</property>
| <property name="connection.password">root</property>
| <property name="connection.driver_class">
| com.mysql.jdbc.Driver
| </property>
|
| <mapping resource="com/bellecrestsoftware/person/Phone.hbm.xml" />
| <mapping resource="com/bellecrestsoftware/person/Personrolexref.hbm.xml" />
| <mapping resource="com/bellecrestsoftware/person/Personaddressxref.hbm.xml" />
| <mapping resource="com/bellecrestsoftware/person/Role.hbm.xml" />
| <mapping resource="com/bellecrestsoftware/person/Person.hbm.xml" />
| <mapping resource="com/bellecrestsoftware/person/Address.hbm.xml" />
| <mapping resource="com/bellecrestsoftware/person/Personcoursexref.hbm.xml" />
| <mapping resource="com/bellecrestsoftware/person/Personphonexref.hbm.xml" />
| <mapping resource="com/bellecrestsoftware/course/Coursecategoryxref.hbm.xml" />
| <mapping resource="com/bellecrestsoftware/course/Course.hbm.xml" />
| <mapping resource="com/bellecrestsoftware/course/Courseprogresshistory.hbm.xml" />
| <mapping resource="com/bellecrestsoftware/course/Category.hbm.xml" />
| <mapping resource="com/bellecrestsoftware/course/Visibility.hbm.xml" />
| <mapping resource="com/bellecrestsoftware/course/Slide.hbm.xml" />
| <mapping resource="com/bellecrestsoftware/course/Rating.hbm.xml" />
|
| </session-factory>
|
| </hibernate-configuration>
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4224073#4224073
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4224073
15 years, 9 months
Deployment Errors on startup of JBOSS
by Mike Hancock
I've been trying for some time to install a working JBOSS (5.0.0.GA) without success. I've read the "Installation And Getting Started Guide" and tried to follow those instructions. I downloaded the zip file and extracted it per the guide above. I checked and added/revised environment variables, again per the guide above. I've searched the JBOSS forums for posts with similar issues - all to no avail. I would really appreciate some help with this - sample of stack trace below from boot.log:
org.jboss.deployers.spi.DeploymentException: Error deploying: file:/C:/jboss-5/jboss-5.0.0.GA/server/default/conf/bootstrap/vfs.xml
at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor.deploy(BeanMetaDataFactoryVisitor.java:136)
at org.jboss.system.server.profileservice.ProfileServiceBootstrap.initBootstrapMDs(ProfileServiceBootstrap.java:453)
at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:199)
at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
at org.jboss.Main.boot(Main.java:209)
at org.jboss.Main$1.run(Main.java:547)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.IllegalStateException: ClassLoader has not been set
at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit.getClassLoader(AbstractDeploymentUnit.java:152)
at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor.addBeanComponent(BeanMetaDataFactoryVisitor.java:60)
at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor.deploy(BeanMetaDataFactoryVisitor.java:126)
... 6 more
Mike G. Hancock
Revenue/ITR
mike.hancock(a)tn.gov
(615) 741-7274
15 years, 9 months
[Beginners Corner] - JBoss restart problem
by adnankhurram
Hi guys,
I am having a strange problem with my EJBs in jboss 5.0.1.
When i restart my server i get the following exception and it doesn't start my ejb.
| 14:13:09,759 ERROR [ProfileServiceBootstrap] Failed to load profile:
| java.lang.NullPointerException
| at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:775)
| at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:698)
| at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:304)
| at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
| at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
| at org.jboss.Main.boot(Main.java:209)
| at org.jboss.Main$1.run(Main.java:547)
| at java.lang.Thread.run(Unknown Source)
|
|
Any suggestions?
thanks,
Adnan
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4224068#4224068
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4224068
15 years, 9 months
[EJB 3.0] - Re: Web Beans + JPA
by epbernard
https://anonsvn.jboss.org/repos/hibernate/core/trunk/entitymanager/src/ma...
is your best shot.
Enumeration<URL> xmls = Thread.currentThread()
| .getContextClassLoader()
| .getResources( "META-INF/persistence.xml" );
| if ( ! xmls.hasMoreElements() ) {
| log.info( "Could not find any META-INF/persistence.xml file in the classpath");
| }
| while ( xmls.hasMoreElements() ) {
| URL url = xmls.nextElement();
| log.trace( "Analysing persistence.xml: {}", url );
| List<PersistenceMetadata> metadataFiles = PersistenceXmlLoader.deploy(
| url,
| integration,
| cfg.getEntityResolver(),
| PersistenceUnitTransactionType.JTA ); //might be RESOURCE_LOCAL in EE?
| for ( PersistenceMetadata metadata : metadataFiles ) {
| String provider = metadata.getProvider(); //could be used for a shortcut if Hibernate
| List<String> classes = metadata.getClasses();
| //same for mappingFiles can be orm.xml or hbm.xml with Hibernate
| Set<String> jarFiles = ...; //need to scan these for @Entity @Embedded @MappedSuperclass
| boolean exclude = metadata.getExcludeUnlistedClasses();
| //if exclude == true => do not scan @Entity @Embedded @MappedSuperclass in the *main* jar
|
| }
| }
you will also need orm.xml parsing and check for , <mapped-superclass > and
consider as the default package.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4224062#4224062
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4224062
15 years, 9 months