10-24-2015 04:20 AM
Is anyone building a web application with the SDK? We are having an issue with ConnectorFactory and wondering if it has anything to do with the placement of the plugin folder (containing extension jar) and the connector.property file. We are using tomcat as the servlet container. IDE is eclipse.
...
22:41:28.309 [http-nio-8080-exec-6] INFO c.c.t.plugin.ConnectorFactory - Current path :/Applications/eclipse/Eclipse.app/Contents/MacOS/.
22:41:28.313 [http-nio-8080-exec-6] INFO c.c.t.plugin.ConnectorFactory - loadConfigurations path :null
22:41:28.357 [http-nio-8080-exec-6] ERROR c.c.t.plugin.ConnectorFactory - Exception occurred while Loading the configurations
com.cisco.thunderhead.errors.InternalServerErrorApiException: null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_60]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_60]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_60]
at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[na:1.8.0_60]
at com.cisco.thunderhead.errors.ApiExceptionFactory.getApiException(ApiExceptionFactory.java:78) ~[context-service-1.0.2.jar:na]
at com.cisco.thunderhead.errors.ApiExceptionFactory.generateApiException(ApiExceptionFactory.java:113) ~[context-service-1.0.2.jar:na]
at com.cisco.thunderhead.errors.ApiExceptionFactory.generateApiException(ApiExceptionFactory.java:95) ~[context-service-1.0.2.jar:na]
at com.cisco.thunderhead.plugin.ConnectorFactory.loadConfigurations(ConnectorFactory.java:228) [context-service-1.0.2.jar:na]
at com.cisco.thunderhead.plugin.ConnectorFactory.loadConfigurations(ConnectorFactory.java:217) [context-service-1.0.2.jar:na]
at com.cisco.thunderhead.plugin.ConnectorFactory.defaultInitialization(ConnectorFactory.java:172) [context-service-1.0.2.jar:na]
at com.cisco.thunderhead.plugin.ConnectorFactory.getConnector(ConnectorFactory.java:125) [context-service-1.0.2.jar:na]
at com.tme.GetContext.doGet(GetContext.java:68) [classes/:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) [servlet-api.jar:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [servlet-api.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) [catalina.jar:8.0.28]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.28]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-websocket.jar:8.0.28]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.28]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.28]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217) [catalina.jar:8.0.28]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [catalina.jar:8.0.28]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [catalina.jar:8.0.28]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) [catalina.jar:8.0.28]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [catalina.jar:8.0.28]
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) [catalina.jar:8.0.28]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [catalina.jar:8.0.28]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) [catalina.jar:8.0.28]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) [tomcat-coyote.jar:8.0.28]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673) [tomcat-coyote.jar:8.0.28]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) [tomcat-coyote.jar:8.0.28]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) [tomcat-coyote.jar:8.0.28]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.28]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
Oct 23, 2015 10:41:28 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [GetContext] in context with path [/FranciscoFinance] threw exception
ApiError with errorType: ioError, errorData: Cannot initialize the factory, errorMessage: Failure to initialize the factory
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at com.cisco.thunderhead.errors.ApiExceptionFactory.getApiException(ApiExceptionFactory.java:78)
at com.cisco.thunderhead.errors.ApiExceptionFactory.generateApiException(ApiExceptionFactory.java:113)
at com.cisco.thunderhead.plugin.ConnectorFactory.loadConfigurations(ConnectorFactory.java:259)
at com.cisco.thunderhead.plugin.ConnectorFactory.loadConfigurations(ConnectorFactory.java:217)
at com.cisco.thunderhead.plugin.ConnectorFactory.defaultInitialization(ConnectorFactory.java:172)
at com.cisco.thunderhead.plugin.ConnectorFactory.getConnector(ConnectorFactory.java:125)
at com.tme.GetContext.doGet(GetContext.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
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: ApiError with errorType: ioError, errorData: Empty configurationFilePath, errorMessage: Cannot initialize the factory with empty property file
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at com.cisco.thunderhead.errors.ApiExceptionFactory.getApiException(ApiExceptionFactory.java:78)
at com.cisco.thunderhead.errors.ApiExceptionFactory.generateApiException(ApiExceptionFactory.java:113)
at com.cisco.thunderhead.errors.ApiExceptionFactory.generateApiException(ApiExceptionFactory.java:95)
at com.cisco.thunderhead.plugin.ConnectorFactory.loadConfigurations(ConnectorFactory.java:228)
... 27 more
10-30-2015 01:43 PM
I am using Context Service within a Web App running within Tomcat. Note that you will face issues with closing a Context Service Connection in the current version of the Java client SDK. Since Web Applications are multi-threaded, you should consider using a Connection Pool. My Connection Pool tries to close these connections, however, there are a few remaining background threads that never stop running. This also makes re-deploying the Web Application very difficult.
In order to get the extension JAR loaded I use a properties file that locates the connector.property file, then the connector.property file locates the extension JAR.
Here is a portion of the initial properties file that my Web Application reads:
#
# Configuration properties for Context Service service
#
#
# Global configs
#
com.cisco.ContextServiceClientConstants.connection.data.filename = /root/ContextService/connectionData
com.cisco.ContextServiceClientConstants.config.filename = /root/ContextService/connector.property
And here is the connector.property file itself. I don;t know why Context Service wants those backslashes in this file.
path = \/usr\/local\/my_docs\/Cisco\/workspace\/Context-Service\/src\/plugin
jar-name = context-service-sdk-extension-1.0.2.jar
10-30-2015 02:15 PM
Thanks Joe, I will give this a try.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide