aspose file tools*
The moose likes JSF and the fly likes javax.faces.FacesException: The user must supply a JDBC connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "javax.faces.FacesException: The user must supply a JDBC connection" Watch "javax.faces.FacesException: The user must supply a JDBC connection" New topic
Author

javax.faces.FacesException: The user must supply a JDBC connection

Vikki Fiawoo
Greenhorn

Joined: Oct 22, 2010
Posts: 11
Good Morning,

I have been trying to get my JSF/JPA project to persist into my Oracle database but I am getting the following stack trace each time:

1218 [http-bio-1979-exec-7] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.2.0.Final
1328 [http-bio-1979-exec-7] INFO org.hibernate.cfg.Environment - Hibernate 3.6.4.Final
1343 [http-bio-1979-exec-7] INFO org.hibernate.cfg.Environment - hibernate.properties not found
1422 [http-bio-1979-exec-7] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
1468 [http-bio-1979-exec-7] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
3281 [http-bio-1979-exec-7] INFO org.hibernate.ejb.Version - Hibernate EntityManager 3.4.0.GA
4328 [http-bio-1979-exec-7] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.thebinaryheap.model.entity.BhUser
4547 [http-bio-1979-exec-7] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity com.thebinaryheap.model.entity.BhUser on table BH_USER
4750 [http-bio-1979-exec-7] INFO org.hibernate.cfg.Configuration - Hibernate Validator not found: ignoring
4843 [http-bio-1979-exec-7] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
4859 [http-bio-1979-exec-7] WARN org.hibernate.connection.UserSuppliedConnectionProvider - No connection properties specified - the user must supply JDBC connections
5109 [http-bio-1979-exec-7] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.Oracle10gDialect
5203 [http-bio-1979-exec-7] INFO org.hibernate.engine.jdbc.JdbcSupportLoader - Disabling contextual LOB creation as connection was null
5203 [http-bio-1979-exec-7] INFO org.hibernate.transaction.TransactionFactoryFactory - Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
5250 [http-bio-1979-exec-7] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
5250 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
5250 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
5265 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: disabled
5265 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): disabled
5265 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto
5265 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
5265 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
5265 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
5265 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled
5265 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
5343 [http-bio-1979-exec-7] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
5343 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
5343 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: enabled
5343 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
5343 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
5343 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
5343 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
5343 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
5359 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
5359 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
5359 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
5359 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled
5359 [http-bio-1979-exec-7] INFO org.hibernate.cfg.SettingsFactory - Check Nullability in Core (should be disabled when Bean Validation is on): enabled
5547 [http-bio-1979-exec-7] INFO org.hibernate.impl.SessionFactoryImpl - building session factory
5578 [http-bio-1979-exec-7] INFO org.hibernate.type.BasicTypeRegistry - Type registration [materialized_blob] overrides previous : org.hibernate.type.MaterializedBlobType@9801f4
5578 [http-bio-1979-exec-7] INFO org.hibernate.type.BasicTypeRegistry - Type registration [clob] overrides previous : org.hibernate.type.ClobType@1a86488
5578 [http-bio-1979-exec-7] INFO org.hibernate.type.BasicTypeRegistry - Type registration [java.sql.Clob] overrides previous : org.hibernate.type.ClobType@1a86488
5578 [http-bio-1979-exec-7] INFO org.hibernate.type.BasicTypeRegistry - Type registration [wrapper_characters_clob] overrides previous : org.hibernate.type.CharacterArrayClobType@605b1e
5578 [http-bio-1979-exec-7] INFO org.hibernate.type.BasicTypeRegistry - Type registration [materialized_clob] overrides previous : org.hibernate.type.MaterializedClobType@1fe1e26
5578 [http-bio-1979-exec-7] INFO org.hibernate.type.BasicTypeRegistry - Type registration [wrapper_materialized_blob] overrides previous : org.hibernate.type.WrappedMaterializedBlobType@6d75b6
5578 [http-bio-1979-exec-7] INFO org.hibernate.type.BasicTypeRegistry - Type registration [blob] overrides previous : org.hibernate.type.BlobType@4b3f8b
5578 [http-bio-1979-exec-7] INFO org.hibernate.type.BasicTypeRegistry - Type registration [java.sql.Blob] overrides previous : org.hibernate.type.BlobType@4b3f8b
5578 [http-bio-1979-exec-7] INFO org.hibernate.type.BasicTypeRegistry - Type registration [characters_clob] overrides previous : org.hibernate.type.PrimitiveCharacterArrayClobType@38fb59
6031 [http-bio-1979-exec-7] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
Jul 12, 2012 10:04:16 AM com.sun.faces.lifecycle.InvokeApplicationPhase execute
WARNING: #{login.doLogin}: java.lang.UnsupportedOperationException: The user must supply a JDBC connection
javax.faces.FacesException: #{login.doLogin}: java.lang.UnsupportedOperationException: The user must supply a JDBC connection
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Here is my persistence.xml




I have two projects setup. A JPA project and Dynamic Web Project. I use the JPA Project and added it to the Deployment Assembly of the Dynamic Web Project. When I test the JPA Project by itself, I am able to get the data to persist. However, when I use the JSF, it keeps giving me this error message of The user must supply a JDBC connection.


Is there something wrong with my persistence.xml file?
Is there something missing from my build path?
Do I need a hibernate.cfg.xml file?


Please advise.


Thanks
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36590
    
  16
So, how are you providing the database connection? Is that the actual message with your Exception, or simply a warning? What sort of Exception was it? UnsupportedOperationException?

I have changed your code tags because the long lines make the post illegible. I also think that question far too hard for “beginning”, so I shall move it . . . probably to the wrong place. It says Hibernate, so let’s try there first.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36590
    
  16
We haven’t got a Hibernate forum, so let’s try JSF.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15665
    
  15

We very definitely do have a Hibernate forum: Object Relational Mapping

However, before tossing this thread over there (there's nothing JSF-specific about Hibernate or vice versa), I have 2 questions:

1. Is this legacy Hibernate or is it JPA? It appears to be JPA.

2. What are you using to initialize the Hibernate environment? Spring Framework or user code?


Customer surveys are for companies who didn't pay proper attention to begin with.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9343
    
111

The spec states that those javax.persistence.jdbc.* properties in your persistence.xml are expected to be specified if you are running in a standalone Java SE environment. In a container environment, you are supposed to specify a jta or non-jta datasource in the persistence.xml.

[My Blog] [JavaRanch Journal]
Vikki Fiawoo
Greenhorn

Joined: Oct 22, 2010
Posts: 11
Tim Holloway wrote:We very definitely do have a Hibernate forum: Object Relational Mapping

However, before tossing this thread over there (there's nothing JSF-specific about Hibernate or vice versa), I have 2 questions:

1. Is this legacy Hibernate or is it JPA? It appears to be JPA.

2. What are you using to initialize the Hibernate environment? Spring Framework or user code?



This is JPA and I am using user code to initialize the Hibernate environment. Please see the code that I tested and it was able to persist without the Dynamic Web Project...





Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15665
    
  15

Well, I ding you -2 marks for not bracketing if/then conditions (bugs waiting to happen, in my experience), and -100 for Do It Yourself Login.

However, the biggest fault of all here is IDE Dependency. You're letting the IDE do the work for you and you don't know what it's doing. Hint: it's not doing what you need it to do.

The persistence.xml file goes in the /WEB-INF/classes/META-INF directory of the WAR being run if I have my resource paths straight. If it isn't found there, the factory cannot be created. I'm pretty sure that that's what's happening.

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: javax.faces.FacesException: The user must supply a JDBC connection
 
Similar Threads
Conneting to database but unable to save object.
Transaction is not being committed
SEVERE: Unable to initialize Struts ActionServlet due to an unexpected exception or error thrown.
error connecting to SQL Server 2005
Exception in example Using Hibernate Entity Manager in 2nd chapter of Java Persistence WithHibernate