DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: Major Major
Assignee: Unassigned
Reporter: Joscha Feth
Votes: 0
Watchers: 1

If you were logged in you would be able to see more operations.
DataNucleus API REST

Querying all objects of a class returns 404

Created: 08/Aug/11 01:24 AM   Updated: 30/Apr/12 12:02 PM   Resolved: 30/Apr/12 10:37 AM
Component/s: None
Affects Version/s: 3.0.0.release
Fix Version/s: None

File Attachments: 1. Zip Archive (7 kB)
2. Text File server.log (56 kB)
3. Text File testcase (client).log (38 kB)

Environment: OSX Lion, HBase 0.90.2

Forum Thread URL:,6759
Datastore: HBase
Severity: Production

 Description  « Hide
When using datanucleus-3.0.0-release REST, fetching all objects of a class (first one here returns a 404 Not Found:

-- 8< --
curl -v http://localhost:8080/dn/com.MyClass
* About to connect() to localhost port 8080 (#0)
* Trying ::1... connected
* Connected to localhost (::1) port 8080 (#0)
> GET /dn/com.MyClass HTTP/1.1
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
> Host: localhost:8080
> Accept: */*
< HTTP/1.1 404 Not Found
< Content-Length: 0
< Server: Jetty(7.4.5.v20110725)
* Connection #0 to host localhost left intact
* Closing connection #0
-- 8< --

whereas a query for a single object completes successfully.
After debugging into it, I got the feeling it has something to do with the primary key not getting correctly calculated.

My setup is as follows:



<web-app xmlns="" version="2.5">



<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns=""

<persistence-unit name="transactions-optional"
<exclude-unlisted-classes />
<property name="datanucleus.ConnectionURL" value="hbase" />
<property name="datanucleus.ConnectionUserName" value="" />
<property name="datanucleus.ConnectionPassword" value="" />
<property name="datanucleus.autoCreateTables" value="true" />
<property name="datanucleus.autoCreateColumns" value="true" />
<property name="datanucleus.Multithreaded" value="true" />


Queried Class:
@PersistenceCapable(table = "bla")
public class MyClass extends Model {

private static final long serialVersionUID = 1L;

@Persistent(primaryKey = "true", columns = { @Column(name = "id", allowsNull = "false") }, name = "id", valueStrategy = IdGeneratorStrategy.NATIVE, cacheable = "true")
protected String id;

Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 08/Aug/11 09:27 AM
Not reproduceable. You have to demonstrate with a testcase.
The current tests at
all work, when run against HSQLDB, or against HBase. When providing a test, provide it as a patch to the above so then if there is a problem the test becomes part of the test suite

Joscha Feth added a comment - 08/Aug/11 01:31 PM
Attached an example including a testcase.
When building the maven project, please make sure you skip the tests, because they fail before the included jetty has been started.

Do this:

mvn -DskipTests=true clean install
(other cmd) mvn jetty:run
mvn test

Andy Jefferson added a comment - 08/Aug/11 03:10 PM
Thx but this is not fitting in with our test suite hence no time to look at it. Our test suite starts up Jetty internally (which you can see in BasicTest). Consequently it is more portable and simpler to add tests.

Secondly you likely have an error in the log implying something along the lines of value generation hasn't been performed; this is because the person who wrote the REST plugin only implemented basic persistence

Joscha Feth added a comment - 08/Aug/11 03:21 PM
I apologize my test project does not fit in your test suite, but would you please be so kind and have a look at it nevertheless?
The problem is a critical one - it's not like there is some arbitrary almost-never-used functionality is not working and the forum thread (which is not by me) suggests others are also seeing this problem with 3.0.0-release.
You asked me to transform my error report into a test case, which I did, so it would be nice if you could spend the five minutes to run the (also integrated Jetty plus tests) with the three (!) lines of code I provided in my earlier comment.

Andy Jefferson added a comment - 08/Aug/11 04:06 PM
I already said, look in your log, and also said that the author of that plugin didnt allow for value strategies. Consequently it should be obvious what to do :-
1. either remove the value strategy from your code and re-run it
2. or contribute the code to plugins to generate values for any fields that need them generating, by inspecting the metadata to find any fields affected, and using the StoreManager to generate the value.

If you have a "critical" problem then the onus is on you, not me. DataNucleus provides the source code, and provides adequate mechanisms (contributions, donations, commercial support, etc) for users to push issues forward.

Joscha Feth added a comment - 10/Aug/11 04:54 AM
I removed "valueStrategy = IdGeneratorStrategy.NATIVE" from "MyClass" and added a setter for the ID instead. Does not seem to change anything. Still a 404 for the GET for all objects.

I will attach the logs (for the run with the value strategy) - I ran it with DEBUG but can not find any hints that anything went wrong.

With critical I did not mean especially for me, but in general the problem - not being able to query all persisted objects of a table seems to be ...unfortunate.

Joscha Feth added a comment - 10/Aug/11 04:54 AM
Log files

Joscha Feth added a comment - 26/Aug/11 05:40 AM
adding "identityType = IdentityType.APPLICATION" explicitly also does not seem to do the trick.

Andy Jefferson added a comment - 30/Apr/12 10:37 AM
Suggest you try SVN trunk since your test isn't matching our format, and SVN trunk has had significant changes