2 Replies Latest reply on Oct 8, 2008 7:23 AM by Josef Grabner

    DataSource40 cannot be cast to org.hibernate.SessionFactory

    Josef Grabner Newbie

      Hello!


      Did anyone of you run into this exception:
      java.lang.ClassCastException: com.sun.gjc.spi.jdbc40.DataSource40 cannot be cast to org.hibernate.SessionFactory


      my components.xml looks like the following:


      <persistence:hibernate-session-factory name="hibernateSessionFactory"/>
           <persistence:managed-hibernate-session 
                name="testDb" 
                auto-create="true"
                session-factory-jndi-name="jdbc/test"/>


      this is the hibernate.cfg.xml:


      <!DOCTYPE hibernate-configuration PUBLIC
                "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
      <hibernate-configuration>
           
           <session-factory name="java:/bookingSessionFactory">
                <property name="transaction.flush_before_completion">true</property>
                <property name="connection.release_mode">after_statement</property>
                <property name="transaction.manager_lookup_class">org.hibernate.transaction.SunONETransactionManagerLookup</property>
                <property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
                <property name="connection.datasource">jdbc/test</property>
           </session-factory>
      </hibernate-configuration>




      The exception occurs when accessing a component (in this case the authenticator) that contains the @In annotation:



      @Name("authenticator")
      public class Authenticator {
      
           @Logger private Log log;
           @In Session trackCheckDb;
           
           public boolean authenticate() {
                try
                {



      Thnx in advance for your help


      Josef