I am trying to use guice to instantiate my server-side objects used by my DMI objects.
So I have for example:
This is throwing the exception shown in the screenshot.
So I changed it to: (although I do not like this)
Then I get a NullPointerException when trying to use MyService.
So I guess the DokumenteDMIHandler is not being managed by Guice.
I read the startup guide and tried by adding the lookup-style to the serverObject, hoping that it would be created by guice :
As I read in the quick start guide, either either "bean" or "className" is needed, so I left my className.
But now I get:
What am I doing wrong?
Using smartgwt 6.0-p20161005 power.
So I have for example:
Code:
public class DokumenteDMIHandler { private MyService myService; @Inject public DokumenteDMIHandler(MyService myService) { this.myService = myService; }
So I changed it to: (although I do not like this)
Code:
public class DokumenteDMIHandler { @Inject private MyService myService; public DokumenteDMIHandler() { }
So I guess the DokumenteDMIHandler is not being managed by Guice.
I read the startup guide and tried by adding the lookup-style to the serverObject, hoping that it would be created by guice :
Code:
<operationBinding operationType="add" operationId="myOperationId"> <serverObject className="de.mks_infofabrik.kids.server.dmi.DokumenteDMIHandler" methodName="wikitaImport" lookupStyle="cdi" /> </operationBinding>
But now I get:
Code:
=== 2016-10-27 17:36:35,779 [ec-2] INFO ServerObject - DMI on CDI bean: de.mks_infofabrik.kids.server.dmi.DokumenteDMIHandler === 2016-10-27 17:36:35,784 [ec-2] WARN RequestContext - dsRequest.execute() failed: java.lang.RuntimeException: javax.naming.NameNotFoundException: Name [BeanManager] is not bound in this Context. Unable to find [BeanManager]. at com.isomorphic.cdi.CDIBeanManager.getBeanManager(CDIBeanManager.java:63) at com.isomorphic.cdi.CDIBeanManager.getBean(CDIBeanManager.java:89) at com.isomorphic.rpc.ServerObject.<init>(ServerObject.java:257) at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:230) at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2719) at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:230) at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:187) at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:152) at com.isomorphic.servlet.IDACall._processRequest(IDACall.java:119) at com.isomorphic.servlet.IDACall.doPost(IDACall.java:79) at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:162) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263) at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178) at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62) at de.mks_infofabrik.kids.server.filter.GWTCacheControlFilter.doFilter(GWTCacheControlFilter.java:53) at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:260) at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:88) at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118) at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: javax.naming.NameNotFoundException: Name [BeanManager] is not bound in this Context. Unable to find [BeanManager]. at org.apache.naming.NamingContext.lookup(NamingContext.java:818) at org.apache.naming.NamingContext.lookup(NamingContext.java:152) at org.apache.naming.NamingContext.lookup(NamingContext.java:829) at org.apache.naming.NamingContext.lookup(NamingContext.java:166) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:157) at javax.naming.InitialContext.lookup(InitialContext.java:417) at com.isomorphic.cdi.CDIBeanManager.getBeanManager(CDIBeanManager.java:61) ... 44 more
Using smartgwt 6.0-p20161005 power.
Comment