我一直在使用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中的服务始于&#34; get&#34;而不是&#34;找到&#34;。我想也许tomcat很困惑,所以我改变了#34; get&#34;到&#34;获取&#34;。没有帮助。我在这里读到的不是写#34;?1&#34;我应该写&#34;:text&#34;。但要明白用#34;?&#34;工作了一年多,所以我有很多参数&#34;?&#34; - 为烦人的bug做了太多工作(它工作了一年多)。我已经检查了所有文件,今天没有任何重要内容发生变化,所以我不知道是什么文件造成的。
在乞讨时它只发生在我身上,但现在发生在一位同事身上。我们使用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。
我该怎么办?这是一个非常大的问题,也许我只是错过了一个小小的故障......这是什么?
答案 0 :(得分:4)
是什么修正了'?' to: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);
解决了这个问题。
答案 1 :(得分:0)
我可以通过以下方式工作
带参数 @Query(值=“ SELECT * FROM代理限制:start,:length”,nativeQuery = true) public List getAll(@Param(“ start”)int start,@Param(“ length”)int length);
没有参数 @Query(值=“ SELECT * FROM代理限制:start,:length”,nativeQuery = true) 公共列表getAll(int start,int length);
答案 2 :(得分:0)
这个问题太老了,但我遇到了同样的问题。我的问题是由于tomcat
版本造成的。我从tomcat 7
切换回tomcat 8
,代码开始按预期工作。
似乎Tomcat 8
中的?
不支持Native Query
。