Redeploy error
l.g. Oct 18, 2002 4:27 PMEnv: jboss-3.0.3(with jetty), RedHat 7.3, sun j2sdk 1.4
the same result on NT4 and j2sdk 1.4.1_01 jboss-3.0.2
======================================
I have javaBean in application scope. On application startup it gets data from EJB and caches it. It's working just fine when I start jboss and ALWAYS fail on redeploy - no hot redeploy!
Any idea what is wrong?
======================================
bean:
======================================
import java.util.HashMap;
import org.apache.log4j.Category;
import com.rteasset.RteException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.naming.NamingException;
import javax.ejb.EJBException;
import javax.ejb.CreateException;
import java.rmi.RemoteException;
import com.rteasset.RteException;
public class CacheBean extends Object implements java.io.Serializable {
private Category log = Category.getInstance(getClass());
protected HashMap cache = new HashMap();
protected HashMap homes = new HashMap();
protected Constants constants = Constants.getInstance();
/** Creates new CacheBean */
public CacheBean() {
try{
this.init();
}catch (Exception ex){
throw new RuntimeException(ex.getMessage());
}
}
/**
* Retrieves cached object by name
*
*/
public Object getCachedObject(java.lang.String objectName) {
return cache.get(objectName);
}
/**
* Call by init(), also allows to refresh cached object
*
*/
public void setCachedObject(java.lang.String objectName, Object obj) {
this.cache.put(objectName, obj);
}
/**
* init() - Populates on application startup all cached objects
*
*/
protected void init() throws RteException{
log.debug("Cache init()");
this.populateCache();
}
protected void populateCache() throws RteException{
log.debug("populateCache(): start");
try{
ModelAppInitHome home = null;
Object ref = this.getHome(constants.MODEL_APP_INIT_JNDI, false);
log.debug("ref 1: " + ref);
try{
home = (ModelAppInitHome) PortableRemoteObject.narrow(ref, ModelAppInitHome.class);
log.debug("populateCache()::home 1: " + home);
} catch (Exception ex){
log.debug("populateCache()::Exception: " + ex.getClass());
log.debug("populateCache()::Stale home?: " + home);
ref = this.getHome(constants.MODEL_APP_INIT_JNDI, true);
log.debug("populateCache()::ref 2: " + ref);
home = (ModelAppInitHome) PortableRemoteObject.narrow(ref, ModelAppInitHome.class);
log.debug("populateCache()::home 2: " + home);
}
log.debug("populateCache()::home 3: " + home);
ModelAppInit modelAppInit = home.create();
log.debug("populateCache()::modelAppInit: " + modelAppInit);
this.cache = modelAppInit.initApp();
log.debug("populateCache()::cache: " + cache);
} catch (RemoteException re){
throw new RteException("RemoteException: " + re.getMessage());
} catch (CreateException ce){
throw new RteException("CreateException: " + ce.getMessage());
} catch (Exception ex){
throw new RteException("Exception in populateCache(): " + ex.getMessage());
}
}
/**
* Retrieves cached Home Interface object by name
* if object does not exist it's created and cached
*
*/
public Object getHome(java.lang.String homeName, boolean forceReload) {
log.debug("getHome()::homeName: " + homeName);
log.debug("getHome()::homes: " + homes);
Object homeObj = homes.get(homeName);
log.debug("getHome()::homeObj1: " + homeObj);
log.debug("getHome()::forceReload: " + forceReload);
if (homeObj == null || forceReload){
try{
InitialContext iniCtx = new InitialContext();
log.debug("getHome()::iniCtx: " + iniCtx);
homeObj = iniCtx.lookup(homeName);
log.debug("getHome()::homeObj2: " + homeObj);
homes.put(homeName, homeObj);
} catch (NamingException ex) {
throw new EJBException("NamingException: " + ex.getMessage());
}
}
return homeObj;
}
}
========================================
error:
========================================
2002-10-18 11:18:23,732 DEBUG [org.jboss.jetty.JettyService] AbstractWebContainer.parseWebAppDescriptors, End
2002-10-18 11:18:23,734 DEBUG [org.jboss.jetty.JBossWebApplicationContext#/model] setting up ENC succeeded
2002-10-18 11:18:23,735 DEBUG [org.jboss.jetty.security.JBossUserRealm#Model] initialising...
2002-10-18 11:18:23,806 DEBUG [org.jboss.jetty.security.JBossUserRealm#Model] ...initialised
2002-10-18 11:18:23,940 INFO [org.jboss.jbossweb] Started WebApplicationContext[/model,jar:file:/usr/java/jboss-3.0.3/server/default/tmp/deploy/server/default/deploy/model.ear/68.model.ear-contents/model.war!/]
2002-10-18 11:18:23,943 DEBUG [com.rteasset.model.listener.ModelAppListener] servletContext: org.mortbay.jetty.servlet.ServletHandler$Context@d88aa2
2002-10-18 11:18:23,951 DEBUG [com.rteasset.model.CacheBean] Cache init()
2002-10-18 11:18:23,953 DEBUG [com.rteasset.model.CacheBean] populateCache(): start
2002-10-18 11:18:23,954 DEBUG [com.rteasset.model.CacheBean] getHome()::homeName: ejb/ModelAppInit
2002-10-18 11:18:23,956 DEBUG [com.rteasset.model.CacheBean] getHome()::homes: {}
2002-10-18 11:18:23,957 DEBUG [com.rteasset.model.CacheBean] getHome()::homeObj1: null
2002-10-18 11:18:23,958 DEBUG [com.rteasset.model.CacheBean] getHome()::forceReload: false
2002-10-18 11:18:23,960 DEBUG [com.rteasset.model.CacheBean] getHome()::iniCtx: javax.naming.InitialContext@75cea3
2002-10-18 11:18:24,116 DEBUG [com.rteasset.model.CacheBean] getHome()::homeObj2: ejb/ModelAppInitHome
2002-10-18 11:18:24,118 DEBUG [com.rteasset.model.CacheBean] ref: ejb/ModelAppInitHome
2002-10-18 11:18:24,120 DEBUG [com.rteasset.model.CacheBean] populateCache()::Exception: class java.lang.ClassCastException
2002-10-18 11:18:24,122 DEBUG [com.rteasset.model.CacheBean] populateCache()::Stale home?: null
2002-10-18 11:18:24,123 DEBUG [com.rteasset.model.CacheBean] getHome()::homeName: ejb/ModelAppInit
2002-10-18 11:18:24,124 DEBUG [com.rteasset.model.CacheBean] getHome()::homes: {ejb/ModelAppInit=ejb/ModelAppInitHome}
2002-10-18 11:18:24,125 DEBUG [com.rteasset.model.CacheBean] getHome()::homeObj1: ejb/ModelAppInitHome
2002-10-18 11:18:24,126 DEBUG [com.rteasset.model.CacheBean] getHome()::forceReload: true
2002-10-18 11:18:24,128 DEBUG [com.rteasset.model.CacheBean] getHome()::iniCtx: javax.naming.InitialContext@1e1df6e
2002-10-18 11:18:24,149 DEBUG [com.rteasset.model.CacheBean] getHome()::homeObj2: ejb/ModelAppInitHome
2002-10-18 11:18:24,150 DEBUG [com.rteasset.model.CacheBean] populateCache()::homeObj3: ejb/ModelAppInitHome
2002-10-18 11:18:24,160 WARN [org.jboss.jbossweb] WARNING: Exception in populateCache(): null
java.lang.RuntimeException: Exception in populateCache(): null
at com.rteasset.model.CacheBean.(CacheBean.java:26)
at com.rteasset.model.listener.ModelAppListener.initApp(ModelAppListener.java:42)
at com.rteasset.model.listener.ModelAppListener.contextInitialized(ModelAppListener.java:37)
at org.mortbay.jetty.servlet.WebApplicationContext.start(WebApplicationContext.java:482)
at org.mortbay.j2ee.J2EEWebApplicationContext.start(J2EEWebApplicationContext.java:85)
at org.jboss.jetty.Jetty.deploy(Jetty.java:412)
at org.jboss.jetty.JettyService.performDeploy(JettyService.java:243)
at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:300)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:802)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:794)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:616)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:580)
at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
at $Proxy4.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:427)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:553)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:212)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:225)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:202)
2002-10-18 11:18:24,180 INFO [org.jboss.jbossweb] Exception in populateCache(): null: java.lang.RuntimeException: Exception in populateCache(): null
2002-10-18 11:18:25,130 INFO [org.jboss.jbossweb] successfully deployed file:/usr/java/jboss-3.0.3/server/default/tmp/deploy/server/default/deploy/model.ear/68.model.ear-contents/model.war to /model
2002-10-18 11:18:25,132 DEBUG [org.jboss.deployment.MainDeployer] End deployment start on package: model.war
====================================
TIA