"No such field" Exception when trying to login using Java API

1
0
-1

Hello, I have a server running Bonita BPM. So far the platform can be accessed using a browser and with the REST API, however, trying to login using the Java API results in some strange exceptions being thrown. Has anyone had this problem before? Did I maybe forget to set something in a config file somewhere or so?

Bonita BPM vers: 6.3.1 OS: Windows 8.1 Deployed with: JBoss-5.0 Java Version: 1.6

I basically just took this project: https://github.com/bonitasoft/bonita-examples/tree/1.0.x and then: - performed a successful mvn clean install - imported it into eclipse - updated bonita-client.properties with the right http address - and then created a new main class with nothing but the following code:

  1. LoginAPI loginAPI = TenantAPIAccessor.getLoginAPI();
  2. APISession apiSession = loginAPI.login("TestUser", "welcome"); // Error occurs here
  3. ProcessAPI processAPI = TenantAPIAccessor.getProcessAPI(apiSession);

Stacktrace:

  1. Exception in thread "main" com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$UnknownFieldException: No such field org.bonitasoft.engine.session.impl.APISessionImpl.tenantName
  2. ---- Debugging information ----
  3. field : tenantName
  4. class : org.bonitasoft.engine.session.impl.APISessionImpl
  5. required-type : org.bonitasoft.engine.session.impl.APISessionImpl
  6. converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
  7. path : /org.bonitasoft.engine.session.impl.APISessionImpl/tenantName
  8. line number : 9
  9. version : null
  10. -------------------------------
  11. at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.determineType(AbstractReflectionConverter.java:453)
  12. at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:294)
  13. at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:234)
  14. at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
  15. at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
  16. at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
  17. at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
  18. at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
  19. at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
  20. at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1052)
  21. at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1024)
  22. at com.thoughtworks.xstream.XStream$2.readFromStream(XStream.java:1716)
  23. at com.thoughtworks.xstream.core.util.CustomObjectInputStream.readObjectOverride(CustomObjectInputStream.java:104)
  24. at java.io.ObjectInputStream.readObject(Unknown Source)
  25. at org.bonitasoft.engine.api.HTTPServerAPI.fromXML(HTTPServerAPI.java:244)
  26. at org.bonitasoft.engine.api.HTTPServerAPI.checkInvokeMethodReturn(HTTPServerAPI.java:146)
  27. at org.bonitasoft.engine.api.HTTPServerAPI.invokeMethod(HTTPServerAPI.java:132)
  28. at org.bonitasoft.engine.api.impl.ClientInterceptor.invoke(ClientInterceptor.java:88)
  29. at com.sun.proxy.$Proxy0.login(Unknown Source)
  30. at org.bonitasoft.example.App.main(App.java:36)
1 answer

1
0
-1
This one is the BEST answer!

Hookay, seems like the cause of the error was sitting ~40cm in front of my monitor...

To get it working I did the following: - Edit the POM file to match Bonita version 6.3.1 (The example was still on 6.2.2) - Redo the Maven clean install - Update the bonita-client.properties with the right http address (again)

I figured out what was wrong by going through the documentation step by step and checking to see if everything matches up: http://documentation.bonitasoft.com/create-your-first-project-engine-api...

..."The bonita home used must have the same version as the Bonita BPM Engine" is what tipped me off.

Comments

Submitted by rpatal on Mon, 11/17/2014 - 22:22

Thanks for sharing the solution. It was really helpful!

Notifications