3
這裏是我的代碼訂閱私人渠道,當我試圖使私人訂閱,然後我得到一個錯誤信息推錯誤:無法從你的webapp身份驗證信息:500(聚焦在500錯誤)
推錯誤消息:Couldn't get auth info from your webapp : 500
場景:
訂閱是在JavaScript中HTML文件:
在Java<!DOCTYPE html>
<head>
<title>Pusher Test</title>
<script src="https://js.pusher.com/3.2/pusher.min.js"></script>
<script>
// Enable pusher logging - don't include this in production
Pusher.logToConsole = true;
var pusher = new Pusher('9272f25541ab7b04fc60', {
authEndpoint: 'http://localhost:8080/medecube/rest/initial/pusher/auth',
auth: {
headers: {
'X-CSRF-Token': "12345"
}
}
});
var channel = pusher.subscribe('private-channel');
channel.bind('pusher:subscription_succeeded', function() {
var triggered = channel.trigger('client-myEvent', { "message": "i am pusher client" });
});
</script>
</head>
我JAX-RS web服務
@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.APPLICATION_JSON)
@Path("/pusher/auth")
public String processMessagesAndAuthentication(MultivaluedMap<String, String> input){
Pusher pusher = new Pusher("269783", "Pusher-key", "5bbebf61fb77dbef45bc");
String socket_id = input.getFirst("socket_id");
String channel_name = input.getFirst("channel_name");
String auth = pusher.authenticate(socket_id, channel_name);
return auth;
}
錯誤
POST http://localhost:8080/medecube/rest/initial/pusher/auth 500 (Internal Server Error)
pusher.min.js:8 Pusher : Couldn't get auth info from your webapp : 500
而且我Eclipse控制檯它顯示了不同類型的錯誤:
Caused by: java.lang.NoClassDefFoundError: org/apache/http/conn/HttpClientConnectionManager
java.lang.ClassNotFoundException: org.apache.http.conn.HttpClientConnectionManager from [Module "deployment.medecube.war:main" from Service Module Loader]