Re: Hibernate ClassCastException in GWT hosted mode only

2012-09-25 Thread Meng
You helped me .thanks so muck.
 
 

在 2012年5月25日星期五UTC+8下午9时44分02秒,federevo写道:

> Hi all,
>
> here the procedure to apply the patch while  4.1.4 is not relased.
> 1. create a source folder (ie: src_patch) in your eclipse project
> 2. create the package org.hibernate.service.classloading.internal;
> 3. copy the patched source file ClassLoaderServiceImpl.java (attached) in 
> the package (patch from v4.1.3)
>
>
> 
>
> -> eclipse will compile the class in web-inf/classes and it will override 
> the old class
>
> Vincent
>
>
> Le jeudi 17 mai 2012 20:46:37 UTC+2, Christomania a écrit :
>>
>> Has somebody found a way to try the patch described here  
>> https://hibernate.onjira.com/browse/HHH-7084 ?
>>
>> Le mardi 1 mai 2012 18:42:18 UTC+2, AK a écrit :
>>>
>>> Same question, as it has been almost 2 months.  Any word on ways to 
>>> get this to work without downgrading hibernate?
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/316F0zJaMQQJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Hibernate ClassCastException in GWT hosted mode only

2012-05-25 Thread norandom
Hi all,

here the procedure to apply the patch while  4.1.4 is not relased.
1. create a source folder (ie: src_patch) in your eclipse project
2. create the package org.hibernate.service.classloading.internal;
3. copy the patched source file ClassLoaderServiceImpl.java (attached) in 
the package (patch from v4.1.3)



-> eclipse will compile the class in web-inf/classes and it will override 
the old class

Vincent


Le jeudi 17 mai 2012 20:46:37 UTC+2, Christomania a écrit :
>
> Has somebody found a way to try the patch described here  
> https://hibernate.onjira.com/browse/HHH-7084 ?
>
> Le mardi 1 mai 2012 18:42:18 UTC+2, AK a écrit :
>>
>> Same question, as it has been almost 2 months.  Any word on ways to 
>> get this to work without downgrading hibernate?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/21UXxnGc5D4J.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
 * indicated by the @author tags or express copyright attribution
 * statements applied by the authors.  All third-party contributions are
 * distributed under license by Red Hat Inc.
 *
 * This copyrighted material is made available to anyone wishing to use, modify,
 * copy, or redistribute it subject to the terms and conditions of the GNU
 * Lesser General Public License, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this distribution; if not, write to:
 * Free Software Foundation, Inc.
 * 51 Franklin Street, Fifth Floor
 * Boston, MA  02110-1301  USA
 */
package org.hibernate.service.classloading.internal;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.ServiceLoader;

import org.hibernate.cfg.AvailableSettings;
import org.hibernate.service.classloading.spi.ClassLoaderService;
import org.hibernate.service.classloading.spi.ClassLoadingException;

/**
 * Standard implementation of the service for interacting with class loaders
 *
 * @author Steve Ebersole
 */
public class ClassLoaderServiceImpl implements ClassLoaderService {
	private final ClassLoader classClassLoader;
	private final ClassLoader resourcesClassLoader;

	public ClassLoaderServiceImpl() {
		this( ClassLoaderServiceImpl.class.getClassLoader() );
	}

	public ClassLoaderServiceImpl(ClassLoader classLoader) {
		this( classLoader, classLoader, classLoader, classLoader );
	}

	public ClassLoaderServiceImpl(
			ClassLoader applicationClassLoader,
			ClassLoader resourcesClassLoader,
			ClassLoader hibernateClassLoader,
			ClassLoader environmentClassLoader) {
		// Normalize missing loaders
		if ( hibernateClassLoader == null ) {
			hibernateClassLoader = ClassLoaderServiceImpl.class.getClassLoader();
		}

		if ( environmentClassLoader == null || applicationClassLoader == null ) {
			ClassLoader sysClassLoader = locateSystemClassLoader();
			ClassLoader tccl = locateTCCL();
			if ( environmentClassLoader == null ) {
environmentClassLoader = sysClassLoader != null ? sysClassLoader : hibernateClassLoader;
			}
			if ( applicationClassLoader == null ) {
applicationClassLoader = tccl != null ? tccl : hibernateClassLoader;
			}
		}

		if ( resourcesClassLoader == null ) {
			resourcesClassLoader = applicationClassLoader;
		}

		final LinkedHashSet classLoadingClassLoaders = new LinkedHashSet();
		classLoadingClassLoaders.add( applicationClassLoader );
		classLoadingClassLoaders.add( hibernateClassLoader );
		classLoadingClassLoaders.add( environmentClassLoader );

		//this.classClassLoader = new ClassLoader() {
		System.out.println("PATCH: https://hibernate.onjira.com/browse/HHH-7084";);
		this.classClassLoader = new ClassLoader( applicationClassLoader ) {
			@Override
			protected Class findClass(String name) throws ClassNotFoundException {
for ( ClassLoader loader : classLoadingClassLoaders ) {
	try {
		return loader.loadClass( name );
	}
	catch (Exception ignore) {
	}
}
throw ne

Re: Hibernate ClassCastException in GWT hosted mode only

2012-05-18 Thread Christopher Tarento
Has somebody found a way to try the patch described here  
https://hibernate.onjira.com/browse/HHH-7084 ?

Le mardi 1 mai 2012 18:42:18 UTC+2, AK a écrit :
>
> Same question, as it has been almost 2 months.  Any word on ways to 
> get this to work without downgrading hibernate?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/XdRfzv6j2c8J.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Hibernate ClassCastException in GWT hosted mode only

2012-05-02 Thread AK
Same question, as it has been almost 2 months.  Any word on ways to
get this to work without downgrading hibernate?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Hibernate ClassCastException in GWT hosted mode only

2012-03-08 Thread Lukasz Plotnicki
Does anybody know a workaround (other then rollback to and old hibernate 
version) for this issue?

Am Montag, 20. Februar 2012 07:58:57 UTC+1 schrieb Artem V. Navrotskiy:
>
> This is Hibernate 4.0.0+ bug:
> https://hibernate.onjira.com/browse/HHH-7084
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/1XPMPUNjLYIJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Hibernate ClassCastException in GWT hosted mode only

2012-02-19 Thread Artem V . Navrotskiy
This is Hibernate 4.0.0+ bug:
https://hibernate.onjira.com/browse/HHH-7084

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Hibernate ClassCastException in GWT hosted mode only

2011-11-21 Thread Juan Pablo Gardella
:)

2011/11/21 Alexander Lochschmied 

> Juan that was a big help. Finally it seems to work with downgraded
> Hibernate (3.6.3) and additional dependencies:
> 
> javax.validation
> validation-api
> 
> ${javax-validation.version}
> provided
> 
> 
> javax.validation
> validation-api
> 
> ${javax-validation.version}
> sources
> provided
> 
> 
> org.hibernate.javax.persistence
> hibernate-jpa-2.0-api
> 
> ${hibernate-jpa.version}
> 
> 
> 
> org.apache.bval
> bval-core
> 
> ${bval.version}
> 
> 
> org.apache.bval
> bval-jsr303
> 
> ${bval.version}
> 
>
> Thank you very much Juan! And good luck to jett!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/xeW9sclR98cJ.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Hibernate ClassCastException in GWT hosted mode only

2011-11-21 Thread Alexander Lochschmied
Juan that was a big help. Finally it seems to work with downgraded 
Hibernate (3.6.3) and additional dependencies:

javax.validation
validation-api

${javax-validation.version}
provided


javax.validation
validation-api

${javax-validation.version}
sources
provided


org.hibernate.javax.persistence
hibernate-jpa-2.0-api

${hibernate-jpa.version}



org.apache.bval
bval-core

${bval.version}


org.apache.bval
bval-jsr303

${bval.version}


Thank you very much Juan! And good luck to jett!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/xeW9sclR98cJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Hibernate ClassCastException in GWT hosted mode only

2011-11-19 Thread jett
I'm facing the same issue and was suspecting a class loading issue.  I
thought I was inviting trouble when I would place the same Hibernate
annotated class in both the server side code and the GWT client side,
but until upgrading GWT 2.0 to GWT 2.4, I did not experience this
ClassCastException problem.

As Alexander has experienced, things work fine when I deploy the .war
to an external server, and only see problems running in the DevMode.
I see different classes not being "cast-able" depending on my
hibernate.cfg.xml.

I'm still trying to sort out how the switch from GWT 2.0 to 2.4 is a
factor because I made several changes, but I am glad to hear that I'm
not the only one thinking this is a classloader issue.


On Nov 18, 9:54 am, Thomas Broyer  wrote:
> On Friday, November 18, 2011 2:21:33 PM UTC+1, Alexander Lochschmied wrote:
>
> > It only becomes:
>
> > Caused by: java.lang.ClassCastException: 
> > org.hibernate.dialect.MySQL5Dialect cannot be cast to 
> > org.hibernate.dialect.Dialect
>
> > We haven playing with those JARs as there may be incompatibilities (JPA 1
> > vs 2) I think. Currently we do *not *reference them
> > (hibernate-jpa-2.0-api, hibernate-validator and validation-api).
>
> > Could it be a class loading issue?
>
> It's very likely the case yes; generally because the MySQL5Dialect comes
> from the parent classloader of the one containing the Dialect class. Could
> it be that some of your dependencies are not in the WEB-INF/lib?
>
> IMO, when using Maven, you should really make at least 2 projects: one for
> the server and one for the client (you can possibly make server depend on
> client, but I'd rather make a third project "shared" that both client and
> server depend on); and you launch the server using the jetty-maven-plugin
> or whatever, and then run the DevMode in -noserver mode for the client-side
> code.
> The problem is that there's no "scope=client" and "scope=server" in Maven,
> so everything in scope=compile or scope=runtime will be copied to your
> webapp's WEB-INF/lib, as expected, but will *also* be in the classpath of
> the DevMode, because there's no way to know whether your client-side code
> needs them or not; that leads to having all server classes twice on the
> classpath of the webapp (because it's a child classloader of the DevMode's
> one).

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Hibernate ClassCastException in GWT hosted mode only

2011-11-18 Thread Thomas Broyer


On Friday, November 18, 2011 2:21:33 PM UTC+1, Alexander Lochschmied wrote:
>
> It only becomes:
>
>
> Caused by: java.lang.ClassCastException: org.hibernate.dialect.MySQL5Dialect 
> cannot be cast to org.hibernate.dialect.Dialect
>
>
> We haven playing with those JARs as there may be incompatibilities (JPA 1 
> vs 2) I think. Currently we do *not *reference them 
> (hibernate-jpa-2.0-api, hibernate-validator and validation-api).
>
> Could it be a class loading issue?
>

It's very likely the case yes; generally because the MySQL5Dialect comes 
from the parent classloader of the one containing the Dialect class. Could 
it be that some of your dependencies are not in the WEB-INF/lib?

IMO, when using Maven, you should really make at least 2 projects: one for 
the server and one for the client (you can possibly make server depend on 
client, but I'd rather make a third project "shared" that both client and 
server depend on); and you launch the server using the jetty-maven-plugin 
or whatever, and then run the DevMode in -noserver mode for the client-side 
code.
The problem is that there's no "scope=client" and "scope=server" in Maven, 
so everything in scope=compile or scope=runtime will be copied to your 
webapp's WEB-INF/lib, as expected, but will *also* be in the classpath of 
the DevMode, because there's no way to know whether your client-side code 
needs them or not; that leads to having all server classes twice on the 
classpath of the webapp (because it's a child classloader of the DevMode's 
one).

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/v5RT3A-4J8wJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Hibernate ClassCastException in GWT hosted mode only

2011-11-18 Thread kebatshotse setimela
i cannot solve it

On 11/18/11, Juan Pablo Gardella  wrote:
> I have a sample that use hibernate 3.6.x and run inside jetty here:
> https://bitbucket.org/gardellajuanpablo/gwt-sample/wiki/Home
>
> Check the pom.xml.
>
> If you can't resolve the issue tell me.
>
> Juan
>
>
>
> 2011/11/18 Alexander Lochschmied 
>
>> It only becomes:
>>
>>
>> Caused by: java.lang.ClassCastException:
>> org.hibernate.dialect.MySQL5Dialect cannot be cast to
>> org.hibernate.dialect.Dialect
>>
>>
>> We haven playing with those JARs as there may be incompatibilities (JPA 1
>> vs 2) I think. Currently we do *not *reference them
>> (hibernate-jpa-2.0-api, hibernate-validator and validation-api).
>>
>> Could it be a class loading issue? I see the following in log with JPA
>> setup being disabled (that's when Jetty starts normally):
>> JspRuntimeContext  - Parent class loader is: ContextLoader@null
>>
>> Thanks Juan!
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Web Toolkit" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/google-web-toolkit/-/cXtHXc6B_MkJ.
>>
>> To post to this group, send email to google-web-toolkit@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-web-toolkit+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Hibernate ClassCastException in GWT hosted mode only

2011-11-18 Thread Juan Pablo Gardella
I have a sample that use hibernate 3.6.x and run inside jetty here:
https://bitbucket.org/gardellajuanpablo/gwt-sample/wiki/Home

Check the pom.xml.

If you can't resolve the issue tell me.

Juan



2011/11/18 Alexander Lochschmied 

> It only becomes:
>
>
> Caused by: java.lang.ClassCastException: org.hibernate.dialect.MySQL5Dialect 
> cannot be cast to org.hibernate.dialect.Dialect
>
>
> We haven playing with those JARs as there may be incompatibilities (JPA 1
> vs 2) I think. Currently we do *not *reference them
> (hibernate-jpa-2.0-api, hibernate-validator and validation-api).
>
> Could it be a class loading issue? I see the following in log with JPA
> setup being disabled (that's when Jetty starts normally):
> JspRuntimeContext  - Parent class loader is: ContextLoader@null
>
> Thanks Juan!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/cXtHXc6B_MkJ.
>
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Hibernate ClassCastException in GWT hosted mode only

2011-11-18 Thread Alexander Lochschmied
Sorry for the typo; wanted to say: We have been playing ...

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/MDrIMjRfHUwJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Hibernate ClassCastException in GWT hosted mode only

2011-11-18 Thread Alexander Lochschmied


It only becomes:


Caused by: java.lang.ClassCastException: org.hibernate.dialect.MySQL5Dialect 
cannot be cast to org.hibernate.dialect.Dialect


We haven playing with those JARs as there may be incompatibilities (JPA 1 
vs 2) I think. Currently we do *not *reference them 
(hibernate-jpa-2.0-api, hibernate-validator and validation-api).

Could it be a class loading issue? I see the following in log with JPA 
setup being disabled (that's when Jetty starts normally):
JspRuntimeContext  - Parent class loader is: ContextLoader@null

Thanks Juan!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/cXtHXc6B_MkJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.