小编use*_*690的帖子

对象同步

当同步块用于对象实例上的同步时,线程竞争进入对象的隐式监视器.一旦任何特定线程进入监视器,任何其他线程都必须等待进入它.然后

synchronized(object){
  // some code here
  // no function call
}
Run Code Online (Sandbox Code Playgroud)

不得强制执行任何特定类型的对象.因此,这里可以使用任何对象类型,因为每个对象都有其隐式监视器.

请回复我是真的吗?

java

8
推荐指数
2
解决办法
4160
查看次数

PKIX路径验证失败:java.security.cert.CertPathValidatorException:签名检查失败

来自Carlo Scarioni的Pro Spring Security书籍,我正在尝试将Spring Application与CAS Server集成.我按照书中指示的每一步,仍然坚持这个错误.请帮帮我.

SEVERE: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: signature check failed
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: signature check failed
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1904)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:279)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:273)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1446)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:209)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:901)
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:837)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1023)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1332)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1359)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1343)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1301)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at org.jasig.cas.client.util.CommonUtils.getResponseFromServer(CommonUtils.java:311)
    at org.jasig.cas.client.util.CommonUtils.getResponseFromServer(CommonUtils.java:291)
    at org.jasig.cas.client.validation.AbstractCasProtocolUrlBasedTicketValidator.retrieveResponseFromServer(AbstractCasProtocolUrlBasedTicketValidator.java:32)
    at org.jasig.cas.client.validation.AbstractUrlBasedTicketValidator.validate(AbstractUrlBasedTicketValidator.java:187)
    at org.springframework.security.cas.authentication.CasAuthenticationProvider.authenticateNow(CasAuthenticationProvider.java:140)
    at org.springframework.security.cas.authentication.CasAuthenticationProvider.authenticate(CasAuthenticationProvider.java:126)
    at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:156)
    at org.springframework.security.cas.web.CasAuthenticationFilter.attemptAuthentication(CasAuthenticationFilter.java:242)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:195)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) …
Run Code Online (Sandbox Code Playgroud)

cas spring-security digital-signature

8
推荐指数
4
解决办法
5万
查看次数

约书亚布洛赫的有效Java中的等价方法

请查看Joshua Bloch的Effective Java 链接.

在第二段中,作者说:

该类是私有的或包私有的,并且您确定它的equals方法永远不会被调用.可以说,在这些情况下应该覆盖该equals方法,以防它被意外调用:

@Override public boolean equals(Object o) {
     throw new AssertionError(); // Method is never called
}
Run Code Online (Sandbox Code Playgroud)

请解释一下.我对作者使用术语私有类感到困惑,并且当我们确定不会被调用时,为什么需要重写equals方法.

java equals effective-java

7
推荐指数
1
解决办法
2209
查看次数

Tomcat找不到直接放在classes文件夹下的类

我有以下JSP:

<%@ page import="foo.*" %>
<html>
    <body>
        The page count is:
        <%=Counter.getCount()%>
    </body>
    </html>
Run Code Online (Sandbox Code Playgroud)

我有一个Counterfoo中的类,存储在:

C:\ Apache的Tomcat的6.0.32 \的webapps \神\ WEB-INF \班

容器可以从包中找到类foo.

但是,当我尝试直接添加一些其他类文件\WEB-INF\classes而不是在任何特定的包中foo,然后容器找不到该类.

这是怎么造成的,我该如何解决?

java jsp

2
推荐指数
1
解决办法
3761
查看次数

字符串对象实例

可能重复:
基本Java问题:字符串相等

特定

String s= "God";
String k= "God";
Run Code Online (Sandbox Code Playgroud)

都将sk被认为是指同一个String对象吗?是否有一个String对象实例?

java

1
推荐指数
1
解决办法
206
查看次数