Results 1 to 9 of 9

Thread: building from source with openjdk7

  1. #1
    Join Date
    Aug 2010
    Location
    Goteborg, Sweden
    Posts
    434

    Default building from source with openjdk7

    I get these build errors at the Metadata project tests running:
    testToStringOfNewInstance(org.springframework.roo. metadata.DefaultMetadataServiceTest) Time elapsed: 0.216 sec <<< FAILURE!
    org.junit.ComparisonFailure: expected:<...faultMetadataService[:] validGets = 0, recu...> but was:<...faultMetadataService[@1b6d56] validGets = 0, recu...>
    Full error message at pastebin: Spring Roo 1.2 Build Source test error on openjdk7

    Any ideas what this could be? I'm going to try and build just this module.
    Last edited by MiB; Dec 12th, 2011 at 06:26 PM.

  2. #2
    Join Date
    Aug 2010
    Location
    Goteborg, Sweden
    Posts
    434

    Default

    The relevant test is failing in the toString method of DefaultMetadataService.java:
    Code:
    @Override
    	public final String toString() {
    		ToStringCreator tsc = new ToStringCreator(this);
    		tsc.append("validGets", validGets);
    		tsc.append("recursiveGets", recursiveGets);
    		tsc.append("cachePuts", cachePuts);
    		tsc.append("cacheHits", cacheHits);
    		tsc.append("cacheMisses", cacheMisses);
    		tsc.append("cacheEvictions", cacheEvictions);
    		tsc.append("cacheCurrentSize", getCacheSize());
    		tsc.append("cacheMaximumSize", getMaxCapacity());
    		return tsc.toString().replaceFirst("@[0-9a-f]{8}", ":");
    	}
    The relevant test in DefaultMetadataServiceTest.java:
    Code:
    private static final String TO_STRING_FOR_NEW_INSTANCE =
    		"[DefaultMetadataService:"  +
    		" validGets = 0," +
    		" recursiveGets = 0," +
    		" cachePuts = 0," +
    		" cacheHits = 0," +
    		" cacheMisses = 0," +
    		" cacheEvictions = 0," +
    		" cacheCurrentSize = 0," +
    		" cacheMaximumSize = 100000]";
    
    	@Test
    	public void testToStringOfNewInstance() {
    		assertEquals(TO_STRING_FOR_NEW_INSTANCE, new DefaultMetadataService().toString());
    	}
    It looks to me it's the replaceFirst call that fails in the regex evaluation for some reason as the hashcode with ":" isn't replaced. I'm not sure what it could be though.

    UPDATE
    There seems to be a problem with the toString method of the DefaultMetadataService class in my version of openjdk7 which causes a crash before returning. Possibly this is related to the hash not being replaced.
    Last edited by MiB; Dec 12th, 2011 at 04:22 PM.

  3. #3
    Join Date
    Aug 2010
    Location
    Goteborg, Sweden
    Posts
    434

    Default

    I replaced the ":" in "TO_STRING_FOR_NEW_INSTANCE" in the testToStringOfNewInstance() method with the hashcode in the error report. The metadata project built successfully, proving this bit was the only faulty part.

    The regex "@[0-9a-f]{8}" seem to be able to match the hashcode: "@1b6d56" fine, so I don't see why this replaceFirst call would fail.
    Last edited by MiB; Dec 12th, 2011 at 08:32 AM.

  4. #4
    Join Date
    Aug 2010
    Location
    Goteborg, Sweden
    Posts
    434

    Default

    After the above edit, I compiled Spring Roo Git source as of yesterday successfully. I can start the 1.2.0.BUILD-SNAPSHOT [rev 224082b] on openjdk7 on a Apple PowerPC Dual G5. On maven build however I get problems with generated "ToStringStyle" and some others.

    I'm pretty sure this is related to the toString() method I hacked as above, so I need this fixed. Any ideas on how to fix this seemingly simple problem with the old replaceFirst() method call?

  5. #5
    Join Date
    Dec 2005
    Posts
    929

    Default

    The DefaultMetadataServiceTest passes for me using OpenJDK 7 on Ubuntu 11.10. However, I get test failures in the WebXmlUtiltsTest.
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  6. #6
    Join Date
    Aug 2010
    Location
    Goteborg, Sweden
    Posts
    434

    Default

    Alan, interesting. Does this mean you also didn't get a runnable Spring Roo out of your build?

  7. #7
    Join Date
    Dec 2005
    Posts
    929

    Default

    Actually all the tests pass in Eclipse with openjdk 7. It appears the issue is with Maven and openjdk 7.

    I just tried openjdk 6 with maven and all is OK and some Google searching shows others having issues with Maven 3.0.3 and openjdk 7. I won't pursue this anymore with openjdk 7 until a newer version of Maven and openjdk 7 comes out. I suggest you use openjdk 6 for now.
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  8. #8

    Default

    glad to see you.going on :P

  9. #9
    Join Date
    Aug 2010
    Location
    Goteborg, Sweden
    Posts
    434

    Default

    Alan, I don't have workable openjdk 1.6 for my machine. However, I'm glad to inform you that the snapshot source for Roo 1.2.1 both does compile and run on openjdk7. It seems someone fixed these problems.

    I haven't evaluated if Roo 1.2.1 runs without errors on a real project, but I had a few problems on intial test running the roo-dev command. It runs fine but rendered one project uncompilable.
    Perhaps it would be better with building the 1.2Release code instead. How do you git clone the source for 1.2Release?

    Also, I've had problems like Ken Rimple and several others in assembling the spring roo project. Isn't mvn assembly:single the proper command?
    Last edited by MiB; Dec 19th, 2011 at 09:25 AM. Reason: more info

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •