-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Cannot create JDBC driver of class '' for connect URL 'null'
PostPosted: Sun Aug 07, 2005 4:12 pm 
Newbie

Joined: Thu Jan 27, 2005 5:27 am
Posts: 2
Hi,

I am trying to use Hibernate 3 to get the list of users from a database table called USER but it seems that DBCP is not working with me. I am currently using MySQL under Slackware Linux 10.1 with Exadel Studio Pro 3.0.3, jakarta-tomcat-5.5.9 and JDK 5.0(1.5.0_02).

Please read the first comment under hibernate.cfg.xml
Code:
hibernate.cfg.xml:
<hibernate-configuration>
    <session-factory>
        <!-- Database connection settings -->
   <!-- Every thing works fine if I uncomment the following four lines and comment the three lines in the middle -->
        <!--
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="connection.url">jdbc:mysql://localhost:3306/webappdb</property>
        <property name="connection.username">myusername</property>
        <property name="connection.password">mypassword</property>
        -->
   
   <property name="connection.datasource">java:comp/env/jdbc/webapp</property>
   <property name="show_sql">true</property>
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
      
        <!-- JDBC connection pool (use the built-in) -->
   <!--
        <property name="connection.pool_size">1</property>
   -->

        <!-- SQL dialect -->
   <!--
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
   -->
        <mapping resource="User.hbm.xml"/>
    </session-factory>
</hibernate-configuration>


User.hbm.xml:
Code:
<hibernate-mapping>
    <class name="webapp.web.User" table="USER">
        <id name="userId" column="USER_ID" type="long">
            <generator class="increment"/>
        </id>
        <!--
        <property name="date" type="timestamp" column="CREATION_DATE"/>
        -->
        <property name="firstName" column="FIRST_NAME"/>
        <property name="lastName" column="LAST_NAME"/>
        <property name="loginId" column="LOGIN_ID"/>
        <property name="password" column="PASSWORD_HASH"/>
        <property name="email" column="EMAIL"/>
    </class>
</hibernate-mapping>

I have placed hibernate.cfg.xml and User.hbm.xml under MY_WEB_APP_DIR/WEB-INF/classes

TOMCAT_DIR/conf/server.xml:
Code:
<Context docBase="/home/basel/workspace_3.1_gtk/web_app_01/.deployables/web_app_01" path="/web_app_01" reloadable="true" source="com.ibm.wtp.web.server:web_app_01">
   <!-- Hibernate DBCP Configuration - BEGINS -->
   <Resource name="jdbc/webapp" scope="Shareable" type="javax.sql.DataSource"/>
   <ResourceParams name="jdbc/webapp">
       <parameter>
          <name>factory</name>
          <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
       </parameter>
       <!-- DBCP Connection settings -->
      
       <parameter>
          <name>url</name>
          <value>jdbc:mysql://localhost:3306/webappdb</value>
       </parameter>
       <parameter>
          <name>driverClassName</name>
          <value>com.mysql.jdbc.Driver</value>
       </parameter>
       <parameter>
          <name>username</name>
          <value>myusername</value>
       </parameter>
       <parameter>
          <name>password</name>
          <value>mypassword</value>
       </parameter>
      
       <!-- DBCP Options -->
       <parameter>
          <name>maxWait</name>
          <value>3000</value>
       </parameter>
       <parameter>
          <name>maxIdle</name>
          <value>100</value>
       </parameter>
       <parameter>
          <name>maxActive</name>
          <value>10</value>
       </parameter>
    </ResourceParams>
</Context>


Under WEB-INF/lib I have the following files:
asm.jar
cglib-2.1.jar
commons-beanutils.jar <-- added by Exadel as part of the project
commons-collections.jar <-- added by Exadel as part of the project
commons-digest.jar <-- added by Exadel as part of the project
commons-logging.jar <-- added by Exadel as part of the project
dom4j-1.6.jar
ehcache-1.1.jar
hibernate3.jar
jsf-api.jar <-- added by Exadel as part of the project
jsf-impl.jar <-- added by Exadel as part of the project
jstl.jar <-- added by Exadel as part of the project
jta.jar
standard.jar <-- added by Exadel as part of the project

I have mysql-connector-java-3.1.7-bin.jar under TOMCAT_DIR/common/lib

UserListManager.java:
Code:
public List getUsers() {
   List users = new ArrayList();
   try{
      // I have not made any changes to HibernateUtil.java from Chapter 1. Quickstart with Tomcat
      // sessionFactory = new Configuration().configure().buildSessionFactory(); // Line 12 from HibernateUtil.java
      Session session = HibernateUtil.currentSession(); // Line 16
      Transaction tx = session.beginTransaction();
      Criteria criteria = session.createCriteria(User.class);
      criteria.setFirstResult(0);
      //criteria.setMaxResults(3);
      users = criteria.list();
      System.err.println("Is the list empty? " + users.isEmpty());
      Iterator i = users.iterator();
      while(i.hasNext()){
         User u = (User)i.next();
         System.out.println(u.getUserId());
      }
      tx.commit();
   HibernateUtil.closeSession();
   }
   catch(Exception e){
      e.printStackTrace();
   }
   return users;
}

Code:
-----
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.0.5
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: User.hbm.xml
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: webapp.web.User -> USER
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing extends queue
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing collection mappings
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing association property references
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
Aug 7, 2005 10:33:01 PM org.hibernate.util.NamingHelper getInitialContext
INFO: JNDI InitialContext properties:{}
Aug 7, 2005 10:33:01 PM org.hibernate.connection.DatasourceConnectionProvider configure
INFO: Using datasource: java:comp/env/jdbc/webapp
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
WARNING: Could not obtain connection metadata
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
   at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780)
   at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
   at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:59)
   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:72)
   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
   at webapp.web.HibernateUtil.<clinit>(HibernateUtil.java:12)
   at webapp.web.UserListManager.getUsers(UserListManager.java:16)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:79)
   at com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:167)
   at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:151)
   at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:243)
   at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:173)
   at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
   at javax.faces.component.UIData.getValue(UIData.java:527)
   at javax.faces.component.UIData.getDataModel(UIData.java:856)
   at javax.faces.component.UIData.setRowIndex(UIData.java:379)
   at com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:65)
   at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:683)
   at javax.faces.component.UIData.encodeBegin(UIData.java:681)
   at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:433)
   at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:130)
   at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:701)
   at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:435)
   at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:233)
   at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:701)
   at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:607)
   at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:544)
   at com.sun.faces.taglib.html_basic.PanelGridTag.doEndTag(PanelGridTag.java:460)
   at org.apache.jsp.home_jsp._jspx_meth_h_panelGrid_0(org.apache.jsp.home_jsp:192)
   at org.apache.jsp.home_jsp._jspx_meth_h_form_0(org.apache.jsp.home_jsp:153)
   at org.apache.jsp.home_jsp._jspx_meth_f_view_0(org.apache.jsp.home_jsp:123)
   at org.apache.jsp.home_jsp._jspService(org.apache.jsp.home_jsp:88)
   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
   at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
   at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
   at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
   at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
   at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: No suitable driver
   at java.sql.DriverManager.getDriver(DriverManager.java:243)
   at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773)
   ... 68 more
Aug 7, 2005 10:33:01 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.MySQLDialect
Aug 7, 2005 10:33:01 PM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
Aug 7, 2005 10:33:01 PM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: disabled
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): disabled
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: null
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximum outer join fetch depth: 2
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Aug 7, 2005 10:33:01 PM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.EhCacheProvider
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Echoing all SQL to stdout
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
Aug 7, 2005 10:33:01 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
Aug 7, 2005 10:33:02 PM org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Aug 7, 2005 10:33:02 PM net.sf.ehcache.config.Configurator configure
WARNING: No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/home/basel/workspace_3.1_gtk/web_app_01/.deployables/web_app_01/WEB-INF/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
Aug 7, 2005 10:33:02 PM org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
Aug 7, 2005 10:33:02 PM org.hibernate.impl.SessionFactoryImpl checkNamedQueries
INFO: Checking 0 named queries
Aug 7, 2005 10:33:02 PM org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 0, SQLState: null
Aug 7, 2005 10:33:02 PM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Cannot create JDBC driver of class '' for connect URL 'null'
org.hibernate.exception.GenericJDBCException: Cannot open connection
   at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
   at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
   at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:301)
   at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:110)
   at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:137)
   at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:49)
   at org.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.java:24)
   at org.hibernate.jdbc.JDBCContext.beginTransaction(JDBCContext.java:271)
   at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1079)
   at webapp.web.UserListManager.getUsers(UserListManager.java:17)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:79)
   at com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:167)
   at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:151)
   at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:243)
   at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:173)
   at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
   at javax.faces.component.UIData.getValue(UIData.java:527)
   at javax.faces.component.UIData.getDataModel(UIData.java:856)
   at javax.faces.component.UIData.setRowIndex(UIData.java:379)
   at com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:65)
   at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:683)
   at javax.faces.component.UIData.encodeBegin(UIData.java:681)
   at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:433)
   at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:130)
   at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:701)
   at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:435)
   at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:233)
   at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:701)
   at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:607)
   at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:544)
   at com.sun.faces.taglib.html_basic.PanelGridTag.doEndTag(PanelGridTag.java:460)
   at org.apache.jsp.home_jsp._jspx_meth_h_panelGrid_0(org.apache.jsp.home_jsp:192)
   at org.apache.jsp.home_jsp._jspx_meth_h_form_0(org.apache.jsp.home_jsp:153)
   at org.apache.jsp.home_jsp._jspx_meth_f_view_0(org.apache.jsp.home_jsp:123)
   at org.apache.jsp.home_jsp._jspService(org.apache.jsp.home_jsp:88)
   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
   at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
   at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
   at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
   at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
   at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:595)
Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
   at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780)
   at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
   at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:59)
   at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:298)
   ... 68 more
Caused by: java.sql.SQLException: No suitable driver
   at java.sql.DriverManager.getDriver(DriverManager.java:243)
   at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773)
   ... 71 more
-----
[/quote]


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 07, 2005 5:10 pm 
Regular
Regular

Joined: Thu Dec 02, 2004 7:11 am
Posts: 85
Quote:
Code:
  <!-- Hibernate DBCP Configuration - BEGINS -->
   <Resource name="jdbc/webapp" scope="Shareable" type="javax.sql.DataSource"/>
   <ResourceParams name="jdbc/webapp">
       <parameter>
          <name>factory</name>
          <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
       </parameter>
...


This is a way to configure DataSource in Tomcat 5.0. In Tomcat 5.5 syntax is changed.

http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html


Top
 Profile  
 
 Post subject: Exception setting property value with CGLIB
PostPosted: Tue Aug 09, 2005 12:26 pm 
Newbie

Joined: Mon Aug 08, 2005 8:29 pm
Posts: 10
I have two tables named Job and Jobpackage with many-to-one association. It means many jobs are asssociated with one Jobpackage.

I'm manually creating Javabean classes for both and using hiberantor to create .hbm.xml files out of it in WSAD 5.1.2. I'm manually adding the column names and association in .hbm.xml files. These .hbm.xml file are also added in hibernate.cfg.xml file where I have all database connection info.
Database tables already exist so I'm skipping schema generation part. I have a simple java class with one method for creating Job list from Job table. Also I have a servlet which invokes that method and pass it in the request object to jsp page where jsp page displays all the jobs from job table.

But when I run this program it get an error:
JobsBean.getJob(): Exception creating sessionfactory: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.boeing.tsas.castle.data.transferobjects.JobPackage.?
Exception creating sessionfactory: No persister for: java.lang.Integer

I'm new to hibernate but already implemented it for one-to-one asssociation and that works very well. I'm sure that I'm missing something but have no idea. I'd appreciate immediate help to rectify this issue.

Here is the details:
----------------------------------------------
Content of Jobpackage.hbm.xml file:
------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class name="com.boeing.tsas.castle.data.transferobjects.JobPackage" table="job_package">
<id name="packageId" column="PACKAGE_ID">
<!--<meta attribute="finder-method">findByJobsID</meta>-->
<generator class="increment"/>
</id>
<property name="jobPackageName" column="JOB_PACKAGE_NAME"/>
<property name="subject" column="SUBJECT"/>
<property name="archiveDate" column="ARCHIVE_DATE"/>
<property name="history" column="HISTORY"/>
<property name="revisionLevel" column="REVISION_LEVEL"/>
<property name="revisionNote" column="REVISION_NOTE"/>
<property name="saFolderId" column="SA_FOLDER_ID"/>
<property name="status" column="STATUS"/>
<property name="problemFrequency" column="PROBLEM_FREQUENCY"/>
<property name="sirp" column="SIRP"/>
<property name="initiatorBemsId" column="INITIATOR_BEMS_ID"/>
<property name="primaryComponent" column="PRIMARY_COMPONENT"/>
<property name="libraryLocationCode" column="LIBRARY_LOCATION_CODE"/>
<property name="publishedInd" column="PUBLISHED_IND" />
<property name="analysisDescriptionTextId" column="ANALYSIS_DESCRIPTION_TEXT_ID"/>
<property name="primaryDiscrepancyKeywordId" column="PRIMARY_DISCREPANCY_KEYWORD_ID"/>
<property name="ata" column="ATA" type="char"/>
<property name="chargeableInd" column="CHARGEABLE_IND"/>
<property name="problemTextId" column="PROBLEM_TEXT_ID"/>
<property name="libraryLocation" column="LIBRARY_LOCATION"/>
<property name="noteTextId" column="NOTE_TEXT_ID"/>
<property name="libraryBookVolumn" column="LIBRARY_BOOK_VOLUMN"/>
<property name="itarContentInd" column="ITAR_CONTENT_IND"/>
<property name="comrContentInd" column="COMR_CONTENT_IND"/>
<property name="earContentInd" column="EAR_CONTENT_IND"/>
<property name="modelId" column="MODEL_ID"/>
<property name="requestersDocument" column="REQUESTERS_DOCUMENT"/>
<property name="jobPackageType" column="JOB_PACKAGE_TYPE"/>
<property name="writeLockingBemsId" column="WRITE_LOCKING_BEMS_ID"/>
<property name="writeLockingDate" column="WRITE_LOCKING_DATE"/>
<property name="ownerBemsId" column="OWNER_BEMS_ID"/>

<!-- bi-directional one-to-many association to Jobs -->
<set name="jobs" inverse="true" cascade="all">
<key column="PACKAGE_ID"/>
<one-to-many class="com.boeing.tsas.castle.data.transferobjects.Jobs"/>
</set>

</class>

</hibernate-mapping>
<!-- parsed in 15ms -->
------------------------------------------------------------------------------
Content of Jobs.hbm.xml file
------------------------------------------
<hibernate-mapping>
<class name="com.boeing.tsas.castle.data.transferobjects.Jobs" table="job">
<id name="jobId" column="JOB_ID">
<generator class="increment">
</generator>
</id>

<!--<property name="packageId" column="PACKAGE_ID"/> -->
<property name="jobName" column="JOB_NAME"/>
<property name="timeDateOut" column="TIME_DATE_OUT"/>
<property name="jobDateDue" column="JOB_DATE_DUE"/>
<property name="jobDateIn" column="JOB_DATE_IN"/>
<property name="jobDateLoggedIn" column="JOB_DATE_LOGGED_IN"/>
<property name="jobExtendedDateDue" column="JOB_EXTENDED_DATE_DUE"/>
<property name="jobPriority" column="JOB_PRIORITY"/>
<property name="jobSpecificQuestion" column="JOB_SPECIFIC_QUESTION"/>
<property name="jobStatus" column="JOB_STATUS"/>
<property name="jobSubject" column="JOB_SUBJECT"/>
<property name="jobType" column="JOB_TYPE"/>
<property name="requester" column="REQUESTER"/>
<property name="requesterBemsId" column="REQUESTER_BEMS_ID"/>
<property name="dispSummary" column="DISP_SUMMARY"/>
<property name="assigneeBemsId" column="ASSIGNEE_BEMS_ID"/>
<property name="initiatorBemsId" column="INITIATOR_BEMS_ID"/>
<property name="noteTextId" column="NOTE_TEXT_ID"/>
<property name="approverNewInd" column="APPROVER_NEW_IND"/>
<property name="approverClearInd" column="APPROVER_CLEAR_IND"/>
<property name="initiatorNewInd" column="INITIATOR_NEW_IND"/>
<property name="initiatorClearInd" column="INITIATOR_CLEAR_IND"/>
<property name="assigneeNewInd" column="ASSIGNEE_NEW_IND" />
<property name="assigneeClearInd" column="ASSIGNEE_CLEAR_IND"/>
<property name="approverBemsId" column="APPROVER_BEMS_ID"/>


<many-to-one name="jobPackage"
class="com.boeing.tsas.castle.data.transferobjects.JobPackage">

<!-- Used by code generator -->
<!--<meta attribute="finder-method">findByPackageID</meta> -->

<!-- Used as a DDL hint -->
<column name="PACKAGE_ID" not-null="true" />
</many-to-one>



</class>
-----------------------------------------------------------------------------

snapshot of Jobs.java
--------------------------

/** nullable persistent field */
private JobPackage jobPackage;

/** default constructor */
public Jobs() {
}

//full constructor
public Jobs(JobPackage jobPackage){
setJobPackage(jobPackage);
}

/**
* @return
*/
public JobPackage getJobPackage() {
return this.jobPackage;
}
/**
* @param package1
*/
public void setJobPackage(JobPackage package1) {
this.jobPackage = package1;
}
-------------------------------------------------------------------------------
snapshot of Jobpackage.java
---------------------------------

/** persistent field */
private Set jobs;

/** default constructor */
public JobPackage() {
}

/** minimal constructor */
public JobPackage(Set jobs) {
this.jobs = jobs;
}
public Set getJobs() {
return jobs;
}

/**
* @param set
*/
public void setJobs(Set set) {
this.jobs = set;
}
-----------------------------------------------------------------------------------
Major portion of Error log:
-----------------------------

[8/9/05 8:54:49:810 PDT] 7f49a329 Environment I net.sf.hibernate.cfg.Environment Hibernate 2.0.3
[8/9/05 8:54:49:810 PDT] 7f49a329 Environment I net.sf.hibernate.cfg.Environment loaded properties from resource hibernate.properties: {hibernate.connection.username=castle, hibernate.connection.password=castle, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.Oracle9Dialect, hibernate.connection.url=jdbc:oracle:thin:@gpas51.cs.boeing.com:1521:castled, hibernate.connection.driver_class=oracle.jdbc.pool.OracleConnectionPoolDataSource}
[8/9/05 8:54:49:826 PDT] 7f49a329 Environment I net.sf.hibernate.cfg.Environment using CGLIB reflection optimizer
[8/9/05 8:54:49:826 PDT] 7f49a329 Environment I net.sf.hibernate.cfg.Environment JVM proxy support: true
[8/9/05 8:54:49:826 PDT] 7f49a329 Configuration I net.sf.hibernate.cfg.Configuration Configuration resource: /hibernate.cfg.xml
[8/9/05 8:54:49:982 PDT] 7f49a329 Configuration I net.sf.hibernate.cfg.Configuration Mapping resource: com/boeing/tsas/castle/data/transferobjects/CastleUser.hbm.xml
[8/9/05 8:54:50:060 PDT] 7f49a329 Binder I net.sf.hibernate.cfg.Binder Mapping class: com.boeing.tsas.castle.data.transferobjects.CastleUser -> castle_user
[8/9/05 8:54:50:138 PDT] 7f49a329 Configuration I net.sf.hibernate.cfg.Configuration Mapping resource: com/boeing/tsas/castle/data/transferobjects/Jobs.hbm.xml
[8/9/05 8:54:50:154 PDT] 7f49a329 Binder I net.sf.hibernate.cfg.Binder Mapping class: com.boeing.tsas.castle.data.transferobjects.Jobs -> job
[8/9/05 8:54:50:201 PDT] 7f49a329 Configuration I net.sf.hibernate.cfg.Configuration Mapping resource: com/boeing/tsas/castle/data/transferobjects/JobPackage.hbm.xml
[8/9/05 8:54:50:263 PDT] 7f49a329 Binder I net.sf.hibernate.cfg.Binder Mapping class: com.boeing.tsas.castle.data.transferobjects.JobPackage -> job_package
[8/9/05 8:54:50:263 PDT] 7f49a329 Configuration I net.sf.hibernate.cfg.Configuration Configured SessionFactory: null
[8/9/05 8:54:50:263 PDT] 7f49a329 Configuration I net.sf.hibernate.cfg.Configuration processing one-to-many association mappings
[8/9/05 8:54:50:263 PDT] 7f49a329 Binder I net.sf.hibernate.cfg.Binder Mapping collection: com.boeing.tsas.castle.data.transferobjects.JobPackage.jobs -> job
[8/9/05 8:54:50:263 PDT] 7f49a329 Configuration I net.sf.hibernate.cfg.Configuration processing foreign key constraints
[8/9/05 8:54:50:404 PDT] 7f49a329 SessionFactor I net.sf.hibernate.impl.SessionFactoryImpl building session factory
[8/9/05 8:54:50:420 PDT] 7f49a329 Dialect I net.sf.hibernate.dialect.Dialect Using dialect: net.sf.hibernate.dialect.Oracle9Dialect
[8/9/05 8:54:50:420 PDT] 7f49a329 DriverManager I net.sf.hibernate.connection.DriverManagerConnectionProvider Hibernate connection pool size: 20
[8/9/05 8:54:50:451 PDT] 7f49a329 DriverManager I net.sf.hibernate.connection.DriverManagerConnectionProvider using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@gpas51.cs.boeing.com:1521:castled
[8/9/05 8:54:50:451 PDT] 7f49a329 DriverManager I net.sf.hibernate.connection.DriverManagerConnectionProvider connection properties: {user=castle, password=castle}
[8/9/05 8:54:50:451 PDT] 7f49a329 SessionFactor I net.sf.hibernate.impl.SessionFactoryImpl Use outer join fetching: true
[8/9/05 8:54:50:888 PDT] 7f49a329 SessionFactor I net.sf.hibernate.impl.SessionFactoryImpl Use scrollable result sets: true
[8/9/05 8:54:50:888 PDT] 7f49a329 SessionFactor I net.sf.hibernate.impl.SessionFactoryImpl JDBC 2 max batch size: 15
[8/9/05 8:54:51:623 PDT] 7f49a329 SessionFactor I net.sf.hibernate.impl.SessionFactoryObjectFactory no JDNI name configured
[8/9/05 8:54:51:623 PDT] 7f49a329 SessionFactor I net.sf.hibernate.impl.SessionFactoryImpl Query language substitutions: {}
[8/9/05 8:54:51:951 PDT] 7f49a329 SystemErr R JobsBean.getJob(): Exception creating sessionfactory: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.boeing.tsas.castle.data.transferobjects.JobPackage.?
[8/9/05 8:54:51:982 PDT] 7f49a329 SystemErr R Exception creating sessionfactory: No persister for: java.lang.Integer
[8/9/05 8:54:52:357 PDT] 7f49a329 WebGroup I SRVE0180I: [castleWeb] [/] [Servlet.LOG]: /MyWork.jsp: init
[8/9/05 8:54:52:779 PDT] 7f49a329 WebGroup I SRVE0180I: [castleWeb] [/] [Servlet.LOG]: /MyWorkHeader.jsp: init
[8/9/05 8:54:52:810 PDT] 3bd96329 WebGroup I SRVE0180I: [castleWeb] [/] [Servlet.LOG]: /MyWorkFrameset.jsp: init
[8/9/05 8:54:53:013 PDT] 7f49a329 WebGroup I SRVE0180I: [castleWeb] [/] [Servlet.LOG]: /MyWorkAlertBox.jsp: init
[8/9/05 8:54:53:107 PDT] 3bd96329 WebGroup I SRVE0180I: [castleWeb] [/] [Servlet.LOG]: /MyWorkHeader2.jsp: init
[8/9/05 8:54:53:201 PDT] 7f49a329 WebGroup I SRVE0180I: [castleWeb] [/] [Servlet.LOG]: /MyWorkWorkList.jsp: init
[8/9/05 8:54:54:810 PDT] 7f49a329 WebGroup E SRVE0026E: [Servlet Error]-[]: java.lang.NullPointerException


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.