NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Hibernate in Netbeans Platform and java.lang.IllegalAccessException

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users
View previous topic :: View next topic  
Author Message
stephan diehl - open solu
Posted via mailing list.





PostPosted: Wed Sep 03, 2008 6:48 pm    Post subject: Hibernate in Netbeans Platform and java.lang.IllegalAccessException Reply with quote

Hello,

i have a great problem with hibernate becaue of its dependencies.

now it is the following:

java.lang.IllegalAccessException: Class
org.hibernate.ejb.event.CallbackResolver can not access a member of
class net.opensolutions.project.entity.UpdateListener with modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:
65)
at java.lang.Class.newInstance0(Class.java:349)
at java.lang.Class.newInstance(Class.java:308)
at
org
.hibernate
.ejb.event.CallbackResolver.resolveCallback(CallbackResolver.java:135)

it is, because of this behavier:

i have two modules in this scenario. the first is "hibernate lib" with
all libraries for hibernate and the entity manager.
another project called "entity" has the entitys and is depending an
"hibernate lib", because of the javax.persistence-annotations in that
project.

now in this szenario, i have a entity class like this:

@Entity
@EntityListeners(value=UpdateListener.class)
public class Contact {

@Id
@GeneratedValue
private long id;

private String company;
private String title;
...

there is a listener registered. the class of the listener is in the
entity project and thats the begining of the exception. hibernate want
to load it from his project with reflection.

i cant move the listener in the hibernate class, because ...

class UpdateListener {

@PrePersist
public void prePersist(Contact contact) {
System.out.println("PrePersist");
}

@PreUpdate
public void preUpdate(Contact contact) {
System.out.println("PreUpdate");
}
}

the methads have the entity in its parameters and this is not
accessable from "hibernate lib".

i need a dependency from hibernate to entity and from entity to
hibernate, or what can i do ?

thanks
stephan
Back to top
Fabrizio Giudici
Posted via mailing list.





PostPosted: Thu Sep 04, 2008 7:44 am    Post subject: Hibernate in Netbeans Platform and java.lang.IllegalAccessException Reply with quote

stephan diehl - open solutions gmbh & co. kg wrote:
Quote:
Hello,

i have a great problem with hibernate becaue of its dependencies.

now it is the following:

java.lang.IllegalAccessException: Class
org.hibernate.ejb.event.CallbackResolver can not access a member of
class net.opensolutions.project.entity.UpdateListener with modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
at java.lang.Class.newInstance0(Class.java:349)
at java.lang.Class.newInstance(Class.java:308)
at
org.hibernate.ejb.event.CallbackResolver.resolveCallback(CallbackResolver.java:135)


it is, because of this behavier:

i have two modules in this scenario. the first is "hibernate lib" with
all libraries for hibernate and the entity manager.
another project called "entity" has the entitys and is depending an
"hibernate lib", because of the javax.persistence-annotations in that
project.

now in this szenario, i have a entity class like this:

@Entity
@EntityListeners(value=UpdateListener.class)
public class Contact {

@Id
@GeneratedValue
private long id;

private String company;
private String title;
...

there is a listener registered. the class of the listener is in the
entity project and thats the begining of the exception. hibernate want
to load it from his project with reflection.

i cant move the listener in the hibernate class, because ...

class UpdateListener {

@PrePersist
public void prePersist(Contact contact) {
System.out.println("PrePersist");
}

@PreUpdate
public void preUpdate(Contact contact) {
System.out.println("PreUpdate");
}
}

the methads have the entity in its parameters and this is not
accessable from "hibernate lib".

i need a dependency from hibernate to entity and from entity to
hibernate, or what can i do ?

It might be, if there is a bug in Hibernate and it doesn't try to use
the same classloader as the Contact. But it could just be that
UpdateListener is not public, try it first.

--
f.g.
Back to top
stephan diehl - open solu
Posted via mailing list.





PostPosted: Thu Sep 04, 2008 12:23 pm    Post subject: Hibernate in Netbeans Platform and java.lang.IllegalAccessException Reply with quote

it is public. there was a classloader issue in hibernate i read
sometimes before. but i dont know the solution.

Am 04.09.2008 um 09:44 schrieb Fabrizio Giudici:

Quote:
stephan diehl - open solutions gmbh & co. kg wrote:
Quote:
Hello,

i have a great problem with hibernate becaue of its dependencies.

now it is the following:

java.lang.IllegalAccessException: Class
org.hibernate.ejb.event.CallbackResolver can not access a member of
class net.opensolutions.project.entity.UpdateListener with
modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:
65)
at java.lang.Class.newInstance0(Class.java:349)
at java.lang.Class.newInstance(Class.java:308)
at
org
.hibernate
.ejb.event.CallbackResolver.resolveCallback(CallbackResolver.java:
135)

it is, because of this behavier:

i have two modules in this scenario. the first is "hibernate lib"
with all libraries for hibernate and the entity manager.
another project called "entity" has the entitys and is depending an
"hibernate lib", because of the javax.persistence-annotations in
that project.

now in this szenario, i have a entity class like this:

@Entity
@EntityListeners(value=UpdateListener.class)
public class Contact {

@Id
@GeneratedValue
private long id;

private String company;
private String title;
...

there is a listener registered. the class of the listener is in the
entity project and thats the begining of the exception. hibernate
want to load it from his project with reflection.

i cant move the listener in the hibernate class, because ...

class UpdateListener {

@PrePersist
public void prePersist(Contact contact) {
System.out.println("PrePersist");
}

@PreUpdate
public void preUpdate(Contact contact) {
System.out.println("PreUpdate");
}
}

the methads have the entity in its parameters and this is not
accessable from "hibernate lib".

i need a dependency from hibernate to entity and from entity to
hibernate, or what can i do ?

It might be, if there is a bug in Hibernate and it doesn't try to
use the same classloader as the Contact. But it could just be that
UpdateListener is not public, try it first.

--
f.g.
Back to top
open solutions gmbh & co.
Posted via mailing list.





PostPosted: Thu Sep 04, 2008 2:34 pm    Post subject: Hibernate in Netbeans Platform and java.lang.IllegalAccessException Reply with quote

ok, it my stupidity. the listener was a inner class and not accessable
from hibernate! now it works with a real class.


Am 04.09.2008 um 09:44 schrieb Fabrizio Giudici:

Quote:
stephan diehl - open solutions gmbh & co. kg wrote:
Quote:
Hello,

i have a great problem with hibernate becaue of its dependencies.

now it is the following:

java.lang.IllegalAccessException: Class
org.hibernate.ejb.event.CallbackResolver can not access a member of
class net.opensolutions.project.entity.UpdateListener with
modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:
65)
at java.lang.Class.newInstance0(Class.java:349)
at java.lang.Class.newInstance(Class.java:308)
at
org
.hibernate
.ejb.event.CallbackResolver.resolveCallback(CallbackResolver.java:
135)

it is, because of this behavier:

i have two modules in this scenario. the first is "hibernate lib"
with all libraries for hibernate and the entity manager.
another project called "entity" has the entitys and is depending an
"hibernate lib", because of the javax.persistence-annotations in
that project.

now in this szenario, i have a entity class like this:

@Entity
@EntityListeners(value=UpdateListener.class)
public class Contact {

@Id
@GeneratedValue
private long id;

private String company;
private String title;
...

there is a listener registered. the class of the listener is in the
entity project and thats the begining of the exception. hibernate
want to load it from his project with reflection.

i cant move the listener in the hibernate class, because ...

class UpdateListener {

@PrePersist
public void prePersist(Contact contact) {
System.out.println("PrePersist");
}

@PreUpdate
public void preUpdate(Contact contact) {
System.out.println("PreUpdate");
}
}

the methads have the entity in its parameters and this is not
accessable from "hibernate lib".

i need a dependency from hibernate to entity and from entity to
hibernate, or what can i do ?

It might be, if there is a bug in Hibernate and it doesn't try to
use the same classloader as the Contact. But it could just be that
UpdateListener is not public, try it first.

--
f.g.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Platform Users All times are GMT
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo