In your plan.xml try to filter the hibernate.jar in this way

<?xml version="1.0" encoding="UTF-8"?>
<web:web-app
    xmlns:deployment=" http://geronimo.apache.org/xml/ns/deployment-1.1"
    xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1"
    xmlns:security=" http://geronimo.apache.org/xml/ns/security-1.1"
    xmlns:web="http://geronimo.apache.org/xml/ns/j2ee/web-1.1 "
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation=" http://geronimo.apache.org/xml/ns/j2ee/web-1.1 http://geronimo.apache.org/schemas-1.1/geronimo-web-1.1.xsd http://geronimo.apache.org/xml/ns/naming-1.1 http://geronimo.apache.org/schemas-1.1/geronimo-naming-1.1.xsd http://geronimo.apache.org/xml/ns/security-1.1 http://geronimo.apache.org/schemas-1.1/geronimo-security-1.1.xsd http://geronimo.apache.org/xml/ns/deployment-1.1 http://geronimo.apache.org/schemas-1.1/geronimo-module-1.1.xsd ">
   
    .....
  <deployment:environment>
       <deployment:hidden-classes>
            <deployment:filter>org.springframework</deployment:filter>
            <deployment:filter>org.hibernate</deployment:filter>
        </deployment:hidden-classes>

    </deployment:environment>
    ....
     
</web:web-app>


On 11/8/06, Peter <[EMAIL PROTECTED]> wrote:
Michele La Porta < [EMAIL PROTECTED]> writes:

>
>
> You can try this:package org.hibernate.transaction;import
java.util.Iterator;import java.util.Properties;import java.util.Set;import
javax.transaction.TransactionManager ;import
org.apache.geronimo.gbean.AbstractName
> ;import org.apache.geronimo.gbean.AbstractNameQuery;import
org.apache.geronimo.kernel.Kernel;import
org.apache.geronimo.kernel.KernelRegistry;import
org.apache.geronimo.kernel.proxy.ProxyManager ;import
> org.apache.geronimo.transaction.context.TransactionContextManager;import
org.hibernate.HibernateException;public class GeronimoTransactionManagerLookup
implements TransactionManagerLookup { // geronimo
> 1.1 object name public static final String TransactionMgrGBeanName
= "geronimo.server:J2EEApplication=null,J2EEModule=geronimo/j2ee-server/1.1-
SNAPSHOT/car,J2EEServer=geronimo,j2eeType=TransactionContextManager,name=Transa
ctionContextManager";
> public static final String UserTransactionName
= "java:comp/UserTransaction"; public TransactionManager
getTransactionManager(Properties props) throws HibernateException { try
{
> //TODO props with geronimo kernel name Kernel kernel
= KernelRegistry.getKernel("geronimo"); ProxyManager proxyManager =
kernel.getProxyManager(); AbstractNameQuery query = new
AbstractNameQuery(
> TransactionContextManager.class.getName()); Set names =
kernel.listGBeans(query); AbstractName name = null; for
(Iterator it = names.iterator(); it.hasNext();) name =
(AbstractName)
> it.next(); return ((TransactionContextManager)
proxyManager.createProxy(name,
TransactionContextManager.class)).getTransactionManager(); } catch
(Exception e) {
> e.printStackTrace(); throw new HibernateException("Geronimo
Transaction Manager Lookup Failed", e); } } public String
getUserTransactionName() { return UserTransactionName;
> }}Remember to set this hibernate.properties <property
name="hibernateProperties"> <props> <prop
key="hibernate.dialect
> ">org.hibernate.dialect.SQLServerDialect</prop> <prop
key="hibernate.show_sql">false</prop> <prop
key="hibernate.cglib.use_reflection_optimizer
> ">true</prop> <prop
key="hibernate.transaction.flush_before_completion">true</prop>
<prop key="hibernate.transaction.auto_close_session
> ">true</prop> <prop
key="hibernate.transaction.factory_class ">org.hibernate.transaction.JTATransact
ionFactory</prop> <prop key="
>
hibernate.transaction.manager_lookup_class">org.hibernate.transaction.GeronimoT
ransactionManagerLookup</prop> <prop
key="hibernate.current_session_context_class">thread</prop>
> <!-- <prop
key="hibernate.current_session_context_class">jta</prop>-->
<prop key="jta.UserTransaction ">java:comp/UserTransaction</prop>
> <prop
key="hibernate.cache.use_query_cache">true</prop> <prop
key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider
> </prop> <prop
key="hibernate.cache.provider_configuration_file_resource_path">src/main/resour
ces/ehcache-hibernate3.xml</prop> </props>
> </property>
>
> On 11/8/06, Peter <[EMAIL PROTECTED]> wrote:
> A suggested solution for Geronimo 1.0 is available
athttp://cwiki.apache.org/confluence/display/GMOxDOC10/JBoss+to+Geronimo+-
+Hibernate+Migration. Unfortunately this does not work for Geronimo
> 1.1.What I have tried is:public class
GeronimoTransactionManagerLookupimplements TransactionManagerLookup{
public static final String TransactionMgrGBeanName="
> geronimo.server:J2EEApplication=null,"
+"J2EEModule=geronimo/j2ee-server/1.1.1/car,"
+"J2EEServer=geronimo,j2eeType=TransactionManager," +
> "name=TransactionManager"; ...but I still getDEBUG
[SessionFactoryObjectFactory] initializing
classSessionFactoryObjectFactoryDEBUG [SessionFactoryObjectFactory] registered:
> 8b81890a0ec727bb010ec727c8de0000 (unnamed)
INFO[SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI
nameconfiguredDEBUG [SessionFactoryImpl] instantiated session factoryDEBUG
[SessionFactoryImpl] obtaining JTA TransactionManager
> ERROR [PersistenceManager] Geronimo Transaction Manager Lookup
Failedorg.hibernate.HibernateException : Geronimo Transaction Manager Lookup
Failedatorg.hibernate.transaction.GeronimoTransactionManagerLookup.getT
ransactionManage
> r(GeronimoTransactionManagerLookup.java:29)at
org.hibernate.impl.SessionFactoryImpl .<init>
(SessionFactoryImpl.java:301)at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java
> :1154)How should this GBeanName be set? Or do I need to change something
else?
>
>
>
>

Hi Michele:

Now the lookup works but later on I have the following exception, although
org.hibernate.hql.ast.HqlToken is present in hibernate3.jar:

INFO  [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name
configured
DEBUG [SessionFactoryImpl] instantiated session factory
DEBUG [SessionFactoryImpl] obtaining JTA TransactionManager
INFO  [SessionFactoryImpl] Checking 7 named HQL queries
DEBUG [SessionFactoryImpl] Checking named query: findGueltigeAnwendungsgruppen
DEBUG [SessionFactoryImpl] Checking named query: findGueltigeFunktionen
DEBUG [SessionFactoryImpl] Checking named query:
findGueltigeMitarbeiterAnwendungsgruppen
DEBUG [SessionFactoryImpl] Checking named query: getConfigValue
DEBUG [SessionFactoryImpl] Checking named query: findGueltigenMitarbeiter
DEBUG [SessionFactoryImpl] Checking named query: findGueltigeChildFunktionen
DEBUG [SessionFactoryImpl] Checking named query: findGueltigeBerechtigungen
INFO  [SessionFactoryImpl] Checking 0 named SQL queries
ERROR [SessionFactoryImpl] Error in named query: findGueltigeAnwendungsgruppen
org.hibernate.QueryException: ClassNotFoundException:
org.hibernate.hql.ast.HqlToken [

                        SELECT anwgrup from
de.dak.rahmenwerk.application.berechtigung.Anwendungsgruppe anwgrup WHERE
anwgrup.Anwendung.ANW_SL = :anwendungsKuerzel
                                and ((:heute between anwgrup.GUELTIG_AB and
anwgrup.GUELTIG_BIS) or (anwgrup.GUELTIG_AB is null and anwgrup.GUELTIG_BIS
>= :heute) or (anwgrup.GUELTIG_AB <= :heute and anwgrup.GUELTIG_BIS is null)
or (anwgrup.GUELTIG_AB is null and anwgrup.GUELTIG_BIS is null) )
                ]
        at org.hibernate.hql.ast.HqlLexer.panic(HqlLexer.java:57)
        at antlr.CharScanner.setTokenObjectClass(CharScanner.java:340)
        at org.hibernate.hql.ast.HqlLexer.setTokenObjectClass (HqlLexer.java:31)
        at antlr.CharScanner.<init>(CharScanner.java:51)
        at antlr.CharScanner.<init>(CharScanner.java:60)
        at org.hibernate.hql.antlr.HqlBaseLexer.<init>(HqlBaseLexer.java :56)
        at org.hibernate.hql.antlr.HqlBaseLexer.<init>(HqlBaseLexer.java:53)
        at org.hibernate.hql.antlr.HqlBaseLexer.<init>(HqlBaseLexer.java:50)
        at org.hibernate.hql.ast.HqlLexer .<init>(HqlLexer.java:26)
        at org.hibernate.hql.ast.HqlParser.getInstance(HqlParser.java:44)
        at org.hibernate.hql.ast.QueryTranslatorImpl.parse
(QueryTranslatorImpl.java:232)
        at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile
(QueryTranslatorImpl.java:155)
        at org.hibernate.hql.ast.QueryTranslatorImpl.compile
(QueryTranslatorImpl.java:105)
        at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:74)
        at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:53)
        at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan
(QueryPlanCache.java:71)
        at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries
(SessionFactoryImpl.java:363)
        at org.hibernate.impl.SessionFactoryImpl.<init>
(SessionFactoryImpl.java:327)
        at org.hibernate.cfg.Configuration.buildSessionFactory
(Configuration.java:1154)



Reply via email to