0
set 26, 2014 5:13:00 PM org.glassfish.tyrus.core.AnnotatedEndpoint callMethod
INFO: Exception thrown from onError method public void main.scala.SocksEndpoint2.onError(javax.websocket.Session,java.lang.Throwable).
javax.websocket.DeploymentException: Component provider threw exception when providing instance of class main.scala.SocksEndpoint2.
什么可以导致此?我使用的是终点几乎是一座空城:部署异常与WebSockets,TyrusServer
@ServerEndpoint("/websocks")
class SocksEndpoint2(system: ActorSystem) {
@OnMessage
def onMessage(mess: String, session: Session) {
}
@OnClose
def onClose(session: Session) {
}
@OnError
def onError(session: Session , t: Throwable) {
}
}
和发送通过JavaScript
var exampleSocket = new WebSocket("ws://localhost:8025/websocks")
exampleSocket.send("{}")
并返回上述错误。
你明显遇到SocksEndpoint2类实例化的问题。它必须是公共的,并且必须具有零参数的构造函数 - 能够执行类似“Class.forName(...)。newInstance()”的操作。 – 2014-09-27 00:12:01
他也可以用'ServerEndpointConfig.Configurator'和它的'getInstance()'调用 – 2014-10-02 14:32:39
@PavelBucek自己来处理实例化,如果你将你的评论添加为答案我会标记为正确:) – LowFieldTheory 2014-10-02 22:00:43