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

ServletException - Could not locate ordinal parameter [0], expecting one of [1, 2, 3] #139

Closed
barbeau opened this issue Mar 23, 2022 · 1 comment · Fixed by #140
Closed
Labels
Milestone

Comments

@barbeau
Copy link
Member

barbeau commented Mar 23, 2022

Summary:

After bumping Hibernate dependency in both pom.xml files to:

<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-core</artifactId>
  <version>5.6.7.Final</version>
</dependency>

...the webapp starts up ok, but when it tries to show results in the web UI I see this error when the website hits the REST API endpoint:

[qtp2025322501-26] WARN org.eclipse.jetty.server.HttpChannel - /api/gtfs-rt-feed/monitor-data/1
javax.servlet.ServletException: java.lang.IllegalArgumentException: Could not locate ordinal parameter [0], expecting one of [1, 2, 3]
	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:423)
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:386)
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:334)
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:550)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
	at org.eclipse.jetty.server.Server.handle(Server.java:516)
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:383)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalArgumentException: Could not locate ordinal parameter [0], expecting one of [1, 2, 3]
	at org.hibernate.query.internal.ParameterMetadataImpl.getOrdinalParameterDescriptor(ParameterMetadataImpl.java:154)
	at org.hibernate.query.internal.ParameterMetadataImpl.getQueryParameter(ParameterMetadataImpl.java:204)
	at org.hibernate.query.internal.QueryParameterBindingsImpl.getBinding(QueryParameterBindingsImpl.java:183)
	at org.hibernate.query.internal.AbstractProducedQuery.setParameter(AbstractProducedQuery.java:519)
	at org.hibernate.query.internal.NativeQueryImpl.setParameter(NativeQueryImpl.java:656)
	at org.hibernate.query.internal.NativeQueryImpl.setParameter(NativeQueryImpl.java:66)
	at edu.usf.cutr.gtfsrtvalidator.api.resource.GtfsRtFeed.getMonitorData(GtfsRtFeed.java:200)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
	at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:308)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:291)
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1140)
	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:403)
	... 29 more

Steps to reproduce:

Update dependencies to:

<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-core</artifactId>
  <version>5.6.7.Final</version>
</dependency>

See example in PR #140.

Expected behavior:

Everything should work as in main branch - website should show validation results

Observed behavior:

Validation results are never shown in the website, and the console contains the above stacktrace.

Platform:

Windows 10 and JDK 17.0.2

@barbeau
Copy link
Member Author

barbeau commented Mar 23, 2022

If I run mvn test, I also see this test failure:

[main] INFO edu.usf.cutr.gtfsrtvalidator.db.GTFSDB - Table initialized successfully
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.127 s <<< FAILURE! - in edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest
[ERROR] testViewErrorLogModel(edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest)  Time elapsed: 0.619 s  <<< ERROR!
java.lang.IllegalArgumentException: Could not locate ordinal parameter [0], expecting one of [1, 2, 3]
        at edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest.testViewErrorLogModel(QueryTest.java:250)

[ERROR] testViewErrorSummaryModel(edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest)  Time elapsed: 0.507 s  <<< ERROR!
java.lang.IllegalArgumentException: Could not locate ordinal parameter [0], expecting one of [1, 2, 3]
        at edu.usf.cutr.gtfsrtvalidator.test.queries.QueryTest.testViewErrorSummaryModel(QueryTest.java:146)

[INFO] 
[INFO] Results:
[INFO]
[ERROR] Errors: 
[ERROR]   QueryTest.testViewErrorLogModel:250 » IllegalArgument Could not locate ordinal...
[ERROR]   QueryTest.testViewErrorSummaryModel:146 » IllegalArgument Could not locate ord...
[INFO]
[ERROR] Tests run: 3, Failures: 0, Errors: 2, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for gtfs-realtime-validator 1.0.0-SNAPSHOT:
[INFO]
[INFO] gtfs-realtime-validator ............................ SUCCESS [  0.005 s]
[INFO] gtfs-realtime-validator-lib ........................ SUCCESS [ 20.266 s]
[INFO] gtfs-realtime-validator-webapp ..................... FAILURE [01:46 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:07 min
[INFO] Finished at: 2022-03-23T16:48:42-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) on project gtfs-realtime-validator-webapp: There are test failures.

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