Hi John,

Same here, I am also learning but I suggest you to start with Core
Java and for J2EE Head First Servlet and JSP is great book.

On Oct 13, 7:50 pm, John Joseph <jjk_s...@yahoo.com> wrote:
> Hi Mayank
>       I created the listener using NB 6.9.1 .
>     I need to admit about my lack of exposure in programming area, I am 
> trying my best to become a Java Master
>        thanks
>           Joseph John
>
> --- On Thu, 14/10/10, Mayank Gupta <er.mayankgu...@gmail.com> wrote:
>
>
>
> > From: Mayank Gupta <er.mayankgu...@gmail.com>
> > Subject: [java ee programming] Re: When I create listener and run the 
> > project I get error
> > To: "Java EE (J2EE) Programming with Passion!" 
> > <java-ee-j2ee-programming-with-passion@googlegroups.com>
> > Date: Thursday, 14 October, 2010, 3:23 AM
> > Hey Joseph,
>
> > I was wondering. From where you got this code?
>
> > Context Listener are used to initialize like you can have
> > Database
> > Connection there.
>
> > contextInitialized -> runs when you deploy your web
> > application.
> > contextDestroyed -> runs when you undeploy.
>
> > I use this for hibernate connection.
>
> > package com.usaa.sas.model;
>
> > import javax.servlet.ServletContext;
> > import javax.servlet.ServletContextEvent;
> > import javax.servlet.ServletContextListener;
> > import javax.servlet.annotation.WebListener;
>
> > import org.hibernate.SessionFactory;
> > import org.hibernate.cfg.Configuration;
>
> > /**
> >  * Application Lifecycle Listener implementation class
> > HibernateUtill
> >  *
> >  */
> > @WebListener
> > public class HibernateUtill implements
> > ServletContextListener {
>
> >     private SessionFactory
> > sessionFactory=null;
> >     /**
> >      * Default constructor.
> >      */
> >     public HibernateUtill() {
> >         // TODO Auto-generated
> > constructor stub
> >     }
>
> >     /**
> >      * @see
> > ServletContextListener#contextInitialized(ServletContextEvent)
> >      */
> >     public void
> > contextInitialized(ServletContextEvent event) {
> >         // TODO Auto-generated method
> > stub
> >           
> > ServletContext sc = event.getServletContext();
>
> >         try {
> >            
> > sessionFactory= new
> > Configuration().configure().buildSessionFactory();
> >            
> > sc.setAttribute("sessionFactory", sessionFactory);
> >         }
> >         catch(Throwable ex){
> >            
> > System.err.println("Intial Creation Failed"+ex);
> >         }
> >     }
>
> >     /**
> >      * @see
> > ServletContextListener#contextDestroyed(ServletContextEvent)
> >      */
> >     public void
> > contextDestroyed(ServletContextEvent event) {
> >         // TODO Auto-generated method
> > stub
> >         sessionFactory.close();
> >     }
>
> > }
>
> > Mayank
>
> > On Oct 13, 6:48 am, John Joseph <jjk_s...@yahoo.com>
> > wrote:
> > > Thanks Mayank
> > >   It worked
> > >   U saved my day
>
> > > --- On Wed, 13/10/10, Mayank Gupta <er.mayankgu...@gmail.com>
> > wrote:
>
> > > > From: Mayank Gupta <er.mayankgu...@gmail.com>
> > > > Subject: [java ee programming] Re: When I create
> > listener and run the project I get error
> > > > To: "Java EE (J2EE) Programming with Passion!"
> > <java-ee-j2ee-programming-with-passion@googlegroups.com>
> > > > Date: Wednesday, 13 October, 2010, 5:42 PM
> > > > I think you are throwing
> > > > exception    throw new
> > > > UnsupportedOperationException("Not supported
> > yet.");
>
> > > > public void
> > contextInitialized(ServletContextEvent sce) {
> > > >     //     throw new
> > > > UnsupportedOperationException("Not supported
> > > > yet.");
> > > >  System.out.println("hello world");
> > > > }
>
> > > > Comment that are print something
>
> > > > On Oct 12, 9:10 pm, John Joseph <jjk_s...@yahoo.com>
> > > > wrote:
> > > > > Hi Jayesh
> > > > >     Thanks for the reply, I had cut and
> > pasted this
> > > > error, U can get this error if you can make a
> > listener for
> > > > HelloWeb project in EL(Expression Language
> > )sample project
> > > > and try to run
> > > > > ###
> > > > > My error are
> > > > > SEVERE: PWC1306: Startup of context
> > /MyHelloWeb 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:892)
> > > > >         at
>
> > org.apache.catalina.core.StandardContext.stop(StandardContext.java:5456)
> > > > >         at
>
> > com.sun.enterprise.web.WebModule.stop(WebModule.java:530)
> > > > >         at
>
> > org.apache.catalina.core.StandardContext.start(StandardContext.java:5284)
> > > > >         at
>
> > com.sun.enterprise.web.WebModule.start(WebModule.java:499)
> > > > >         at
>
> > org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:
> > > > 928)
> > > > >         at
>
> > org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912)
> > > > >         at
>
> > org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694)
> > > > >         at
>
> > com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1947)
> > > > >         at
>
> > com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1619)
> > > > >         at
>
> > com.sun.enterprise.web.WebApplication.start(WebApplication.java:90)
> > > > >         at
>
> > org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
> > > > >         at
>
> > org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
> > > > >         at
>
> > org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236)
> > > > >         at
>
> > com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecyc
> > > > le.java:339)
> > > > >         at
>
> > com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecyc
> > > > le.java:183)
> > > > >         at
>
> > org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272
> > > > )
> > > > >         at
>
> > com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.j
> > > > ava:305)
> > > > >         at
>
> > com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.j
> > > > ava:320)
> > > > >         at
>
> > com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.j
> > > > ava:1176)
> > > > >         at
>
> > com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.
> > > > java:83)
> > > > >         at
>
> > com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(Comm
> > > > andRunnerImpl.java:1235)
> > > > >         at
>
> > com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(Comm
> > > > andRunnerImpl.java:1224)
> > > > >         at
>
> > com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
> > > > >         at
>
> > com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
> > > > >         at
>
> > com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
> > > > >         at
>
> > com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
> > > > >         at
>
> > com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper
> > > > .java:245)
> > > > >         at
>
> > com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
> > > > >         at
>
> > com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
> > > > >         at
>
> > com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
> > > > >         at
>
> > com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.ja
> > > > va:170)
> > > > >         at
>
> > com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolC
> > > > hain.java:135)
> > > > >         at
>
> > com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
> > > > >         at
>
> > com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
> > > > >         at
>
> > com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
> > > > >         at
>
> > com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.ja
> > > > va:53)
> > > > >         at
>
> > com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:5
> > > > 7)
> > > > >         at
>
> > com.sun.grizzly.ContextTask.run(ContextTask.java:69)
> > > > >         at
>
> > com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.ja
> > > > va:330)
> > > > >         at
>
> > com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:
> > > > 309)
> > > > >         at
> > java.lang.Thread.run(Thread.java:619)
>
> > > > > SEVERE: ContainerBase.addChild: start:
> > > > > org.apache.catalina.LifecycleException:
> > > > java.lang.UnsupportedOperationException: Not
> > supported yet.
> > > > >         at
>
> > org.apache.catalina.core.StandardContext.start(StandardContext.java:5289)
> > > > >         at
>
> > com.sun.enterprise.web.WebModule.start(WebModule.java:499)
> > > > >         at
>
> > org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:
> > > > 928)
> > > > >         at
>
> > org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912)
> > > > >         at
>
> > org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694)
> > > > >         at
>
> > com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1947)
> > > > >         at
>
> > com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1619)
> > > > >         at
>
> > com.sun.enterprise.web.WebApplication.start(WebApplication.java:90)
> > > > >         at
>
> > org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
> > > > >         at
>
> > org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
> > > > >         at
>
> > org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236)
> > > > >         at
>
> ...
>
> read more »

-- 
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en

Reply via email to