ObjectDB ObjectDB

Standalone server needs dependencies?

#1

When I connect to embedded server it works good.  But when I connect to a standalone server, it will have invocation errors like can't find getters and setters.  To solve this I had to export my persistence classes to a jar in the server and add it to the class path when starting the server.  There is nothing in the Docs that mention this, so I am wondering if I'm doing it wrong?

edit
delete
#2

The classes are normally not needed on the server. They are needed if you use methods in queries (which is not very efficient and not portable), and the server needs the code to execute the queries.

ObjectDB Support
edit
delete
#3

How do I control whether the queries use methods or not?  My query was a simple select statement with a where clause like where t.id=:id and t.range=:range. In fact I just removed all queries and simply called EntityManager em = emf.createEntityManager(); and it threw the exception 

Exception in thread "main" [ObjectDB 2.8.3] javax.persistence.PersistenceException
Failed to locate set method for field property com.xxx.aaa.model.ActionMessage.trackerType using reflection (error 363)
    at com.objectdb.jpa.EMF.createEntityManager(EMF.java:152)
    at com.xxx.aaa.bbb.ccc.ODBService.doTransaction(ODBService.java:55)
    at com.xxx.aaa.bbb.ccc.ODBService.main(ODBService.java:119)
Caused by: com.objectdb.o.UserException: Failed to locate set method for field property com.xxx.aaa.model.ActionMessage.trackerType using reflection
    at com.objectdb.o.MSG.a(MSG.java:77)
    at com.objectdb.o.UMR.s(UMR.java:944)
    at com.objectdb.o.UMR$k.y(UMR.java:1408)
    at com.objectdb.o.MMM.<init>(MMM.java:306)
    at com.objectdb.o.UTY.g(UTY.java:653)
    at com.objectdb.o.UTY.C(UTY.java:426)
    at com.objectdb.o.TYS.k(TYS.java:178)
    at com.objectdb.o.TYM.Z(TYM.java:546)
    at com.objectdb.o.TYM.<init>(TYM.java:196)
    at com.objectdb.o.MST.aA(MST.java:204)
    at com.objectdb.o.SHN.X(SHN.java:309)
    at com.objectdb.o.SHN.Q(SHN.java:260)
    at com.objectdb.o.SHN.w(SHN.java:124)
    at com.objectdb.o.HND.run(HND.java:134)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoSuchMethodException: com.xxx.aaa.model.ActionMessage.setTrackerType(java.lang.String)
    at java.lang.Class.getDeclaredMethod(Class.java:2130)
    at com.objectdb.o.UMR$k.y(UMR.java:1384)
edit
delete
#4

Sorry for tripple post, something is wrong with forum.  After edit, it does not save.

edit
delete
#5

It doesn't seem to be related to methods in queries.

Is the stack trace in #3 above generated when the entity classes are not added to the server?

What can you tell about the field: ActionMessage.trackerType, which is mentioned in the exception?

ObjectDB Support
edit
delete
#6

Actually I removed all queries and simply called EntityManager em = emf.createEntityManager(); 

And it still happens.  That method is simply:

 

    public String getTrackerType() {
        return trackerType;
    }
    public void setTrackerType(String trackerType) {
        this.trackerType = trackerType;
    }
edit
delete
#7

OK I got it working, I had to move the @Id annotation from the getter getUserId() to the field userId.  Then reset the database, then it does not need the POJO in the class path after!

edit
delete
#8

Thank you for the update. This is still unexpected, as the server should work with property access as well, with no need for access to the classes. Anyway, if you are happy with the solution then that is good. If not, you will have to post a minimal runnable example that demonstrates the issue for further investigation of this issue.

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.