Hi ,
I'm migrating Jetty6.1.19 to Jetty9.1.1. I'm using the
jetty-all-9.1.1.jar.
I'm facing NullPointerException in *WebAppProvider.start()* method. Below
is the code snippet where I'm facing exception. Since there is no
setContext() method, I have not set context explicitly.
Here the value of warpath is '*webapps*'. In my application the WAR file
exists in the path '
*pab/max/assume/msc/DEV/check/7.1.2_EV/webapps/axis2/WEB-INF/services/App.war*
'. I have attached the log. While scanning it throws NullPointer.
* this*.jettyWebServer =new Server();
WebAppProvider webAppDeployer=*new* WebAppProvider();
//webAppDeployer.setContexts(this.jettyWebServer); ->commented
setcontext
webAppDeployer.setMonitoredDirName(warpath); -->warpth is 'webapps'
webAppDeployer.setExtractWars(*true*);
webAppDeployer.setParentLoaderPriority(*true*);
*webAppDeployer.start();* -->NullPointerException while scanning.
*this*.jettyWebServer.setStopAtShutdown(*true*);
*this*.jettyWebServer.start();
* this*.jettyWebServer.join();
Could someone please help me what is wrong in this?. Do I need to
setContext manually.Please see the log attached.
Thanks,
Arun
On Thu, Sep 3, 2015 at 12:02 AM, Joakim Erdfelt <[email protected]> wrote:
> A WebAppContext is the basic webapp/war functionality.
>
> If you need other things, like ...
> JNDI,
> Annotation Scanning,
> etc...
>
> Then those features are added to your webapp via its Configuration's -
> see:
> https://github.com/jetty-project/embedded-servlet-3.1/blob/master/src/main/java/org/eclipse/jetty/demo/EmbedMe.java#L37-L47
> I don't know what AAR/Axis Archive is or does.
> Is it another webapp? (if so, you can have both webapps as on different
> context paths via a ContextHandlerCollection which holds both
> WebAppContext's)
> I think if you figure out what this AAR/Axis Archive is, then you'll be
> able to start using SOAP.
>
>
>
> Joakim Erdfelt / [email protected]
>
> On Wed, Sep 2, 2015 at 9:04 AM, Arun Kumar <[email protected]>
> wrote:
>
>> Hi Joakim,
>>
>> I have tried with WebAppContext instead of Deploymentmanager class. The
>> application is up but not loading all features. My application has AAR(Axis
>> archive ) file which is under webapps folder.
>> Also we are using SOAP webservices for sending request/response.
>>
>> As I'm using embedded jetty server is WebAppContext class is enough ?.
>>
>>
>> Thanks
>>
>> On Tue, Sep 1, 2015 at 11:14 PM, Joakim Erdfelt <[email protected]>
>> wrote:
>>
>>> Can't you just create the WebAppContext directly and add it to your
>>> server?
>>> Why bother with the DeploymentManager steps?
>>>
>>> Joakim Erdfelt / [email protected]
>>>
>>> On Tue, Sep 1, 2015 at 10:41 AM, Arun Kumar <[email protected]>
>>> wrote:
>>>
>>>> Hi Team,
>>>>
>>>> I have changed the following code in Jetty6 to Jetty9 migration. I'm
>>>> facing an issue that Illegal StateException :'No contexts found"
>>>>
>>>> *Existing code in Jetty6:*
>>>> this.jettyWebServer = new Server(); //org.mortbay.jetty.Server
>>>>
>>>> ThreadPool threadPool = new ThreadPool(threadPoolSize);
>>>>
>>>> jettyWebServer.setThreadPool(threadPool);
>>>>
>>>> Connector connector = new SelectChannelConnector();
>>>>
>>>> connector.setPort(port);
>>>>
>>>> this.jettyWebServer.setConnectors(new Connector[]{connector});
>>>>
>>>> WebAppDeployer webAppDeployer = new WebAppDeployer();
>>>>
>>>> webAppDeployer.setContexts(this.jettyWebServer); ///
>>>> setContexts method is not available in Jetty9
>>>>
>>>> webAppDeployer.setWebAppDir(warpath);
>>>>
>>>> webAppDeployer.setExtract(true);
>>>>
>>>> webAppDeployer.setParentLoaderPriority(true);
>>>>
>>>> webAppDeployer.start();
>>>>
>>>> this.jettyWebServer.setStopAtShutdown(true);
>>>>
>>>> this.jettyWebServer.setSendServerVersion(false);
>>>>
>>>>
>>>> this.jettyWebServer.start();
>>>> this.jettyWebServer.join();
>>>>
>>>> I have modified the above code for Jetty9 as follows::
>>>>
>>>>
>>>> * Jetty9 code:*DeploymentManager deploymentManager = new
>>>> DeploymentManager(); // added DeploymentManager in Jetty9
>>>> QueuedThreadPool threadPool = new
>>>> QueuedThreadPool(threadPoolSize);// Thread pool
>>>> threadPool.setMaxThreads(500);
>>>>
>>>> this.jettyWebServer = new Server(threadPool);//
>>>> org.eclipse.jetty.Server
>>>>
>>>> ContextHandlerCollection contexts = new
>>>> ContextHandlerCollection();
>>>>
>>>> contexts.setHandlers(new Handler[] { context});
>>>>
>>>> this.jettyWebServer.setHandler(contexts);
>>>>
>>>> ServerConnector connector = new ServerConnector(jettyWebServer);
>>>>
>>>> connector.setPort(port);
>>>>
>>>> this.jettyWebServer.setConnectors(new Connector[]{connector});
>>>>
>>>> WebAppProvider webAppDeployer = new WebAppProvider();//
>>>> WebAppProvider replaced webAppDeployer in Jetty6
>>>>
>>>> webAppDeployer.setExtractWars(true);
>>>>
>>>> webAppDeployer.setParentLoaderPriority(true);
>>>>
>>>> webAppDeployer.setMonitoredDirName(warpath);
>>>>
>>>> deploymentManager.addAppProvider(webAppDeployer);
>>>> this.jettyWebServer.addBean(deploymentManager);
>>>> this.jettyWebServer.setStopAtShutdown(true);
>>>> this.jettyWebServer.start();
>>>> this.jettyWebServer.join();
>>>>
>>>> In Jetty 9 code I have deploymentmanager and webAppProvider classes.
>>>> Since there is no setContexts method in Jetty9 How can we set the context?.
>>>> Also the jetty9 code is correct ?. Could you please help me ?.
>>>>
>>>>
>>>> Thanks,
>>>> Arun
>>>>
>>>> _______________________________________________
>>>> jetty-users mailing list
>>>> [email protected]
>>>> To change your delivery options, retrieve your password, or unsubscribe
>>>> from this list, visit
>>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>>
>>>
>>>
>>> _______________________________________________
>>> jetty-users mailing list
>>> [email protected]
>>> To change your delivery options, retrieve your password, or unsubscribe
>>> from this list, visit
>>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>>
>>
>>
>> _______________________________________________
>> jetty-users mailing list
>> [email protected]
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>
>
>
> _______________________________________________
> jetty-users mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
2015-09-07 16:04:35,195 DEBUG [l.component.ContainerLifeCycle] [main] -
org.eclipse.jetty.server.Server@1c28a6a added
{ServerConnector@d86850{HTTP/1.1}{0.0.0.0:14101},AUTO}
2015-09-07 16:04:35,276 DEBUG [il.component.AbstractLifeCycle] [main] -
starting org.eclipse.jetty.deploy.providers.WebAppProvider@374059
2015-09-07 16:04:35,276 DEBUG [.providers.ScanningAppProvider] [main] -
WebAppProvider.doStart()
2015-09-07 16:04:35,276 INFO [.providers.ScanningAppProvider] [main] -
Deployment monitor [file:/pab/max/assume/msc/DEV/check/7.1.2_EV/webapps/] at
interval 0
2015-09-07 16:04:35,282 DEBUG [il.component.AbstractLifeCycle] [main] -
starting org.eclipse.jetty.util.Scanner@a9f5e9
2015-09-07 16:04:35,285 DEBUG [org.eclipse.jetty.util.Scanner] [main] - scan
accepted /pab/max/assume/msc/DEV/check/7.1.2_EV/webapps/axis2
2015-09-07 16:04:35,288 DEBUG [org.eclipse.jetty.util.Scanner] [main] - scanned
[/pab/max/assume/msc/DEV/check/7.1.2_EV/webapps]:
{/pab/max/assume/msc/DEV/check/7.1.2_EV/webapps/axis2=ADDED}
2015-09-07 16:04:35,290 DEBUG [org.eclipse.jetty.util.Scanner] [main] - scan
accepted /pab/max/assume/msc/DEV/check/7.1.2_EV/webapps/axis2
2015-09-07 16:04:35,291 DEBUG [org.eclipse.jetty.util.Scanner] [main] - scanned
[/pab/max/assume/msc/DEV/check/7.1.2_EV/webapps]:
{/pab/max/assume/msc/DEV/check/7.1.2_EV/webapps/axis2=ADDED}
2015-09-07 16:04:35,291 DEBUG [.providers.ScanningAppProvider] [main] - added
/pab/max/assume/msc/DEV/check/7.1.2_EV/webapps/axis2
2015-09-07 16:04:35,295 WARN [org.eclipse.jetty.util.Scanner] [main] -
org.eclipse.jetty.deploy.providers.ScanningAppProvider$1@12ccbba failed on
'/pab/max/assume/msc/DEV/check/7.1.2_EV/webapps/axis2
java.lang.NullPointerException
at
org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:180)
at
org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:64)
at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:605)
at org.eclipse.jetty.util.Scanner.reportDifferencmsc(Scanner.java:528)
at org.eclipse.jetty.util.Scanner.scan(Scanner.java:391)
at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:313)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
at
org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:150)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
at
com.pab.ged.assume.check.jetty.JeetyStart.startJetty(JeetyStart.java:110)
at com.pab.ged.assume.check.jetty.JeetyStart.main(JeetyStart.java:145)
2015-09-07 16:04:35,297 DEBUG [il.component.AbstractLifeCycle] [main] - STARTED
org.eclipse.jetty.util.Scanner@a9f5e9
2015-09-07 16:04:35,297 DEBUG [il.component.AbstractLifeCycle] [main] - STARTED
org.eclipse.jetty.deploy.providers.WebAppProvider@374059
2015-09-07 16:04:35,297 INFO [mentserver.jetty.JeetyStart] [main] - Jetty
before --Application start-->
2015-09-07 16:04:35,298 DEBUG [il.component.AbstractLifeCycle] [main] -
starting org.eclipse.jetty.server.Server@1c28a6a
2015-09-07 16:04:35,302 INFO [rg.eclipse.jetty.server.Server] [main] -
jetty-9.1.1.v20140108
2015-09-07 16:04:35,342 DEBUG [server.handler.AbstractHandler] [main] -
starting org.eclipse.jetty.server.Server@1c28a6a
2015-09-07 16:04:35,342 DEBUG [il.component.AbstractLifeCycle] [main] -
starting qtp10560341{STOPPED,8<=0<=200,i=0,q=0}
2015-09-07 16:04:35,376 DEBUG [il.component.AbstractLifeCycle] [main] - STARTED
qtp10560341{STARTED,8<=8<=200,i=7,q=0}
2015-09-07 16:04:35,377 DEBUG [il.component.AbstractLifeCycle] [main] -
starting ServerConnector@d86850{HTTP/1.1}{0.0.0.0:14101}
2015-09-07 16:04:35,396 DEBUG [l.component.ContainerLifeCycle] [main] -
ServerConnector@d86850{HTTP/1.1}{0.0.0.0:14101} added
{sun.nio.ch.ServerSocketChannelImpl[/0.0.0_______________________________________________
jetty-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users