When using inheritance throw exception java.lang.NoSuchFieldError: __odbTracker on NetBeans 7.3 Jboss 7.1.1 ObjectDB 2.5.1 -
when using inheritance throw exception java.lang.nosuchfielderror: __odbtracker on netbeans 7.3 + objectdb 2.5.1 + jboss 7.1.1, works fine on netbeans 7.3 + objectdb 2.5.1 + glassfish 3.1
@entity public class person extends abstractobject { private static final long serialversionuid = 1l; @manytoone @index private city city; @onetomany(mappedby = "owner") private list<city> cities; private string name; public string getname() { return name; } public void setname(string name) { this.name = name; } public city getcity() { return city; } public void setcity(city city) { this.city = city; } public list<city> getcitys() { return cities; } public void setcitys(list<city> citys) { this.cities = citys; } } @entity public class city extends abstractobject { private static final long serialversionuid = 33l; @onetomany(mappedby = "city") private list<person> persons; @manytoone @index private person owner; private string name; public string getname() { return name; } public void setname(string name) { this.name = name; } public list<person> getpersons() { return persons; } public void setpersons(list<person> persons) { this.persons = persons; } public person getowner() { return owner; } public void setowner(person owner) { this.owner = owner; } } @entity public abstract class abstractobject implements iabstractobject { //private static final long serialversionuid = 1l; @id private string id = uuid.randomuuid().tostring(); public string getid() { return id; } public void setid(string id) { this.id = id; } @override public int hashcode() { int hash = 0; hash += (id != null ? id.hashcode() : 0); return hash; } @override public boolean equals(object object) { // todo: warning - method won't work in case id fields not set if (!(object instanceof abstractobject)) { return false; } abstractobject other = (abstractobject) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @override public string tostring() { return "test.abstractobject[ id=" + id + " ]"; } }
this code throw exception:
person person = new person(); person.setname(name); city city = new city(); city.setname("Москва"); person.setcity(city); entitymanager.persist(city); entitymanager.persist(person);
the exception:
java.lang.nosuchfielderror: __odbtracker test.city.__odbset_name(city.java:1) test.city.setname(city.java:39) ejb.personbean.create(personbean.java:32) sun.reflect.nativemethodaccessorimpl.invoke0(native method) sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) java.lang.reflect.method.invoke(method.java:601) org.jboss.as.ee.component.managedreferencemethodinterceptorfactory$managedreferencemethodinterceptor.processinvocation(managedreferencemethodinterceptorfactory.java:72) org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:288) org.jboss.invocation.interceptorcontext$invocation.proceed(interceptorcontext.java:374) org.jboss.as.weld.ejb.jsr299bindingsinterceptor.domethodinterception(jsr299bindingsinterceptor.java:127) org.jboss.as.weld.ejb.jsr299bindingsinterceptor.processinvocation(jsr299bindingsinterceptor.java:135) org.jboss.as.ee.component.interceptors.userinterceptorfactory$1.processinvocation(userinterceptorfactory.java:36) org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:288) org.jboss.invocation.weavedinterceptor.processinvocation(weavedinterceptor.java:53) org.jboss.as.ee.component.interceptors.userinterceptorfactory$1.processinvocation(userinterceptorfactory.java:36) org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:288) org.jboss.as.jpa.interceptor.sbinvocationinterceptor.processinvocation(sbinvocationinterceptor.java:47) org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:288) org.jboss.as.weld.ejb.ejbrequestscopeactivationinterceptor.processinvocation(ejbrequestscopeactivationinterceptor.java:82) org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:288) org.jboss.invocation.initialinterceptor.processinvocation(initialinterceptor.java:21) org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:288) org.jboss.invocation.chainedinterceptor.processinvocation(chainedinterceptor.java:61) org.jboss.as.ee.component.interceptors.componentdispatcherinterceptor.processinvocation(componentdispatcherinterceptor.java:53) org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:288) org.jboss.as.ejb3.component.pool.pooledinstanceinterceptor.processinvocation(pooledinstanceinterceptor.java:51) org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:288) org.jboss.as.ejb3.tx.cmttxinterceptor.invokeinourtx(cmttxinterceptor.java:228) org.jboss.as.ejb3.tx.cmttxinterceptor.required(cmttxinterceptor.java:304) org.jboss.as.ejb3.tx.cmttxinterceptor.processinvocation(cmttxinterceptor.java:190) org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:288) org.jboss.as.ejb3.component.interceptors.currentinvocationcontextinterceptor.processinvocation(currentinvocationcontextinterceptor.java:41) org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:288) org.jboss.as.ejb3.component.interceptors.logginginterceptor.processinvocation(logginginterceptor.java:59) org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:288) org.jboss.as.ee.component.namespacecontextinterceptor.processinvocation(namespacecontextinterceptor.java:50) org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:288) org.jboss.as.ejb3.component.interceptors.additionalsetupinterceptor.processinvocation(additionalsetupinterceptor.java:32) org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:288) org.jboss.as.ee.component.tcclinterceptor.processinvocation(tcclinterceptor.java:45) org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:288) org.jboss.invocation.chainedinterceptor.processinvocation(chainedinterceptor.java:61) org.jboss.as.ee.component.viewservice$view.invoke(viewservice.java:165) org.jboss.as.ee.component.viewdescription$1.processinvocation(viewdescription.java:173) org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:288) org.jboss.invocation.chainedinterceptor.processinvocation(chainedinterceptor.java:61) org.jboss.as.ee.component.proxyinvocationhandler.invoke(proxyinvocationhandler.java:72) ejb.personbeanlocal$$$view66.create(unknown source) servlet.testservlet.processrequest(testservlet.java:68) servlet.testservlet.doget(testservlet.java:107) javax.servlet.http.httpservlet.service(httpservlet.java:734) javax.servlet.http.httpservlet.service(httpservlet.java:847) org.jboss.weld.servlet.conversationpropagationfilter.dofilter(conversationpropagationfilter.java:62)
if remove inheritance works fine. on glassfish 3.1 inheritance works fine.
why "person.setname(name);" works fine? "city.setname("Москва");" throw exception
thanks help.
if interested in answer - objectdb support
i added code in build.xml. project works fine.
<target name="-post-compile"> <java classname="com.objectdb.enhancer" fork="true" classpath="c:/projects/test/lib/objectdb.jar"> <arg line="-s ./build/classes/test/*.class"/> </java> </target>
Comments
Post a Comment