草庐IT

Name_of_your_preference

全部标签

java - “Your security settings have blocked a local application from running” Java 8

我正尝试在我的Chrome窗口中运行一个小程序,但收到错误消息。我确实看到所有回复都告诉我将我的安全级别更改为中等,但版本8中不存在该选项。到目前为止,几个小时的谷歌搜索和向同学寻求帮助都没有取得任何进展。谁能给我点建议? 最佳答案 Medium在Java8u20中被移除:Medium(removedfromJava8Update20andlaterversions)Onlyunsignedapplicationsthatrequestallpermissionsareblocked.Allotherapplicationsarea

Java 泛型 : Bound mismatch: The type is not a valid substitute for the bounded parameter of the type

我遇到了以下问题:我有这些类和接口(interface)定义publicabstractclassViewModelRefreshPostListFragment>extendsRefreshPostListFragmentimplementsIRefreshPostView{privatefinalViewModelHelpermViewModeHelper=//errorherenewViewModelHelper();...}publicabstractclassRefreshPostViewModelextendsAbstractViewModel{}publicclassVi

java - Spring 安全抛出 javax.servlet.ServletException : Could not resolve view with name 'j_spring_security_check'

我正在尝试将具有自定义登录页面和数据库访问的Springsecurity添加到我的SpringMVC应用程序中。似乎我的映射是错误的,因为它无法映射j_spring_security_check。为了解决这个问题,我查看了以下页面1、2、3但仍无法解决问题。如果您没有太多时间,请阅读下面的第2部分,这是问题的编辑部分开始的地方。否则,请阅读第1部分和第2部分。第1部分我还在我的web.xml文件中添加了以下行,但应用程序返回以下异常。springSecurityFilterChainorg.springframework.web.filter.DelegatingFilterProxy

java - xs :integer to Java Integer instead of BigInteger 的 JAXB 绑定(bind)

应避免以下讨论。这个问题不是:使用xs:int代替xs:integer。使用原始int而不是Integer。你为什么需要这个。如果等等,你会怎么做问题:我想要一个jaxb绑定(bind)声明的示例来覆盖xs:integer到JavaBigInteger的默认映射,以便xjc生成JavaInteger。例如应该产生@XmlAttribute(name="id")Integerid;不是@XmlAttribute(name="id")BigIntegerid; 最佳答案 您可以将以下内容添加到您的绑定(bind)文件中:这将产生,例如:

java - Java读写XML数据文件报错"Premature end of file"

我一直在使用JDOM库通过JavaServlet读写XML文件。问题是,当我使用AJAX向读取和写入XML文件中的数据的servlet发送许多请求时,很多时候它无法显示错误:文件过早结束。我怎样才能将所有这些读/写同步到文件或者有没有其他方法可以防止这些问题?如果需要更多详细信息,请告诉我。在这种情况下使用线程会有什么好处吗?非常感谢! 最佳答案 两种可能的解决方案是:将您的文件写入thename.xml.part,然后在完成/关闭后重命名为thename.xml,这使得写入更接近于原子性——只要确定完成,读者就无法读取它它仅查找“

java - "instance of""type of"这个用例是什么?

在随意阅读时,我偶然发现了ScottMeyers的一句有趣的话Anytimeyoufindyourselfwritingcodeoftheform"iftheobjectisoftypeT1,thendosomething,butifit'softypeT2,thendosomethingelse,"slapyourself.我只是想知道为什么Java有“instanceof”运算符,而你可以通过覆盖方法做同样的事情?什么时候实际使用? 最佳答案 有时您必须使用其行为(例如源代码)您无法控制的对象,因此您不能总是依赖面向对象的解决方

java - Maven 和代码指标 : check for existence of a test case for each class

在Maven中是否可以使用某些东西来自动执行这种检查?我看到了checkstyle和PMD,但没有找到此功能。基本上,如果有类A而没有ATestCase,我希望构建失败。我知道,这不是一个严格的检查,可以通过只创建类轻松绕过,但目前这就足够了。 最佳答案 你在找什么正如JensPiegsa指出的那样,您正在寻找的是一种可以显示测试覆盖率的工具,换句话说,就是您测试使用的代码百分比。它允许您以比(至少按类测试)更可靠的方式查看您的代码测试了多少。您可以使用Cobertura,它很好地集成在Maven中:http://mojo.code

java - 如何删除 'Assignment of Parameter ' 变量'不允许'

我正在使用Java编写Controller程序,并使用Sonar检查样式。在我的Sonar中,我有一条错误消息:'AssignmentofParameter'variable'isnotallowed.它所在的线路是:@RequestParam(value="variable",required=false)Stringvariable所以我想知道如何消除该错误,因为我不能在使用该注释时只创建一个setter。编辑我正在使用Eclipse。被打破的规则是ParameterAssignment。@RequestParam(value="variable",required=false)S

java - Camel cxf :cxfEndpoint Producer error : Can't find the BindingOperationInfo with operation name

我正在使用camelcxf:cxfEndpoint调用soap服务,但收到此BindingOperationInfo错误。配置对我来说看起来是正确的,但不确定我哪里做错了。端点配置:我的JavaDSL路由器配置。from("direct:invokeMyUpdate").bean("myAcctSvcClient","buildSoapReq").setHeader(CxfConstants.OPERATION_NAME,constant("getAccountInfo")).to("cxf:bean:accountEndpoint")WSDL元素:错误如下:Stacktrace:ja

javax.net.ssl.SSLException : Certificate for <> doesn't match any of the subject alternative names: [] 异常

当我尝试使用Postman访问URL时,它工作正常,通过使用我的个人证书。但是当我使用RestAssured测试用例尝试相同时,它抛出上述异常。配置类publicclassConfiguration{protectedSSLConfigconfig=null;privatestaticfinalLoggerLOG=LoggerFactory.getLogger(Configuration.class);@SuppressWarnings("deprecation")@BeforeClasspublicvoidsetKeystore(){KeyStorekeyStore=null;Key