4

I am trying to switch from jetty 7.6 to jetty-9.2.1. I made the required configuration changes. But I am continuously getting "No Spring WebApplicationInitializer types detected on classpath" message while initializing the jetty server.

My deployment manager was:

New class="org.eclipse.jetty.deploy.providers.WebAppProvider">

<Set name="monitoredDirName">
  <Property name="cometd.deploy.dir" default="/u/khandela/cometD/webapps_dev/" />
</Set>
<Set name="defaultsDescriptor">
  <Property name="jetty.home" default="."/>/etc/webdefault.xml
</Set>
<Set name="scanInterval">1</Set>
<Set name="extractWars">true</Set>
<Set name="contextXmlDir">
 <Property name="jetty.home" default="." />/contexts
</Set>

In new version "contextXmlDir" is removed. So I also removed from the config. When i run i keep getting the message shown above. Should I add it back, if yes than how ?

And while running I am using: --module=server,jsp,deploy,jmx,resources,websocket,ext,plus,annotations

Below is the detailed messages I get when I run the server:

2014-07-08 14:07:42.634:INFO::main: Logging initialized @512ms
2014-07-08 14:07:43.253:INFO:oejs.Server:main: jetty-9.2.1.v20140609
2014-07-08 14:07:43.306:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/u/khandela/cometD/logs_dev/webapps] at interval 1
2014-07-08 14:07:43.306:WARN:oejdp.ScanningAppProvider:main: Does not exist: file:/u/khandela/cometD/logs_dev/webapps
2014-07-08 14:07:43.450:INFO:oejs.AbstractNCSARequestLog:main: Opened /u/khandela/cometD/logs_dev/jetty-20140708.log
2014-07-08 14:07:43.468:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/u/khandela/cometD/webapps_dev/] at interval 1
2014-07-08 14:07:46.945:INFO:cometd:main: No Spring WebApplicationInitializer types detected on classpath
2014-07-08 14:07:47.332:INFO:cometd:main: Initializing Spring root WebApplicationContext
2014-07-08 14:07:48.696:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@6fd02e5{/cometd,file:/tmp/jetty-0.0.0.0-8107-cometd.war-_cometd-any-404202732061519131.dir/webapp/,AVAILABLE}{/u/khandela/cometD/webapps_dev/cometd.war}
2014-07-08 14:07:49.183:INFO:oejs.ServerConnector:main: Started ServerConnector@180bc464{HTTP/1.1}{0.0.0.0:8107}
2014-07-08 14:07:49.184:INFO:oejs.Server:main: Started @7083ms

Thanks,

Anuj

M. Deinum
  • 115,695
  • 22
  • 220
  • 224
Anuj Khandelwal
  • 835
  • 2
  • 15
  • 31
  • And that message is a problem because? It is just an info message if your application runs ignore it. – M. Deinum Jul 08 '14 at 10:03
  • The info message is not a problem, but why it is saying "No Spring WebApplicationInitializer types detected on classpath" and My question is where and how should I specify "contextXmlDir" ? – Anuj Khandelwal Jul 08 '14 at 12:39
  • Because they aren't found hence it is informing you about that. Servlet 3.0 has a `ServletContainerInitializer` for which spring has a `SpringServletContainerInitializer` which looks for `WebApplicationInitializer` instances. Of none found that message appears. Please modify the question to reflect your actual question as currently it is misleading. – M. Deinum Jul 08 '14 at 12:42
  • Thanks for the explanation.But if I check the war I can see WebApplicationInitializer in "./WEB-INF/lib/spring-web-4.0.5.RELEASE.jar". Can you please also let me know about "contextXmlDir", How should I configure this in jetty-9.2 – Anuj Khandelwal Jul 08 '14 at 14:28
  • That is the interface it doesn't find any implementations of that interface. How to configure the contextXmlDIr no idea, also that wasn't the question you initially asked. Maybe create a new one for that. – M. Deinum Jul 09 '14 at 05:42

1 Answers1

3

If you configure the org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern attribute in your jetty.xml is going to work. You can find more information about this parameter on the Jetty Documentation: This is a context attribute that can be set on an org.eclipse.jetty.webapp.WebAppContext to control which parts of the container’s classpath should be processed for things like annotation.

<Call name="setAttribute">
  <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
  <Arg>.*/foo-[^/]*\.jar$|.*/bar-[^/]*\.jar$|.*/bin/.*|.*/classes/.*|.*/target/.</Arg>
</Call>
Wellington Souza
  • 2,200
  • 2
  • 22
  • 33