gtfs-realtime-validator icon indicating copy to clipboard operation
gtfs-realtime-validator copied to clipboard

Tests fail on Apple Mac when building the project from command line

Open isabelle-dr opened this issue 3 years ago • 14 comments

Issue by lionel-nj Jan 19, 2022 Originally opened as https://github.com/CUTR-at-USF/gtfs-realtime-validator/issues/405


Summary:

Test sets fail when building the project from command line - which prevents the project from building.

Steps to reproduce:

After applying the fix suggested in https://github.com/MobilityData/gtfs-realtime-validator/issues/101, run mvn package at the root of the project.

Expected behavior:

Tests pass and project builds. An executable jar should be generated in target.

Observed behavior:

Failure in tests that prevent the project from building (see test reports.zip)

  • edu.usf.cutr.gtfsrtvalidator.api.resource.GtfsFeedTest
  • edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest Screen Shot 2022-02-22 at 3 58 41 PM

Interestingly, those test sets are successfully executed in IntelliJ.

"This might have something to do with the HSQLDB drivers on Mac, because those tests test queries against a HSQLDB instance using the JDBC drivers."

"I guess maybe IntelliJ is including something on the classpath that you're missing on command-line? Maybe the JDBC drivers?"

(from @barbeau).

Platform:

Mac M1 MacOS Big Sur 11.6 version Java 11.0.11

isabelle-dr avatar Feb 22 '22 20:02 isabelle-dr

Comment by barbeau Jan 19, 2022


Looks like these are related to Hibernate and database access for the web app during the test:

-------------------------------------------------------------------------------
Test set: edu.usf.cutr.gtfsrtvalidator.api.resource.GtfsFeedTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.011 s <<< FAILURE! - in edu.usf.cutr.gtfsrtvalidator.api.resource.GtfsFeedTest
testGtfsFeed(edu.usf.cutr.gtfsrtvalidator.api.resource.GtfsFeedTest)  Time elapsed: 0.01 s  <<< ERROR!
org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
	at edu.usf.cutr.gtfsrtvalidator.api.resource.GtfsFeedTest.setUp(GtfsFeedTest.java:44)
Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
	at edu.usf.cutr.gtfsrtvalidator.api.resource.GtfsFeedTest.setUp(GtfsFeedTest.java:44)
Caused by: java.lang.reflect.InvocationTargetException
	at edu.usf.cutr.gtfsrtvalidator.api.resource.GtfsFeedTest.setUp(GtfsFeedTest.java:44)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @7d934771
	at edu.usf.cutr.gtfsrtvalidator.api.resource.GtfsFeedTest.setUp(GtfsFeedTest.java:44)
-------------------------------------------------------------------------------
Test set: edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.568 s <<< FAILURE! - in edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest
testViewErrorLogModel(edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest)  Time elapsed: 0.529 s  <<< ERROR!
org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
	at edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest.setUp(QueryTest.java:65)
Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
	at edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest.setUp(QueryTest.java:65)
Caused by: java.lang.reflect.InvocationTargetException
	at edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest.setUp(QueryTest.java:65)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @7d934771
	at edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest.setUp(QueryTest.java:65)

testViewErrorSummaryModel(edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest)  Time elapsed: 0.027 s  <<< ERROR!
org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
	at edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest.setUp(QueryTest.java:65)
Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
	at edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest.setUp(QueryTest.java:65)
Caused by: java.lang.reflect.InvocationTargetException
	at edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest.setUp(QueryTest.java:65)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @7d934771
	at edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest.setUp(QueryTest.java:65)

isabelle-dr avatar Feb 22 '22 21:02 isabelle-dr

Does anyone else have an M1 Mac to test this issue?

There is a chance it may be resolved by PR https://github.com/MobilityData/gtfs-realtime-validator/pull/106 when that's merged.

barbeau avatar Feb 23 '22 19:02 barbeau

Just tried to build the project from the command line in the #106 branch on my Mac M1, I still get the issue. Here is the surfire-reports.zip.

Screen Shot 2022-03-04 at 11 21 54 AM

This also fails from the IntelliJ terminal.

isabelle-dr avatar Mar 04 '22 16:03 isabelle-dr

@isabelle-dr What JDK version are you using to build?

barbeau avatar Mar 04 '22 16:03 barbeau

@barbeau 16.0.1. Should I update to 17 and see if this works?

isabelle-dr avatar Mar 04 '22 16:03 isabelle-dr

Yes, please try 17 and see if you get the same.

barbeau avatar Mar 04 '22 16:03 barbeau

Same result with JDK 17: test failures 😭

isabelle-dr avatar Mar 07 '22 15:03 isabelle-dr

Interesting - looks like you're getting different errors than Lionel:

-------------------------------------------------------------------------------
Test set: edu.usf.cutr.gtfsrtvalidator.api.resource.GtfsFeedTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 s <<< FAILURE! - in edu.usf.cutr.gtfsrtvalidator.api.resource.GtfsFeedTest
testGtfsFeed(edu.usf.cutr.gtfsrtvalidator.api.resource.GtfsFeedTest)  Time elapsed: 0 s  <<< ERROR!
java.lang.NullPointerException: Cannot invoke "java.lang.reflect.Method.invoke(Object, Object[])" because "com.sun.xml.bind.v2.runtime.reflect.opt.Injector.defineClass" is null
	at edu.usf.cutr.gtfsrtvalidator.api.resource.GtfsFeedTest.setUp(GtfsFeedTest.java:44)
-------------------------------------------------------------------------------
Test set: edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.183 s <<< FAILURE! - in edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest
testViewErrorLogModel(edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest)  Time elapsed: 0.155 s  <<< ERROR!
java.lang.NullPointerException: Cannot invoke "java.lang.reflect.Method.invoke(Object, Object[])" because "com.sun.xml.bind.v2.runtime.reflect.opt.Injector.defineClass" is null
	at edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest.setUp(QueryTest.java:65)

testViewErrorSummaryModel(edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest)  Time elapsed: 0.005 s  <<< ERROR!
java.lang.NullPointerException: Cannot invoke "java.lang.reflect.Method.invoke(Object, Object[])" because "com.sun.xml.bind.v2.runtime.reflect.opt.Injector.defineClass" is null
	at edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest.setUp(QueryTest.java:65)

barbeau avatar Mar 07 '22 23:03 barbeau

@isabelle-dr Could you try one more time, this time with JDK 17 running mvn clean package to make sure the previous build is deleted first?

barbeau avatar Mar 07 '22 23:03 barbeau

The issue persists.

isabelle-dr avatar Mar 10 '22 23:03 isabelle-dr

What stack trace are you seeing now? The one you previously saw in https://github.com/MobilityData/gtfs-realtime-validator/issues/102#issuecomment-1061228907, or the one Lionel saw in https://github.com/MobilityData/gtfs-realtime-validator/issues/102#issuecomment-1048207734?

barbeau avatar Mar 10 '22 23:03 barbeau

Here is exactly what I did:

  1. mvn clean package -> I got the error in the terminal, didn't open the surefire reports.
  2. mvn clean -> this is the output Screen Shot 2022-03-10 at 7 07 03 PM
  3. mvn package Screen Shot 2022-03-10 at 7 10 22 PM

Here is the surefire-reports.zip. There are more files in it than last time...

This being said, the gtfs-realtime-validator-lib-1.0.0-SNAPSHOT.jar is created and it works perfectly. Here is the content of the "target" directory that was created when I ran mvn package. I then added the files TripUpdates.pb, gtfs.zip to run the validator on the JAR file and I got the results in TripUpdates.pb.results.json

Screen Shot 2022-03-10 at 7 21 01 PM

isabelle-dr avatar Mar 11 '22 00:03 isabelle-dr

Can you share the surefire-reports for the webapp project?

The one you linked only has the test results for the lib project.

From the above screenshot this should be in /users/isabelle/Documents/GitHub/gtfs-realtime-validator/gtfs-realtime-validator-webapp/target/surefire-reports.

We're specifically looking for the test results for GtfsFeedTest and QueryTest.

The reason why this is important is that right now we have two different sets of stack traces potentially related to this issue, and if we can narrow it back down to one (i.e., if your current output matches what Lionel originally saw) it will make it easier to fix the issue. The stack trace you previously saw should have been fixed in #106.

barbeau avatar Mar 11 '22 20:03 barbeau

Oh right - sorry about that 😅. Sure, here are the surefire-reports for the webapp: surefire-reports_webapp.zip. No more Hibernate here.

-------------------------------------------------------------------------------
Test set: edu.usf.cutr.gtfsrtvalidator.api.resource.GtfsFeedTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.001 s <<< FAILURE! - in edu.usf.cutr.gtfsrtvalidator.api.resource.GtfsFeedTest
testGtfsFeed(edu.usf.cutr.gtfsrtvalidator.api.resource.GtfsFeedTest)  Time elapsed: 0.001 s  <<< ERROR!
java.lang.NullPointerException: Cannot invoke "java.lang.reflect.Method.invoke(Object, Object[])" because "com.sun.xml.bind.v2.runtime.reflect.opt.Injector.defineClass" is null
	at edu.usf.cutr.gtfsrtvalidator.api.resource.GtfsFeedTest.setUp(GtfsFeedTest.java:44)
-------------------------------------------------------------------------------
Test set: edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.203 s <<< FAILURE! - in edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest
testViewErrorLogModel(edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest)  Time elapsed: 0.183 s  <<< ERROR!
java.lang.NullPointerException: Cannot invoke "java.lang.reflect.Method.invoke(Object, Object[])" because "com.sun.xml.bind.v2.runtime.reflect.opt.Injector.defineClass" is null
	at edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest.setUp(QueryTest.java:65)

testViewErrorSummaryModel(edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest)  Time elapsed: 0.005 s  <<< ERROR!
java.lang.NullPointerException: Cannot invoke "java.lang.reflect.Method.invoke(Object, Object[])" because "com.sun.xml.bind.v2.runtime.reflect.opt.Injector.defineClass" is null
	at edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest.setUp(QueryTest.java:65)

isabelle-dr avatar Mar 11 '22 21:03 isabelle-dr