IllegalStateException with naming parameters in tomcat IllegalStateException with naming parameters in tomcat jenkins jenkins

IllegalStateException with naming parameters in tomcat


What fixed it is changing the '?' to :param and adding @Param("param") before the parameter in the method.

Meaning that the select method:

@Query(value = "SELECT * FROM agents limit ?1, ?2", nativeQuery = true)public List<AgentEntity> getAll(int start, int length);

has changed to

@Query(value = "SELECT * FROM agents limit :start, :length", nativeQuery = true)public List<AgentEntity> getAll(@Param("start") int start, @Param("length") int length);

That fixed the problem.


I can works in the following ways

  1. With param@Query(value = "SELECT * FROM agents limit :start, :length", nativeQuery = true)public List getAll(@Param("start") int start, @Param("length") int length);

  2. Without param@Query(value = "SELECT * FROM agents limit :start, :length", nativeQuery = true)public List getAll(int start,int length);


The question is too old but I faced the same issue. My issue was due to the tomcat version. I switched back to tomcat 7 from tomcat 8 and code starts working as expected.Seems like Tomcat 8 is not supporting ? in Native Query.