Hi again,
I am hoping someone has the time to look into this problem I posted yesterday or has some experience in this area. I would appreciate any input. Thanks again, Robert Robert Read, Analyst Programmer, ITS Group Applications, The University of Auckland. Ph +64 9 923 2475 Ext 82475 Email [email protected] Web www.auckland.ac.nz ________________________________ From: Robert Read Sent: Wednesday, 11 February 2009 9:08 p.m. To: [email protected] Subject: FW: Context param question Hi all, I have written a Custom Beehive Control that wraps the J2SSH Java library for obtaining an SSH connection and SFTP session with a remote host for the purpose of transferring a file. The new control implements PGP authentication against the remote server using a public/private key-pair. This works fine between my desktop and an in-house remote host when the values for the host, port #, user, path to the keyfile, passphrase etc. are hard-coded. I have parameterised these values so that the control can be configured externally and I am attempting to use the http://beehive.apache.org/docs/1.0.1/controls/apidocs/javadoc/org/apache /beehive/controls/runtime/servlet/ServletBeanContext.html <http://beehive.apache.org/docs/1.0.1/controls/apidocs/javadoc/org/apach e/beehive/controls/runtime/servlet/ServletBeanContext.html> to gain a reference to the ServletContext and get the values for the parameters from context-param entries in the web.xml config file by calling getInitParameter(String name) on the ServletContext. The Beehive documentation states that defining a reference in the Control implementation class and annotating it @Context will suffice for its initialisation, but I get the following stack trace: Exception in sendFile org.apache.beehive.controls.api.ControlException: Control initialization failure[org.apache.beehive.controls.api.ControlException: Contextual service org.apache.beehive.controls.runtime.servlet.ServletBeanContext is not available] Caused by: org.apache.beehive.controls.api.ControlException: Contextual service org.apache.beehive.controls.runtime.servlet.ServletBeanContext is not available ... 40 more at org.apache.beehive.controls.runtime.bean.ControlBean.ensureControl(Contr olBean.java:325) at controls.SftpBean.sendFile(SftpBean.java:111) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.bea.wli.knex.runtime.jcs.container.JcsProxy.invokeBeehiveControl(Jcs Proxy.java:666) at com.bea.wli.knex.runtime.jcs.container.JcsProxy.invoke(JcsProxy.java:433 ) at controls.Sftp.sendFile(Unknown Source) at processes.UoaSerkoUserExtract.sftpPut1(UoaSerkoUserExtract.jws:122) I attempt to call the ServletBeanContext.getServletContext() method from the onAcquire() lifecycle method of my control. I also have a ResourceContext associated with the onAcquire() method via an @EventHandler annotation. Any ideas why the ServletBeanContext is not available and what I could do to ensure it is? Cheers, Robert Robert Read, Analyst Programmer, ITS Group Applications, The University of Auckland. Ph +64 9 923 2475 Ext 82475 Email [email protected] Web www.auckland.ac.nz
