Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

Jetty 9 container in Gigaspaces 12.1

Hi,

I've following the instructions on updating Gigaspaces 12.1.1-17121 to use Jetty 9 as outlined here:

https://docs.gigaspaces.com/xap/12.1/...

However, when I tried to deploy a war I get the following error:

[gsc][1/13364] 2017-08-08 12:32:51,515 GSC SEVERE [com.gigaspaces.grid.gsc] - Failed to instantiate pu-1.0-SNAPSHOT [1]; Caused by: org.jini.rio.core.JSBInstantiationException: java.lang.NoClassDefFoundError: javax/enterprise/inject/spi/CDI [gsc][1/13364] at org.eclipse.jetty.cdi.websocket.WebSocketCdiListener.newInstance(WebSocketCdiListener.java:45) [gsc][1/13364] at org.eclipse.jetty.cdi.websocket.WebSocketCdiListener$ContainerListener.<init>(WebSocketCdiListener.java:71) [gsc][1/13364] at org.eclipse.jetty.cdi.websocket.WebSocketCdiListener.lifeCycleStarting(WebSocketCdiListener.java:124) [gsc][1/13364] at org.eclipse.jetty.util.component.AbstractLifeCycle.setStarting(AbstractLifeCycle.java:188) [gsc][1/13364] at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:67) [gsc][1/13364] at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132) [gsc][1/13364] at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:106) [gsc][1/13364] at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61) [gsc][1/13364] at org.eclipse.jetty.server.handler.ScopedHandler.doStart(ScopedHandler.java:120) [gsc][1/13364] at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:801) [gsc][1/13364] at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:346) [gsc][1/13364] at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1379) [gsc][1/13364] at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1341) [gsc][1/13364] at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:772) [gsc][1/13364] at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:263) [gsc][1/13364] at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:517) [gsc][1/13364] at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [gsc][1/13364] at org.openspaces.pu.container.jee.jetty.JettyJeeProcessingUnitContainerProvider.createContainer(JettyJeeProcessingUnitContainerProvider.java:249) [gsc][1/13364] at org.openspaces.pu.container.servicegrid.PUServiceBeanImpl.startPU(PUServiceBeanImpl.java:761) [gsc][1/13364] at org.openspaces.pu.container.servicegrid.PUServiceBeanImpl.doStart(PUServiceBeanImpl.java:224) [gsc][1/13364] at org.jini.rio.jsb.ServiceBeanAdapter$1.run(ServiceBeanAdapter.java:299) [gsc][1/13364] at org.jini.rio.jsb.ServiceBeanAdapter.start(ServiceBeanAdapter.java:312) [gsc][1/13364] at org.jini.rio.jsb.JSBLoader.create(JSBLoader.java:114) [gsc][1/13364] at org.jini.rio.cybernode.ServiceBeanLoader.load(ServiceBeanLoader.java:268) [gsc][1/13364] at org.jini.rio.cybernode.JSBDelegate.startServiceBean(JSBDelegate.java:514) [gsc][1/13364] at org.jini.rio.cybernode.JSBDelegate.load(JSBDelegate.java:369) [gsc][1/13364] at org.jini.rio.cybernode.JSBContainer.activate(JSBContainer.java:227) [gsc][1/13364] at org.jini.rio.cybernode.CybernodeImpl.instantiate(CybernodeImpl.java:1031) [gsc][1/13364] at org.jini.rio.core.provision.ServiceBeanInstantiatorGigaspacesMethodinternalInvoke3.internalInvoke(Unknown Source) [gsc][1/13364] at com.gigaspaces.internal.reflection.fast.AbstractMethod.invoke(AbstractMethod.java:45) [gsc][1/13364] at com.gigaspaces.lrmi.LRMIRuntime.invoked(LRMIRuntime.java:441) [gsc][1/13364] at com.gigaspaces.lrmi.nio.Pivot.consumeAndHandleRequest(Pivot.java:494) [gsc][1/13364] at com.gigaspaces.lrmi.nio.Pivot.handleRequest(Pivot.java:572) [gsc][1/13364] at com.gigaspaces.lrmi.nio.Pivot$ChannelEntryTask.run(Pivot.java:173) [gsc][1/13364] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [gsc][1/13364] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [gsc][1/13364] at java.lang.Thread.run(Thread.java:748)

Any thoughts or suggestions would be gladly welcome, thanks. Also, here's the jetty.pu.xml settings:

<beans beans="" http:="" schema="" spring-beans-4.1.xsd%22"="" www.springframework.org="" xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans &lt;a href=">http://www.springframework.org/schema...></beans>

<bean id="propertiesConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="ignoreUnresolvablePlaceholders" value="true"/>
    <property name="properties">
        <props>
            <prop key="web.context">/</prop>
            <prop key="web.context.classLoader.parentFirst">false</prop>
            <prop key="web.context.copyWebDir">false</prop>
            <prop key="web.context.unique">true</prop>
            <prop key="web.context.separator">_</prop>
            <prop key="web.host">localhost</prop>
            <prop key="web.port">9302</prop>
            <prop key="web.sslPort">8453</prop>
            <prop key="web.threadPool.minThreads">10</prop>
            <prop key="web.threadPool.maxThreads">200</prop>
            <prop key="web.threadPool.lowThreads">20</prop>
            <prop key="web.selector.maxIdleTime">300000</prop>
            <prop key="web.selector.acceptors">2</prop>
            <prop key="web.selector.selectors">-1</prop>
            <prop key="web.selector.lowResourcesConnections">20000</prop>
            <prop key="web.selector.lowResourcesMaxIdleTime">5000</prop>
            <prop key="web.selector.forwarded">true</prop>
            <prop key="web.statsOn">false</prop>
            <prop key="jee.deployPath">.</prop>
        </props>
    </property>
</bean>

<!-- PRODUCTION DEPLOYMENT -->

<!-- Fix port with offset of 0 -->
<bean id="port" class="org.openspaces.pu.container.jee.PortGenerator">
    <property name="basePort" value="${web.port}" />
    <property name="portOffset" value="0" />
</bean>

<!-- Fix ssl port with offset of 0 -->
<bean id="confidentialPort" class="org.openspaces.pu.container.jee.PortGenerator">
    <property name="basePort" value="${web.sslPort}" />
    <property name="portOffset" value="0" />
</bean>

<bean id="context" class="org.openspaces.pu.container.jee.SharedContextFactory">
    <property name="context" value="${web.context}"/>
    <property name="unique" value="${web.context.unique}"/>
    <property name="separator" value="${web.context.separator}"/>
</bean>

<!-- Setup web application context -->
<bean id="webAppContext" class="org.eclipse.jetty.webapp.WebAppContext">
    <property name="contextPath" ref="context"/>
    <property name="war" value="${jee.deployPath}"/>
    <property name="tempDirectory" value="${jee.deployPath}/WEB-INF/work"/>
    <property name="copyWebDir" value="${web.context.copyWebDir}"/>
    <property name="parentLoaderPriority" value="${web.context.classLoader.parentFirst}"/>
    <property name="configurationClasses">
        <list>
            <value>org.eclipse.jetty.webapp.WebInfConfiguration</value>
            <value>org.eclipse.jetty.webapp.WebXmlConfiguration</value>
            <value>org.eclipse.jetty.webapp.MetaInfConfiguration</value>
            <value>org.eclipse.jetty.webapp.FragmentConfiguration</value>
            <value>org.eclipse.jetty.plus.webapp.EnvConfiguration</value>
            <value>org.eclipse.jetty.plus.webapp.PlusConfiguration</value>
            <value>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</value>
            <value>org.eclipse.jetty.annotations.AnnotationConfiguration</value>
        </list>
    </property>
    <property name="sessionHandler" ref="secureSessionHandler"/>
</bean>

<bean id="secureSessionHandler" class="org.eclipse.jetty.server.session.SessionHandler">
    <property name="sessionManager" ref ...
(more)

asked 2017-08-08 09:24:43 -0600

Adrian gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

Hi All,

My Issue was seen when I was only trying to deploy a simple 'Hello World' servlet endpoint, it was a very simple war and contained one dependency servlet-api 3.1.0 which is provided on the jetty classpath. So, I wasn't trying to include anything in my war. It was an empty war essentially in terms of dependencies. Hence, I had no clashes or conflicts with the existing jars the gigaspaces docmentation mentions to add to the jetty directory. Also, for the record I was able to deploy this war in the standalone Jetty 9.3.7.v20160115, but not the same Jetty 9.3.7.v20160115 wrapped up in Gigaspaces 12.1.1-17121.

But, if anyone ever runs into a problem similar to what I've written above. The Issue was directly related to the Native Java way to do dependency injection (JSR-330 if I remember correctly). The directions outlined here in the Xap documentation:

https://docs.gigaspaces.com/xap/12.1/...

never actually adds any of the Java dependencies to do dependency injection using the JSR-330 spec. However, the reason why Jetty was looking for these missing dependencies was to do with a jar added to the jetty lib directory called cdi-websocket.jar (The Gigaspaces documentation says to add this jar). This jar tries to load a CDI Provider in order to wire up beans that are required and it fails as there is no CDI implementation in the jetty container to do the dependency injection. So in short the Gigaspaces documentation needs to be updated.

Regards, Adrian.

answered 2017-08-14 08:59:49 -0600

Adrian gravatar image

updated 2017-08-14 09:05:28 -0600

edit flag offensive delete link more
0

Hi Adrian,

I suspect there is a dependency in your web application on this class. Have you tried this with a simple web application?

Thanks, Dixson

answered 2017-08-09 09:34:36 -0600

Dixson Huie gravatar image
edit flag offensive delete link more

Comments

Adrian,

I changed Jetty to use Jetty 9 per the instructions on our website. I used a simple war file that was basically a servlet that did getServletContext().getAttribute() to check a property.

I was not able to reproduce this.

I was able to deploy this without the optional jetty.pu.xml and with it. When deploying with the jetty.pu.xml provided on the docs website, I had to comment out the ssl configuration items. After doing this I was able to deploy.

Thanks, Dixson

Dixson Huie gravatar imageDixson Huie ( 2017-08-14 16:08:03 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-08-08 09:24:43 -0600

Seen: 162 times

Last updated: Aug 14