Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
isabelle-dr opened this issue Feb 22, 2022 · 14 comments
Open
Labels
Milestone

Comments

@isabelle-dr
Copy link

Issue by lionel-nj
Jan 19, 2022
Originally opened as CUTR-at-USF#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 #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 isabelle-dr added this to the v1.0 milestone Feb 22, 2022
@isabelle-dr
Copy link
Author

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
Copy link
Member

barbeau commented Feb 23, 2022

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

There is a chance it may be resolved by PR #106 when that's merged.

@isabelle-dr
Copy link
Author

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
Copy link
Member

barbeau commented Mar 4, 2022

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

@isabelle-dr
Copy link
Author

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

@barbeau
Copy link
Member

barbeau commented Mar 4, 2022

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

@isabelle-dr
Copy link
Author

Same result with JDK 17: test failures 😭

@barbeau
Copy link
Member

barbeau commented Mar 7, 2022

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
Copy link
Member

barbeau commented Mar 7, 2022

@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
Copy link
Author

The issue persists.

@barbeau
Copy link
Member

barbeau commented Mar 10, 2022

What stack trace are you seeing now? The one you previously saw in #102 (comment), or the one Lionel saw in #102 (comment)?

@isabelle-dr
Copy link
Author

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
Copy link
Member

barbeau commented Mar 11, 2022

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
Copy link
Author

isabelle-dr commented Mar 11, 2022

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants