YOU GET THE GOLD STAR!!!!!
OF COURSE! Another case of the trees blocking the view of the forest!!!
A simple modification of the "problem" area in the specific BEAN class to <BR><BR>[code] if(DEBUG) System.out.println(getHandlerName()+".getCWMManagerBean() for "+m_EJBName+" - bean is null, trying NO-ARG Creation here");
// bean = (CWMManager) getBean(CWMManagerHome.class);
InitialContext ic = new InitialContext();
home = (CWMManagerHome) ic.lookup(m_EJBName);
bean = home.create();
if(DEBUG && (bean != null)) System.out.println(getHandlerName()+".getCWMManagerBean() for "+m_EJBName+" - bean is CREATED!!!");[/code]<BR><BR>
resolves correctly to get me passed this hurdle. <BR><BR>[B]LOG:[/B]<BR>[code][#|2008-11-12T15:16:22.170-0600|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=19;_ThreadName=httpSSLWorkerThread-8081-1;|
CWMManagerBeanHandler.save() - attempts to create CWMManagerBean object|#]
[#|2008-11-12T15:16:22.170-0600|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=19;_ThreadName=httpSSLWorkerThread-8081-1;|
CWMManagerBeanHandler.getCWMManagerBean() for ejb/CWMManager - bean is null, trying NO-ARG Creation here|#]
[#|2008-11-12T15:16:22.217-0600|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=19;_ThreadName=httpSSLWorkerThread-8081-1;|
CWMManagerBeanHandler.getCWMManagerBean() for ejb/CWMManager - bean is CREATED!!!|#]
[#|2008-11-12T15:16:22.217-0600|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=19;_ThreadName=httpSSLWorkerThread-8081-1;|
CWMManagerBeanHandler.getCWMManagerBean() for ejb/CWMManager - returning bean|#]
[#|2008-11-12T15:16:22.217-0600|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=19;_ThreadName=httpSSLWorkerThread-8081-1;|
CWMManagerBeanHandler.save() - calls save method of CWMManagerBean object passing MonitorData object|#]
[/code]<BR><BR>
Now, to go back into the BaseBeanHandler and make this generic, then after I get the whole project working, I'll see about making it more portable.
<BR><BR>
:)
<BR><BR>
So, I change the code back to original method:<BR><BR>[code] protected CWMManager getCWMManagerBean()
throws Exception
{
CWMManager bean = null;
// CWMManagerHome home = null;
try
{
if(DEBUG) System.out.println(getHandlerName()+".getCWMManagerBean() for "+m_EJBName+" - calling baseBeanHandler.getBean method passing CWMManagerHome.class");
bean = (CWMManager) getBean(CWMManagerHome.class);
// InitialContext ic = new InitialContext();
// home = (CWMManagerHome) ic.lookup(m_EJBName);
// bean = home.create();
if(DEBUG) System.out.println(getHandlerName()+".getCWMManagerBean() for "+m_EJBName+" - bean is CREATED!!!");
}
catch(Exception e)
{
if(DEBUG) System.out.println(getHandlerName()+".getCWMManagerBean() for "+m_EJBName+" - bean creation FAILED here");
bean = null;
closeJNDIContext();
throw e;
}
if(DEBUG) System.out.println(getHandlerName()+".getCWMManagerBean() for "+m_EJBName+" - returning bean");
return bean;
}[/code]<BR><BR>
Then, I change the BaseBeanHandler's getBean method to:[code] protected Object getBean(Class homeClass)
throws Exception
{
Object bean = null;
Method create = null;
try
{
if(DEBUG) System.out.println("BaseBeanHandler-"+getHandlerName()+".getBean() for "+m_EJBName+" - defining the 'create' method for"+homeClass.getName());
create = homeClass.getMethod("create", new Class[0]);
}
catch(Exception e)
{
if(DEBUG) System.out.println("BaseBeanHandler-"+getHandlerName()+".getBean() for "+m_EJBName+" - FAILED defining the 'create' method for"+homeClass.getName());
throw e;
}
try
{
// if(DEBUG) System.out.println("BaseBeanHandler-"+getHandlerName()+".getBean() for "+m_EJBName+" - using original code - attempt bean creation");
// Object home = PortableRemoteObject.narrow(getJNDIContext().lookup(m_EJBName), homeClass);
if(DEBUG) System.out.println("BaseBeanHandler-"+getHandlerName()+".getBean() for "+m_EJBName+" - attempt no-arg bean creation");
Object home = new InitialContext().lookup(m_EJBName);
if(DEBUG) System.out.println("BaseBeanHandler-"+getHandlerName()+".getBean() for "+m_EJBName+" - trying to call the create method");
bean = create.invoke(home, (Object) new Class[0]);;
}
catch(Exception e)
{
if(DEBUG) System.out.println("BaseBeanHandler-"+getHandlerName()+".getBean() for "+m_EJBName+" - bean creation failed");
bean = null;
closeJNDIContext();
}
if(bean == null)
{
try
{
// if(DEBUG) System.out.println(getHandlerName()+".getBean() for "+m_EJBName+" - using original code - bean is null, retrying");
// Object home = PortableRemoteObject.narrow(getJNDIContext().lookup(m_EJBName), homeClass);
if(DEBUG) System.out.println("BaseBeanHandler-"+getHandlerName()+".getBean() for "+m_EJBName+" - 2nd attempt no-arg bean creation");
Object home = new InitialContext().lookup(m_EJBName);
if(DEBUG) System.out.println("BaseBeanHandler-"+getHandlerName()+".getBean() for "+m_EJBName+" - trying to call the create method");
bean = create.invoke(home, (Object) new Class[0]);;
}
catch(Exception e)
{
if(DEBUG) System.out.println("BaseBeanHandler-"+getHandlerName()+".getBean() for "+m_EJBName+" - bean creation failed AGAIN");
bean = null;
closeJNDIContext();
throw e;
}
}
if(DEBUG && (bean != null)) System.out.println("BaseBeanHandler-"+getHandlerName()+".getBean() for "+m_EJBName+" - bean is created and returned");
return bean;
}
[/code]<BR><BR>But, this time, something DIFFERENT happens<BR><BR>[b]LOG:[/b]<BR>[code]
[#|2008-11-12T16:12:43.082-0600|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=16;_ThreadName=httpSSLWorkerThread-8081-0;|
BaseBeanHandler-CWMManagerBeanHandler.getBean() for ejb/CWMManager - defining the 'create' method for CWM.CWMManager.ejb.CWMManagerHome|#]
[#|2008-11-12T16:12:43.082-0600|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=16;_ThreadName=httpSSLWorkerThread-8081-0;|
BaseBeanHandler-CWMManagerBeanHandler.getBean() for ejb/CWMManager - attempt no-arg bean creation|#]
[#|2008-11-12T16:12:43.098-0600|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=16;_ThreadName=httpSSLWorkerThread-8081-0;|
BaseBeanHandler-CWMManagerBeanHandler.getBean() for ejb/CWMManager - trying to call the create method|#]
[#|2008-11-12T16:12:43.098-0600|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=16;_ThreadName=httpSSLWorkerThread-8081-0;|
BaseBeanHandler-CWMManagerBeanHandler.getBean() for ejb/CWMManager - bean creation failed|#]
[#|2008-11-12T16:12:43.098-0600|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=16;_ThreadName=httpSSLWorkerThread-8081-0;|
BaseBeanHandler-CWMManagerBeanHandler.getBean() for ejb/CWMManager - 2nd attempt no-arg bean creation|#]
[#|2008-11-12T16:12:43.098-0600|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=16;_ThreadName=httpSSLWorkerThread-8081-0;|
BaseBeanHandler-CWMManagerBeanHandler.getBean() for ejb/CWMManager - trying to call the create method|#]
[#|2008-11-12T16:12:43.098-0600|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=16;_ThreadName=httpSSLWorkerThread-8081-0;|
BaseBeanHandler-CWMManagerBeanHandler.getBean() for ejb/CWMManager - bean creation failed AGAIN|#]
[#|2008-11-12T16:12:43.098-0600|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=16;_ThreadName=httpSSLWorkerThread-8081-0;|
CWMManagerBeanHandler.save() - Elapsed time = 00:00:00.016 - Exception: java.lang.IllegalArgumentException: wrong number of arguments|#]
[#|2008-11-12T16:12:43.129-0600|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=16;_ThreadName=httpSSLWorkerThread-8081-0;|
java.lang.IllegalArgumentException: wrong number of arguments
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)[/code]<BR><BR>
Da Lizard
[Message sent by forum member 'loungelizard' (loungelizard)]
http://forums.java.net/jive/thread.jspa?messageID=316425