草庐IT

bars_by_name

全部标签

java.lang.IllegalArgumentException : Unknown parameter name : customer 异常

我正在尝试使用getNamedQuery方法创建一个列表,但我遇到了这个异常。这是我的代码publicListgetEquipsByCustomer(intcustomer){return(List)sessionFactory.getCurrentSession().getNamedQuery("getEquipsByCustomer").setParameter("customer",customer).list();}以及xml文件中的查询SELECTe.*FROMrequestrINNERJOINequipeONr.equip_id=e.equip_idINNERJOINcus

java - JAX-RS (Reasteasy) Response.readEntity 抛出 : IllegalStateException: RESTEASY003290: Entity is not backed by an input stream

我对发送JAX-RSPOST调用的方法进行了JUnit测试。为了独立于外部资源,我mock了REST客户端并表示应该返回一个虚拟响应。效果很好,没问题。但是:当调用myResponse.readEntity(String.class)时,我总是得到以下异常:java.lang.IllegalStateException:RESTEASY003290:Entityisnotbackedbyaninputstream这是我失败的代码片段:importcom.google.gson.JsonObject;importcom.google.gson.JsonPrimitive;importja

Java :Kill process runned by Runtime. getRuntime().exec()

我需要写一段代码,那使用Runtime.getRuntime().exec("java-jarMyServerRunner-portMYPORT");运行unix进程通过从java代码执行命令找到进程的PIDlsof-t-i:MYPORT并通过pidkill-9PID杀死他(也可以通过从java代码执行命令)然后执行其他命令但是如果我通过Runtime.getRuntime().exec()执行此命令,我的程序将以退出代码137退出-这意味着当我运行Runtime.getRuntime().exec("kill-9PID")我终止了我的java程序的进程,但不是我从代码运行的程序。我怎

java.lang.IllegalStateException : Neither BindingResult nor plain target object for bean name 'category' available as request attribute 错误

我在网上查看了几乎所有与此问题相关的答案,但无法找出我的代码中的问题。这是我的JSP页面。当我删除它工作正常。我可以与我的Controller通信。所以问题与这一行有关。@ControllerpublicclassSearchCategory{@AutowiredprivateCategoryServicecategoryService;@RequestMapping(value="/search_category",method=RequestMethod.POST)public@ResponseBodyStringsearchCategoryFromDatabase(@ModelA

Java 监视器 : How to know if wait(long timeout) ended by timeout or by Notify()?

首先,这是一个几乎重复的:Howtodifferentiatewhenwait(longtimeout)exitfornotifyortimeout?但这是一个新的后续问题。有这个等待声明:publicfinalnativevoidwait(longtimeout)throwsInterruptedException;它可能会因InterruptedException或超时而退出,或者因为在另一个线程中调用了Notify/NotifyAll方法,Exception很容易捕获但是...我的代码绝对需要知道退出是超时还是通知。(以后这段代码需要重新设计,但是现在做不到,所以需要知道退出wa

java - IntelliJ + 常规 DSL : How to exclude files from being compiled by groovy plugin?

我正在开发一个Java网络项目,该项目使用LiquibasegroovyDSL来管理数据库更改。就本主题而言,它可以是使用*.groovy文件作为源的任何其他第3方库。该项目是用gradle构建的。在src/main/resources文件夹下我的一个模块(dao-base)中我有groovy文件(changelog01.groovy,master_changelog.groovy等)。这些文件应该在运行时由liquibasejar加载。现在,当我尝试在IntelliJ中创建项目时,出现以下错误消息:Groovyc:CannotcompileGroovyfiles:noGroovyli

java - 解决 Java Checkstyle 错误 : Name 'logger' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'

使用EclipseCheckstyle插件我看到这个错误:Name'logger'mustmatchpattern'^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.我通过更改解决了这个错误:privatestaticfinalLoggerlogger=Logger.getLogger(someClass.class);到privatestaticfinalLoggerLOGGER=Logger.getLogger(someClass.class);为什么这是一个checkstyle警告? 最佳答案 因为该字段被标记为f

java - 处理 Set<Foo> 的元素并使用流创建 Set<Bar>

我有一个Set的"hostname:port"对,然后我想创建一个Set.我这样试过:SetISAAddresses=StrAddresses.stream().map(addr->newInetSocketAddress(addr.split(":")[0],Integer.parseInt(addr.split(":")[1])));但这会在IntelliJ中产生以下错误:Incompatibletypes.RequiredSetbut'map'wasinferredtoStream:noinstance(s)oftypevariable(s)RexistsothatStreamc

java.sql.SQLException : Invalid column name 异常

我不明白为什么我会在此处收到“无效的列名”。我们已经在Oracle中直接尝试了sql的一个变体,它工作正常,但是当我使用jdbcTemplate尝试它时,出现了问题。ListalleXmler=jdbcTemplate.query("selectp.applicationid,x.datadocumentid,x.datadocumentxml"+"fromCFUSERENGINE51.PROCESSENGINEp"+"leftjoinCFUSERENGINE51.DATADOCUMENTXMLx"+"onp.processengineguid=x.processengineguid"

java - eclipse 链接 : No Persistence provider for EntityManager named

我想创建一个能够使用JavaPersistence的Bundle。为此,我在Eclipse中创建了一个插件项目。在我的项目中,我在META-INF中创建了一个persistence.xml文件。我已经在我的MANIFEST.mf中添加了这3个包(到依赖项中):javax.persistence.jarorg.eclipse.persistence.jarorg.eclipse.persistence.jar然后,在我的Activator中,我使用以下行创建一个EntityManager:factory=Persistence.createEntityManagerFactory(PER