在tomcat中具有命名参数的IllegalStateException
我已经使用tomcat和spring很长时间了(一年多)。一切顺利。今天,突然我在启动tomcat时收到一个奇怪的错误:
Caused by: java.lang.IllegalStateException: Using named parameters for method
public abstract java.util.List
com.securegion.monitorcenter.dao.IncidentsViewRepository.getFixedIncidents(java.lang.String,java.util.List,java.lang.String,java.lang.String,int,int)
but parameter 'text' not found in annotated query 'select * from siemincidents
where fixed = 1 and descriptioninfo like %?1% and incidentseverity in ?2 and
starttimestamp >= ?3 and endtimestamp <= ?4 order by starttimestamp desc limit
?5, ?6'!
我不知道该怎么做,但是没人使用这种方法,所以我删除了它。然后我重新启动了tomcat,并得到了
Using named parameters for method public abstract java.util.List
com.securegion.monitorce
nter.dao.IncidentsViewRepository.getFixedIncidents(int,int) but parameter
'start' not found in annotated query 'select * from siemincidents where fixed
= 1 order by starttimestamp desc limit ?1, ?2'!
再次,我不知道这是什么,所以我完全从eclipse中删除了tomcat服务器,并再次创建了它。这个工作了半个小时,然后我遇到了同样的问题!而且,删除tomcat并没有帮助。奇怪的是DAO中的服务以“
get”而不是“ find”开头。我以为可能是tomcat感到困惑,所以我将“获取”更改为“获取”。没帮助
我在这里读到,而不是写“?1”,我应该写“:text”。但是明白用“?”写 工作了一年多,所以我有许多带有“?”的参数
-烦人的bug太多的工作(工作了一年多)。我已经检查了所有文件,今天没有什么重要的更改,所以我不知道是什么文件引起的。
乞讨只是发生在我身上,而现在却发生在一位同事身上。我们使用JENKINS部署服务器,JENKINS崩溃
ERROR: Build step failed with exceptionorg.codehaus.cargo.container.ContainerException: Failed to deploy [/etc/jenkins/jobs/mcg_DeployToDev/workspace/mcg/target/mcg.war]
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:107)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:185)
at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:73)
at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:116)
at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:103)
at hudson.FilePath.act(FilePath.java:989)
at hudson.FilePath.act(FilePath.java:967)
at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:103)
at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:61)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:761)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:721)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670)
at hudson.model.Run.execute(Run.java:1766)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:374)
Caused by: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - Deployed application at context path /mcg but context failed to start
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:566)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deployImpl(TomcatManager.java:611)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:291)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:102)
... 17 more
org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: FAIL - Deployed application at context path /mcg but context failed to start
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:566)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deployImpl(TomcatManager.java:611)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:291)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:102)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:185)
at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:73)
at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:116)
at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:103)
at hudson.FilePath.act(FilePath.java:989)
at hudson.FilePath.act(FilePath.java:967)
at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:103)
at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:61)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:761)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:721)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:670)
at hudson.model.Run.execute(Run.java:1766)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:374)
Build step 'Deploy war/ear to a container' marked build as failure
Finished: FAILURE
如果有关系,我正在使用tomcat 8。
我能做什么?这是一个巨大的问题,也许我只是错过了一个小故障……这是什么?
回答:
它固定了什么来改变“?” 到:param并在方法中的参数之前添加@Param(“ param”)。
表示选择方法:
@Query(value = "SELECT * FROM agents limit ?1, ?2", nativeQuery = true)public List<AgentEntity> getAll(int start, int length);
已更改为
@Query(value = "SELECT * FROM agents limit :start, :length", nativeQuery = true)public List<AgentEntity> getAll(@Param("start") int start, @Param("length") int length);
这解决了问题。
以上是 在tomcat中具有命名参数的IllegalStateException 的全部内容, 来源链接: utcz.com/qa/397292.html