草庐IT

nullable-reference-types

全部标签

java - Play Framework : PersistenceException: The type is not a registered entity? (Ebean)

我正在学习适用于Java的PlayFramework2.0教程,但在尝试保存ebean模型(task.save())时遇到此错误。[PersistenceException:Thetype[classmodels.Task]isnotaregisteredentity?Ifyoudon'texplicitlylisttheentityclassestouseEbeanwillsearchforthemintheclasspath.IftheentityisinaJarchecktheebean.search.jarspropertyinebean.propertiesfileorche

java - 得到一个 The entity name must immediately follow the '&' in the entity reference error in java, 但我的 xml 文件中没有任何符号

我遇到了错误Theentitynamemustimmediatelyfollowthe'&'intheentityreference.但我的XML文档中没有任何符号!有谁知道为什么会发生这种情况?这是我要解析的XML文档:BestiPadstrategygameshttp://feedproxy.google.com/~r/TheIphoneBlog/~3/198mhX3FVmw/story01.htmShareyourlifewithfriendsinrealtimewithSpinhttp://feedproxy.google.com/~r/TheIphoneBlog/~3/9G8

java - 注释 "not applicable to type"

多年来我一直是IntelliJ的Eclipse用户,所以我真的发现了这个错误,所有对@Override的注释都显示错误“notapplicabletotype”例如,来自JBossErrai的@PostConstruct注释到处都显示此错误,其中导入完全没有错误。我该如何解决这个问题?更新:例如@PostConstruct//Whenhoveredwiththemousepointer'@PostContruct'isnotapplicabletomethodpublicvoidinit(){}截图:http://snag.gy/q5cW5.jpg 最佳答案

java - 使用 Java ODBC 创建连接会导致 java.sql.SQLException : Invalid Cursor Type exception

我正在尝试创建一个访问ODBC数据源的Java程序。使用以下代码...Connectionconn;try{Driverd=(Driver)Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();DriverManager.registerDriver(d);StringURL="jdbc:odbc:ARSystemODBCDataSource";conn=DriverManager.getConnection(URL);}catch(SQLException|InstantiationException|IllegalA

java - 混合模式下的 jstack : WrongTypeException: No suitable match for type of address

我正在尝试以混合模式在ubuntu上运行jstack:$jstack-m7219结果是这个异常:AttachingtoprocessID7219,pleasewait...Debuggerattachedsuccessfully.Servercompilerdetected.JVMversionis25.162-b12Exceptioninthread"main"java.lang.reflect.InvocationTargetExceptionatsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.refl

java - 有没有关于 Gson "circular reference"的解决方案?

我找了很多关于Gson循环引用的文章,但是我找不到一个优雅的解决方案。据我所知,一些解决方案是:将导致循环引用的属性设置为“transient”。用一些注释排除属性。但作为一个一般性问题,是否有一些通用的策略来解决这个问题? 最佳答案 据我所知,在Gson中没有针对循环引用的自动化解决方案。我所知道的唯一一个自动处理循环引用的生成JSON的库是XStream(使用Jettison后端)。编辑:Jackson还支持使用@JsonIdentityInfo注释处理循环引用;因此虽然不是自动的(您确实需要标记需要处理对象ID的引用),但它确

Java 泛型 : how to get a generic type from a method?

虽然我的问题是关于Java泛型的,但我已经放了一些与JPA相关的代码来向您展示真实的上下文。我正在使用JPA2.0和基于CriteriaAPI的查询。我所有的查询都遵循相同的模式(比较简单的属性;不需要路径导航),所以我试图编写一个通用类来处理JPA,同时将业务逻辑保留在单独的类中。我的目标是有一个方法,给定一个实体类型和一个存储定义标准的对(字段名称->期望值)的映射,返回一个具有某些实体字段值的bean(或bean集合).我所有的实体都实现了Persistible接口(interface),而我所有的传输对象都继承自QueryBean.我认为那些类与问题无关,因此我跳过了它们的代码

java - Spring PUT 请求 : Unsupported Media Type (Code: 415)

我有一个相当晦涩的问题,经过几天的调试后我无法弄清楚。问题是我们的PUTRESTAPI之一开始在生产中抛出UnsupportedMediatype。下面是方法的定义:@RequestMapping(value="/v1/put/user/profile",method=RequestMethod.PUT)publicStringupdateProfile(@RequestBodyUserAndroiduser,ModelMapmodel,HttpServletRequestrequest,HttpServletResponseresponse){}在PUT请求中,我们只是传递手机号码,

java - Guice TypeListener 未收到有关注入(inject)类 Type 的通知

我有以下Guice模块:classMyModuleextendsAbstractModule{@Overrideprotectedvoidconfigure(){bindListener(Matchers.any(),newTypeListener(){...});}@ProvidesSomeClasscreateSomeClass(finalParameterparam){log(param.getValue());我发现奇怪的是,我的TypeListener没有收到有关Parameter类型的通知。即使提供者被调用并返回SomeClass。我还清楚地看到日志语句Parameter是

java - Spring 数据休息 : Detected multiple association links with same relation type

关于这个问题,我查了一下SpringDataRestAmbiguousAssociationException但无法让它为我工作。正如您在下面的代码中看到的,我添加了@RestResource注释,其中rel等于其他值。与上面的问题类似,POST请求有效,但是GET请求抛出关于具有相同关系类型的多个关联链接的异常:"CouldnotwriteJSON:Detectedmultipleassociationlinkswithsamerelationtype!Disambiguateassociation@org.springframework.data.rest.core.annotat