[nbj2ee] Error when adding context listener to web.xml

  • From: "Slobdell" < >
  • To:
  • Subject: [nbj2ee] Error when adding context listener to web.xml
  • Date: Mon, 27 Feb 2012 17:56:59 +0000

Hi, I'm a little lost here any help would be appreciated I can't find 
anything specific to my problem on the internet.  I'm using Netbeans 7.1 and 
Glass Fish Server 3+.

I have added a context listener to my webapp, and when I deploy I get an 
error after adding it to my web.xml file.  This is for class obviously so I'm 
new to Servlet contexts and descriptor files and all that.  

I think it has something to do with my context root from my Netbeans error 
message but I'm no expert. Any help would be greatly appreciated I've spent 
so many hours looking for a solution.

This is my listener, haven't changed it:


Code:

package BookstorePackage;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;



/**
 * Web application life cycle listener.
 *
 * @author Steve
 */
public class MyContextListener implements ServletContextListener {
    
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        throw new UnsupportedOperationException("This isn't working");
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}






This is my web.xml file


Code:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" ;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ;
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee ;
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd";>
    <context-param>
        <param-name>booksdbConnString</param-name>
        
<param-value>jdbc:derby://localhost:1527/c:\\temp\\databases\\LobdellBooksDB</param-value>
    </context-param>
    <listener>
        <listener-class>BookstorePackage.MyContextListener</listener-class>
    </listener>
    <servlet>
        <servlet-name>BookStoreController</servlet-name>
        <servlet-class>BookstorePackage.BookStoreController</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>BookStoreController</servlet-name>
        <url-pattern>/BookStoreController</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
</web-app>




Netbeans Error:

init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:
In-place deployment at 
C:\Users\Steve\Documents\NetBeansProjects\Project4\build\web
deploy?DEFAULT=C:\Users\Steve\Documents\NetBeansProjects\Project4\build\web&name=Project4&contextroot=/Project4&force=true
 failed on GlassFish Server 3+ 
 Error occurred during deployment: Exception while loading the app : 
java.lang.IllegalStateException: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: 
java.lang.UnsupportedOperationException: This isn't working. Please see 
server.log for more details.
C:\Users\Steve\Documents\NetBeansProjects\Project4\nbproject\build-impl.xml:721:
 The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 9 seconds)

And I know you will want to see my glass fish log so here is that even though 
it is annoyingly long:


INFO: Instantiated an instance of 
org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: hello
SEVERE: PWC1306: Startup of context /Project4 failed due to previous errors
SEVERE: PWC1305: Exception during cleanup after start failed
org.apache.catalina.LifecycleException: PWC2769: Manager has not yet been 
started
        at 
org.apache.catalina.session.StandardManager.stop(StandardManager.java:874)
        at 
org.apache.catalina.core.StandardContext.stop(StandardContext.java:5571)
        at com.sun.enterprise.web.WebModule.stop(WebModule.java:527)
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:5384)
        at com.sun.enterprise.web.WebModule.start(WebModule.java:498)
        at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
        at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
        at 
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
        at 
com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2000)
        at 
com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1651)
        at 
com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
        at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
        at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
        at 
org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:294)
        at 
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:462)
        at 
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
        at 
org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232)
        at 
com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:459)
        at 
com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:209)
        at 
com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
        at 
com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
        at 
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:238)
        at 
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
        at 
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
        at 
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
        at 
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
        at 
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
        at 
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
        at 
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
        at 
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
        at 
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
        at 
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
        at 
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
        at java.lang.Thread.run(Thread.java:662)

SEVERE: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: 
java.lang.UnsupportedOperationException: This isn't working
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:5389)
        at com.sun.enterprise.web.WebModule.start(WebModule.java:498)
        at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
        at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
        at 
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
        at 
com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2000)
        at 
com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1651)
        at 
com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
        at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
        at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
        at 
org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:294)
        at 
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:462)
        at 
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
        at 
org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232)
        at 
com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:459)
        at 
com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:209)
        at 
com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
        at 
com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
        at 
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:238)
        at 
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
        at 
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
        at 
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
        at 
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
        at 
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
        at 
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
        at 
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
        at 
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
        at 
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
        at 
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
        at 
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.UnsupportedOperationException: This isn't working
        at 
BookstorePackage.MyContextListener.contextInitialized(MyContextListener.java:59)
        at 
org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:4750)
        at 
com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:550)
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:5366)
        ... 38 more

WARNING: java.lang.IllegalStateException: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: 
java.lang.UnsupportedOperationException: This isn't working
java.lang.IllegalStateException: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: 
java.lang.UnsupportedOperationException: This isn't working
        at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:921)
        at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
        at 
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
        at 
com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2000)
        at 
com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1651)
        at 
com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
        at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
        at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
        at 
org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:294)
        at 
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:462)
        at 
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
        at 
org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232)
        at 
com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:459)
        at 
com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:209)
        at 
com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
        at 
com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
        at 
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:238)
        at 
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
        at 
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
        at 
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
        at 
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
        at 
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
        at 
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
        at 
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
        at 
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
        at 
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
        at 
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
        at 
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
        at java.lang.Thread.run(Thread.java:662)

SEVERE: Exception while invoking class com.sun.enterprise.web.WebApplication 
start method
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: 
start: org.apache.catalina.LifecycleException: 
java.lang.UnsupportedOperationException: This isn't working
        at 
com.sun.enterprise.web.WebApplication.start(WebApplication.java:138)
        at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
        at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
        at 
org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:294)
        at 
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:462)
        at 
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
        at 
org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
        at 
com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232)
        at 
com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:459)
        at 
com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:209)
        at 
com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
        at 
com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
        at 
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:238)
        at 
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
        at 
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
        at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
        at 
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
        at 
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
        at 
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
        at 
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
        at 
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
        at 
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
        at 
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
        at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
        at 
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
        at 
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
        at java.lang.Thread.run(Thread.java:662)

SEVERE: Exception while loading the app
SEVERE: Exception while loading the app : java.lang.IllegalStateException: 
ContainerBase.addChild: start: org.apache.catalina.LifecycleException: 
java.lang.UnsupportedOperationException: This isn't working


Steve






[nbj2ee] Error when adding context listener to web.xml

Slobdell 02/27/2012

[nbj2ee] Re: Error when adding context listener to web.xml

Glenn Holmer 02/27/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close