Hi,
The problem has been solved. 

Regards,

Ünsal

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 1. August 2005 11:49
An: [email protected]
Betreff: Problems using StartupServletContextListener to init 
JDO-PersistenceManagerFactory...

Hi all,
I am trying to init the JDO-PersistenceManagerFactory by using the 
StartupServletContextListener.
But it does not work, I get the console output below. The JDOHelper class whose 
ClassDef is not found is a class that PmContext uses.
Am I using the StartupServletContextListener incorrectly?
Is there another way to initialize the JDO-PersistenceManagerFactory?

My configuration:
Apache Tomcat/5.5.7, JVM Version: 1.5.0_04-b05, myfaces-1.0.9.

Below is the console output, JDOInitializer code and the relevant web.xml 
fragment.

Thanks,

Ünsal
 

...
SCHWERWIEGEND: Exception sending context initialized event to listener instance 
of class com.karthago.web.JDOInitializer
java.lang.NoClassDefFoundError: javax/jdo/JDOHelper
        at com.karthago.domain.PmContext.initialize(PmContext.java:51)
        at 
com.karthago.web.JDOInitializer.contextInitialized(JDOInitializer.java:68)
        at 
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3637)
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4073)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1011)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1011)
        at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:440)
        at 
org.apache.catalina.core.StandardService.start(StandardService.java:450)
        at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
01.08.2005 11:15:43 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Error listenerStart
01.08.2005 11:15:43 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Context startup failed due to previous errors
01.08.2005 11:15:43 org.apache.catalina.core.ApplicationContext log
SCHWERWIEGEND: Exception sending context destroyed event to listener instance 
of class com.karthago.web.JDOInitializer
java.lang.NoClassDefFoundError: 
com/versant/core/jdo/VersantPersistenceManagerFactory
        at com.karthago.domain.PmContext.shutdown(PmContext.java:78)
        at 
com.karthago.web.JDOInitializer.contextDestroyed(JDOInitializer.java:78)
        at 
org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3678)
        at 
org.apache.catalina.core.StandardContext.stop(StandardContext.java:4293)
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4101)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1011)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1011)
        at 
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:440)
        at 
org.apache.catalina.core.StandardService.start(StandardService.java:450)
        at 
org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
...

_______________________________________________________

package com.karthago.web;

import javax.servlet.*;
import org.apache.myfaces.webapp.StartupServletContextListener;
import com.karthago.domain.PmContext;

public class JDOInitializer extends StartupServletContextListener {

        
        public JDOInitializer()
        {
        }
        
        public void contextInitialized(ServletContextEvent event)
        {
                ServletContext servletContext = event.getServletContext();
                Utils.log(servletContext, "Initializing ProjectTrack...");
                try {
                        servletContext.setAttribute(Constants.PM_CONTEXT_KEY,
                                        PmContext.class);
            PmContext.initialize(PmContext.loadJDOProperties());
        } catch (Exception e) {
                servletContext.log("Unable to load PMF properties.", e);
                } 
        
                Utils.log(servletContext, "Initialization complete...");
        }
        
        public void contextDestroyed(ServletContextEvent event)
        {
                        PmContext.shutdown();
        }
}

_____________________________________


web.xml:

        ...
    <!-- Listener, that does all the startup work (configuration, init).-->
    <listener>
        
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
    </listener>
        <listener>
        <listener-class>com.karthago.web.JDOInitializer</listener-class>
    </listener>
        ...


Reply via email to