java ee - Can't invoke EJB/CDI bean -
i don't know application websocket (tyrus 1.1) can't invoke cdi or ejb bean. i'm running on glassfish 4.1 server-sent event, websocket 1.1, etc
when called jsf managed bean (cdi) websocket app, showed "error: weld-001303: no active contexts scope type org.omnifaces.cdi.viewscoped".
if called ejb stateless bean websocket app, showed messages follows:
warning: system exception occurred during invocation on ejb chatsessionbean, method: public com.mnik.chat.entity.chatinfo com.mnik.chat.ejb.chatsessionbean.findroomid(java.lang.string) warning: javax.ejb.ejbexception @ com.sun.ejb.containers.ejbcontainertransactionmanager.processsystemexception(ejbcontainertransactionmanager.java:750) @ com.sun.ejb.containers.ejbcontainertransactionmanager.checkexceptionnotx(ejbcontainertransactionmanager.java:640) @ com.sun.ejb.containers.ejbcontainertransactionmanager.postinvoketx(ejbcontainertransactionmanager.java:482) @ com.sun.ejb.containers.basecontainer.postinvoketx(basecontainer.java:4566) @ com.sun.ejb.containers.basecontainer.postinvoke(basecontainer.java:2074) @ com.sun.ejb.containers.basecontainer.postinvoke(basecontainer.java:2044) @ com.sun.ejb.containers.ejblocalobjectinvocationhandler.invoke(ejblocalobjectinvocationhandler.java:220) @ com.sun.ejb.containers.ejblocalobjectinvocationhandlerdelegate.invoke(ejblocalobjectinvocationhandlerdelegate.java:88) @ com.sun.proxy.$proxy427.findroomid(unknown source) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ org.jboss.weld.util.reflection.reflections.invokeandunwrap(reflections.java:414) @ org.jboss.weld.bean.proxy.enterprisebeanproxymethodhandler.invoke(enterprisebeanproxymethodhandler.java:127) @ org.jboss.weld.bean.proxy.enterprisetargetbeaninstance.invoke(enterprisetargetbeaninstance.java:56) @ org.jboss.weld.bean.proxy.injectionpointpropagatingenterprisetargetbeaninstance.invoke(injectionpointpropagatingenterprisetargetbeaninstance.java:65) @ org.jboss.weld.bean.proxy.proxymethodhandler.invoke(proxymethodhandler.java:100) @ com.mnik.chat.ejb.localchatsessionbean$59891376$proxy$_$$_weld$enterpriseproxy$.findroomid(unknown source) @ com.mnik.chat.server.chatserver.startchatchannel(chatserver.java:103) ... caused by: org.apache.shiro.unavailablesecuritymanagerexception: no securitymanager accessible calling code, either bound org.apache.shiro.util.threadcontext or vm static singleton. invalid application configuration. @ org.apache.shiro.securityutils.getsecuritymanager(securityutils.java:123) @ org.apache.shiro.subject.subject$builder.<init>(subject.java:627) @ org.apache.shiro.securityutils.getsubject(securityutils.java:56) @ com.mnik.intercept.shirosecurityinterceptor.interceptshirosecurity(shirosecurityinterceptor.java:37) @ sun.reflect.generatedmethodaccessor111.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ com.sun.ejb.containers.interceptors.aroundinvokeinterceptor.intercept(interceptormanager.java:883) @ com.sun.ejb.containers.interceptors.aroundinvokechainimpl.invokenext(interceptormanager.java:822) @ com.sun.ejb.ejbinvocation.proceed(ejbinvocation.java:608) @ org.jboss.weld.ejb.abstractejbrequestscopeactivationinterceptor.aroundinvoke(abstractejbrequestscopeactivationinterceptor.java:46) @ org.jboss.weld.ejb.sessionbeaninterceptor.aroundinvoke(sessionbeaninterceptor.java:52) @ sun.reflect.generatedmethodaccessor109.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ com.sun.ejb.containers.interceptors.aroundinvokeinterceptor.intercept(interceptormanager.java:883) @ com.sun.ejb.containers.interceptors.aroundinvokechainimpl.invokenext(interceptormanager.java:822) @ com.sun.ejb.ejbinvocation.proceed(ejbinvocation.java:608) @ com.sun.ejb.containers.interceptors.systeminterceptorproxy.docall(systeminterceptorproxy.java:163) @ com.sun.ejb.containers.interceptors.systeminterceptorproxy.aroundinvoke(systeminterceptorproxy.java:140) @ sun.reflect.generatedmethodaccessor110.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ com.sun.ejb.containers.interceptors.aroundinvokeinterceptor.intercept(interceptormanager.java:883) @ com.sun.ejb.containers.interceptors.aroundinvokechainimpl.invokenext(interceptormanager.java:822) @ com.sun.ejb.containers.interceptors.interceptormanager.intercept(interceptormanager.java:369) @ com.sun.ejb.containers.basecontainer.__intercept(basecontainer.java:4758) @ com.sun.ejb.containers.basecontainer.intercept(basecontainer.java:4746) @ com.sun.ejb.containers.ejblocalobjectinvocationhandler.invoke(ejblocalobjectinvocationhandler.java:212) ... 49 more
if have suggestion, please share us. thank you.
noted: these chatserver (websocket) class:
...
import javax.websocket.onerror; import javax.websocket.onmessage; import javax.websocket.onopen; import javax.websocket.session; import javax.websocket.server.pathparam; import javax.websocket.server.serverendpoint; import javax.websocket.server.serverendpointconfig; @serverendpoint(value = "/chat-server/{roomnumbers}", subprotocols = {"chat"}, decoders = {chatdecoder.class}, encoders = {chatencoder.class}, configurator = chatserverhttpssconfig.class) public class chatserver { public chatserver() { this.dateformat = new simpledateformat("hh:mm:ss"); } private final static string username_key = "username"; private final static string usernames = "usernames"; private final static string increased = "increased"; private final simpledateformat dateformat; private final static string associated_httpsession = "websocket_http_session"; private final static string roomnumbers = "roomnumbers"; private final static string usertype = "usertype"; private final static string agent = "agent"; private final static string client = "client"; private httpsession httpsession; private session session; @inject private localchatsessionbean localchatss; @inject private sseannounce sseannounce; @inject private productmsgstates productmsgstates; @onopen public void startchatchannel(@pathparam("roomnumbers") final string roomnumbers, final session session, endpointconfig epc) { //for forward-backward html page. serverendpointconfig endpointconfig = (serverendpointconfig) epc; chatserverhttpssconfig cshssc = (chatserverhttpssconfig) endpointconfig.getconfigurator(); //to associate httpsession this.httpsession = (httpsession) epc.getuserproperties().get(chatserverhttpssconfig.chat_http_session); this.session = session; this.session.getuserproperties().put(associated_httpsession, this.httpsession); //normal operation this.session.getuserproperties().put(roomnumbers, roomnumbers); system.out.println("roomnumber @ " + this.getclass() + ", id: " + roomnumbers); //when calling ejb or jsf managed bean, showed error. in example code, calls ejb. chatinfo chatinfo = localchatss.findroomid(roomnumbers); string productname = chatinfo.getproductname(); sessioninfo ssinfo = new sessioninfo(); ssinfo.setsessionid(this.session.getid()); ssinfo.setchatinfo(chatinfo); chatinfo.getsessionsids().add(ssinfo);
...
Comments
Post a Comment