MobilityData / gtfs-realtime-validator

Java-based tool that validates General Transit Feed Specification (GTFS)-realtime feeds
Other
38 stars 9 forks source link

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

Open isabelle-dr opened 2 years ago

isabelle-dr commented 2 years ago

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)

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 commented 2 years ago

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)
barbeau commented 2 years ago

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.

isabelle-dr commented 2 years ago

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.

barbeau commented 2 years ago

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

isabelle-dr commented 2 years ago

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

barbeau commented 2 years ago

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

isabelle-dr commented 2 years ago

Same result with JDK 17: test failures šŸ˜­

barbeau commented 2 years ago

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 commented 2 years ago

@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?

isabelle-dr commented 2 years ago

The issue persists.

barbeau commented 2 years ago

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?

isabelle-dr commented 2 years ago

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
barbeau commented 2 years ago

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.

isabelle-dr commented 2 years ago

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)