gpt4 book ai didi

java - tomcat中带有命名参数的IllegalStateException

转载 作者:行者123 更新时间:2023-11-28 22:05:29 25 4
gpt4 key购买 nike

我已经使用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搞糊涂了,就把“get”改成了“fetch”。没有帮助。我在这里读到,我应该写“:text”而不是写“?1”。但是理解用“?”写的工作了一年多,所以我有很多带有“?”的参数- 一个烦人的错误(它工作了一年多)太多的工作。我检查了我所有的文件,今天没有重要的变化,所以我不知道是什么文件引起的。

乞讨时它只发生在我身上,但现在它发生在同事身上。我们使用 JENKINS 来部署我们的服务器,而 JENKINS 在

ERROR: Build step failed with exception
org.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);

这解决了问题。

关于java - tomcat中带有命名参数的IllegalStateException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30508278/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com