Hello,
I am trying to create a Webservice class in the app-portal. It is currently using the @WebService annotation. This along with some entries in the web.xml and a configuration similar to this ( https://www.mkyong.com/webservices/jax-ws/deploy-jax-ws-web-services-on-tomcat/ ) I am able to call the web service just fine, but I cant seem to go anywhere past this.
If I try and use the @Inject annotation to call any of the services that have been created in the Cuba environment, they are always null at runtime so it throws a Null Pointer Exception. I’m assuming this is because my webservice class is not in the spring container.
If I try and use the AppBeans.get() method like
private MyService myService = AppBeans.get(MyService .class);
This seems to work, however when I try and access this service I get a run time error of
13:46:14.231 ERROR c.h.cuba.core.sys.ServiceInterceptor - Exception:
java.lang.SecurityException: No security context bound to the current thread
at com.haulmont.cuba.core.sys.AppContext.getSecurityContextNN(AppContext.java:201) ~[cuba-global-6.2.2.jar:6.2.2]
at com.haulmont.cuba.core.sys.ServiceInterceptor.getUserSession(ServiceInterceptor.java:88) ~[cuba-core-6.2.2.jar:6.2.2]
at com.haulmont.cuba.core.sys.ServiceInterceptor.aroundInvoke(ServiceInterceptor.java:70) ~[cuba-core-6.2.2.jar:6.2.2]
............
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476) [tomcat-coyote.jar:8.0.35]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_92]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_92]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.35]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_92]
1:46:14 PM com.sun.xml.ws.server.sei.EndpointMethodHandler invoke
SEVERE: No security context bound to the current thread
com.haulmont.cuba.core.global.RemoteException:
I was wondering what is the best way to get this @WebService class to be loaded in the spring container, or make it spring container Aware or anything along those lines so it can access the Cube Platform Services? Or possibly somehow use the System Authentication (System Authentication - CUBA Platform. Developer’s Manual) to be able to access these services?