Main Tutorials

java.lang.ClassNotFoundException : javassist.util.proxy.MethodFilter

Problem

Using Hibernate 3.6.3, but hits this javassist not found error, see below for error stacks :


Caused by: java.lang.NoClassDefFoundError: javassist/util/proxy/MethodFilter
	...
	at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:77)
	... 16 more
Caused by: java.lang.ClassNotFoundException: javassist.util.proxy.MethodFilter
	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
	... 21 more

Solution

javassist.jar is missing, and you can get the latest from JBoss Maven repositorty.

File : pom.xml


<project ...>
	<repositories>
		<repository>
			<id>JBoss repository</id>
			<url>http://repository.jboss.org/nexus/content/groups/public/</url>
		</repository>
	</repositories>

	<dependencies>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>3.6.3.Final</version>
		</dependency>

		<dependency>
			<groupId>javassist</groupId>
			<artifactId>javassist</artifactId>
			<version>3.12.1.GA</version>
		</dependency>

	</dependencies>
</project>

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
7 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Manoj Tyagi
9 years ago

My project is spring-jpa maven

I am facing a problem with spring-JPA maven project ,it is downloading two versions of javassist due to which i am getting Hibernate exception _$$_javassist_0 cannot be cast to javassist.util.proxy.Proxy error
-javassist-3.7.ga.jar

-javassist-3.18.1-GA.jar

I am using version 4.3.7.Final and spring version 4.1.1.RELEASE

Do you have any idea how i can exclude the oldder dependency of javassist which is javassist-3.7.ga.jar.

I tries excluding it from
as mentioned here http://stackoverflow.com/questions/22481540/hibernate-exception-javassist-0-cannot-be-cast-to-javassist-util-proxy-proxy but no luck.Do you have any idea how can we exclude old javassist dependency

Ramesh
10 years ago

Thanks a bunch. You solved two of my problems today – one with slf-log4j and this one – Javaassist.

Amazing!

Michael R
11 years ago

I kept getting this exception with Hibernate (3.6.10.Final) even after I added the mentioned jar:

http://mvnrepository.com/artifact/javassist/javassist/3.12.1.GA

javassist
javassist
3.12.1.GA

Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]

Caused by: java.lang.NoClassDefFoundError: javassist/util/proxy/MethodFilter

The solution was to add the javassist bundle instead:
http://mvnrepository.com/artifact/org.javassist/javassist/3.17.1-GA

org.javassist
javassist
3.17.1-GA

Dilip Shah
9 years ago
Reply to  Michael R

your suggestion worked… thx!

Don Zagorski
11 years ago

Thank you!

You solved my problem for this runtime exception:
java.lang.ClassNotFoundException : javassist.util.proxy.MethodFilter

Your Maven dependency entries were exactly what I needed!

(It appears that this is a transitive dependency missed by Hibernate’s POM.)

When I see your photo on a google search hit, I know it’s reliable. Keep up the good work, java buddy!

souvik dey
11 years ago

@Entity
public class InvPriceLevel implements Serializable {

@OneToMany(mappedBy = “invPriceLevel”,cascade=CascadeType.ALL,fetch=FetchType.LAZY)
private List invPricelistList;

}

@Entity
public class InvPriceList implements Serializable {
@ManyToOne
@JoinColumn(name = “iplid”)
private InvPriceLevel invPriceLevel;

}

//==========Bissness logic

public InvPriceLevel getInvPriceLevelById(int id)
{

fact.openSession();

InvPriceLevel invPriceLevel (InvPriceLevel)session.load(InvPriceLevel.class, id);
sess.close();
return invPriceLevel
}

//==================In the front end

getInvPriceLevelById(1).getInvPricelistList().size() //==========Error org.hibernate.LazyInitializationException

WHAT IS THE DAO CONFIGURATION /WHAT IS THE DAO PATTERN?

I want to open and close within the method and fetch type LAZY but I want to resolve the solution.