You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@beehive.apache.org by Chris Hogue <cs...@gmail.com> on 2006/07/26 16:23:21 UTC

Re: EJB Control doesn't work on java class

Hi Max,

I'm not sure you can use @Control instantiation in a regular Java
class. I don't believe there's anything that triggers the
instantiation. When you run in a page flow or another control those
have a "control container" that handles this.

Have you tried programmatic instantiation as described here?

http://beehive.apache.org/docs/1.0.1/controls/programming.html#Programmatic+Instantiation


-Chris


On 7/26/06, Ricci, Massimiliano (HPS C&I, HP-Italy)
<ma...@hp.com> wrote:
> Hi folks,
>
> I'm trying to use Beehive EJB control in my project.
> I've done two tests.
> In the first one I've created a Session EJB ("ProvaSessionBean") using
> IBM Application Server Toolkit (AST), with just one method (String
> welcomeName (String name)), and imported (the jar file) it on BEA
> Workshop 9.2.0 for Weblogic Platform. I've created a new "Dynamic Web
> Project" using Beehive facets (Controls & NetUI). By the wizard I've
> created an EJB Control (filling the field "JNDI Name" with the value in
> META-INF\ibm-ejb-jar-bnd.xmi ("ejb/ejbs/ProvaSessionBeanHome") and from
> META-INF\ejb-jar.xml for Home/Business Interface
> ("ejbs.ProvaSessionBean" and "ejbs.ProvaSessionBeanHome")).
>
> In Controller class I've instanced the EJB Control by annotation
> (@Control) and call the EJB method in the Controller method. I've
> exported the ear file and deployed it on IBM WebSphere Application
> Server 6.1
> In this case all work correctly.
>
> Then I've tried to use the EJB Control in a normal Java class.
> I've imported the EJB (jar) in my project, and created a "Dynamic Web
> Project" not using Beehive technology (in particular Beehive NetUI).
> I've imported jar to use EJB Control (beehive-controls.jar,
> beehive-ejb-control.jar) and created EJB Control
> (ProvaSessioBeanCtrl.java) following the same step described above. Then
> I've created a (simple) Java class (Prova.java) to instance the control
> (using annotation @Control) and use EJB method, and a jsp page where I
> called this java class.
> I've exported the ear file and deployed it on IBM WebSphere Application
> Server 6.1.
> When I've tested the application a "java.lang.NullPointerException" was
> generated because the EJB Control in java class not was instanced!
> I've checked that every class by APT was created (Prova.class,
> Prova.controls.properties, ProvaClientInitializer.class,
> ProvaSessioBeanCtrl.class, ProvaSessioBeanCtrlBean.class,
> ProvaSessioBeanCtrlBean.class.manifest,
> ProvaSessioBeanCtrlBeanBeanInfo.class) and all seems correct.
>
> Have anybody some idea because EJB Control doesn't work on java class?
> Is it possibile use Beehive EJB Control (or Beehive Control in general)
> in a Java class instead in a PageFlow?
>
> Thanks in advance,
> Max
>

Re: EJB Control doesn't work on java class

Posted by Chad Schoettger <ch...@gmail.com>.
If the file didn't make it this time, in your Beehive distribution
just take a look at:

<beehive_dist_home>/samples/controls-spring/web/familyTree.jsp

  - Chad

On 7/26/06, Chad Schoettger <ch...@gmail.com> wrote:
> I've reattached it in a zip file.
>
>  - Chad
>
> On 7/26/06, Ricci, Massimiliano (HPS C&I, HP-Italy)
> <ma...@hp.com> wrote:
> > Hi Chad,
> >
> > Unfortunately I'm not able to view your JSP file (there isn't any file attached in your e-mail, probably because the proxy removed it).
> > Could you resend it?
> >
> > Thanks in advance,
> >  - Max
> >
> > > -----Original Message-----
> > > From: Chad Schoettger [mailto:chad.schoettger@gmail.com]
> > > Sent: mercoledì 26 luglio 2006 18.06
> > > To: Beehive Users
> > > Subject: Re: EJB Control doesn't work on java class
> > >
> > > Hi Max,
> > >
> > > As Chris said the reason you are getting the npe is because
> > > the control is not being instantiated.
> > >
> > > You can use a Beehive control directly from a JSP, it sounds
> > > like that might work for you in this case.  I've attached a
> > > sample JSP file from the Beehive controls-spring sample which
> > > demonstrates how to use a control from a JSP.  You don't need
> > > Spring to do this -- this was just the first sample I came across.
> > >
> > >   - Chad
> > >
> > > On 7/26/06, Chris Hogue <cs...@gmail.com> wrote:
> > > > Hi Max,
> > > >
> > > > I'm not sure you can use @Control instantiation in a regular Java
> > > > class. I don't believe there's anything that triggers the
> > > > instantiation. When you run in a page flow or another control those
> > > > have a "control container" that handles this.
> > > >
> > > > Have you tried programmatic instantiation as described here?
> > > >
> > > >
> > > http://beehive.apache.org/docs/1.0.1/controls/programming.html#Program
> > > > matic+Instantiation
> > > >
> > > >
> > > > -Chris
> > > >
> > > >
> > > > On 7/26/06, Ricci, Massimiliano (HPS C&I, HP-Italy)
> > > > <ma...@hp.com> wrote:
> > > > > Hi folks,
> > > > >
> > > > > I'm trying to use Beehive EJB control in my project.
> > > > > I've done two tests.
> > > > > In the first one I've created a Session EJB ("ProvaSessionBean")
> > > > > using IBM Application Server Toolkit (AST), with just one method
> > > > > (String welcomeName (String name)), and imported (the jar
> > > file) it
> > > > > on BEA Workshop 9.2.0 for Weblogic Platform. I've created a new
> > > > > "Dynamic Web Project" using Beehive facets (Controls & NetUI). By
> > > > > the wizard I've created an EJB Control (filling the field "JNDI
> > > > > Name" with the value in META-INF\ibm-ejb-jar-bnd.xmi
> > > > > ("ejb/ejbs/ProvaSessionBeanHome") and from
> > > META-INF\ejb-jar.xml for
> > > > > Home/Business Interface ("ejbs.ProvaSessionBean" and
> > > "ejbs.ProvaSessionBeanHome")).
> > > > >
> > > > > In Controller class I've instanced the EJB Control by annotation
> > > > > (@Control) and call the EJB method in the Controller method. I've
> > > > > exported the ear file and deployed it on IBM WebSphere
> > > Application
> > > > > Server 6.1 In this case all work correctly.
> > > > >
> > > > > Then I've tried to use the EJB Control in a normal Java class.
> > > > > I've imported the EJB (jar) in my project, and created a "Dynamic
> > > > > Web Project" not using Beehive technology (in particular
> > > Beehive NetUI).
> > > > > I've imported jar to use EJB Control (beehive-controls.jar,
> > > > > beehive-ejb-control.jar) and created EJB Control
> > > > > (ProvaSessioBeanCtrl.java) following the same step
> > > described above.
> > > > > Then I've created a (simple) Java class (Prova.java) to
> > > instance the
> > > > > control (using annotation @Control) and use EJB method, and a jsp
> > > > > page where I called this java class.
> > > > > I've exported the ear file and deployed it on IBM WebSphere
> > > > > Application Server 6.1.
> > > > > When I've tested the application a
> > > "java.lang.NullPointerException"
> > > > > was generated because the EJB Control in java class not
> > > was instanced!
> > > > > I've checked that every class by APT was created (Prova.class,
> > > > > Prova.controls.properties, ProvaClientInitializer.class,
> > > > > ProvaSessioBeanCtrl.class, ProvaSessioBeanCtrlBean.class,
> > > > > ProvaSessioBeanCtrlBean.class.manifest,
> > > > > ProvaSessioBeanCtrlBeanBeanInfo.class) and all seems correct.
> > > > >
> > > > > Have anybody some idea because EJB Control doesn't work
> > > on java class?
> > > > > Is it possibile use Beehive EJB Control (or Beehive Control in
> > > > > general) in a Java class instead in a PageFlow?
> > > > >
> > > > > Thanks in advance,
> > > > > Max
> > > > >
> > > >
> > >
> >
>
>
>

Re: EJB Control doesn't work on java class

Posted by Chad Schoettger <ch...@gmail.com>.
I've reattached it in a zip file.

 - Chad

On 7/26/06, Ricci, Massimiliano (HPS C&I, HP-Italy)
<ma...@hp.com> wrote:
> Hi Chad,
>
> Unfortunately I'm not able to view your JSP file (there isn't any file attached in your e-mail, probably because the proxy removed it).
> Could you resend it?
>
> Thanks in advance,
>  - Max
>
> > -----Original Message-----
> > From: Chad Schoettger [mailto:chad.schoettger@gmail.com]
> > Sent: mercoledì 26 luglio 2006 18.06
> > To: Beehive Users
> > Subject: Re: EJB Control doesn't work on java class
> >
> > Hi Max,
> >
> > As Chris said the reason you are getting the npe is because
> > the control is not being instantiated.
> >
> > You can use a Beehive control directly from a JSP, it sounds
> > like that might work for you in this case.  I've attached a
> > sample JSP file from the Beehive controls-spring sample which
> > demonstrates how to use a control from a JSP.  You don't need
> > Spring to do this -- this was just the first sample I came across.
> >
> >   - Chad
> >
> > On 7/26/06, Chris Hogue <cs...@gmail.com> wrote:
> > > Hi Max,
> > >
> > > I'm not sure you can use @Control instantiation in a regular Java
> > > class. I don't believe there's anything that triggers the
> > > instantiation. When you run in a page flow or another control those
> > > have a "control container" that handles this.
> > >
> > > Have you tried programmatic instantiation as described here?
> > >
> > >
> > http://beehive.apache.org/docs/1.0.1/controls/programming.html#Program
> > > matic+Instantiation
> > >
> > >
> > > -Chris
> > >
> > >
> > > On 7/26/06, Ricci, Massimiliano (HPS C&I, HP-Italy)
> > > <ma...@hp.com> wrote:
> > > > Hi folks,
> > > >
> > > > I'm trying to use Beehive EJB control in my project.
> > > > I've done two tests.
> > > > In the first one I've created a Session EJB ("ProvaSessionBean")
> > > > using IBM Application Server Toolkit (AST), with just one method
> > > > (String welcomeName (String name)), and imported (the jar
> > file) it
> > > > on BEA Workshop 9.2.0 for Weblogic Platform. I've created a new
> > > > "Dynamic Web Project" using Beehive facets (Controls & NetUI). By
> > > > the wizard I've created an EJB Control (filling the field "JNDI
> > > > Name" with the value in META-INF\ibm-ejb-jar-bnd.xmi
> > > > ("ejb/ejbs/ProvaSessionBeanHome") and from
> > META-INF\ejb-jar.xml for
> > > > Home/Business Interface ("ejbs.ProvaSessionBean" and
> > "ejbs.ProvaSessionBeanHome")).
> > > >
> > > > In Controller class I've instanced the EJB Control by annotation
> > > > (@Control) and call the EJB method in the Controller method. I've
> > > > exported the ear file and deployed it on IBM WebSphere
> > Application
> > > > Server 6.1 In this case all work correctly.
> > > >
> > > > Then I've tried to use the EJB Control in a normal Java class.
> > > > I've imported the EJB (jar) in my project, and created a "Dynamic
> > > > Web Project" not using Beehive technology (in particular
> > Beehive NetUI).
> > > > I've imported jar to use EJB Control (beehive-controls.jar,
> > > > beehive-ejb-control.jar) and created EJB Control
> > > > (ProvaSessioBeanCtrl.java) following the same step
> > described above.
> > > > Then I've created a (simple) Java class (Prova.java) to
> > instance the
> > > > control (using annotation @Control) and use EJB method, and a jsp
> > > > page where I called this java class.
> > > > I've exported the ear file and deployed it on IBM WebSphere
> > > > Application Server 6.1.
> > > > When I've tested the application a
> > "java.lang.NullPointerException"
> > > > was generated because the EJB Control in java class not
> > was instanced!
> > > > I've checked that every class by APT was created (Prova.class,
> > > > Prova.controls.properties, ProvaClientInitializer.class,
> > > > ProvaSessioBeanCtrl.class, ProvaSessioBeanCtrlBean.class,
> > > > ProvaSessioBeanCtrlBean.class.manifest,
> > > > ProvaSessioBeanCtrlBeanBeanInfo.class) and all seems correct.
> > > >
> > > > Have anybody some idea because EJB Control doesn't work
> > on java class?
> > > > Is it possibile use Beehive EJB Control (or Beehive Control in
> > > > general) in a Java class instead in a PageFlow?
> > > >
> > > > Thanks in advance,
> > > > Max
> > > >
> > >
> >
>

RE: EJB Control doesn't work on java class

Posted by "Ricci, Massimiliano (HPS C&I, HP-Italy)" <ma...@hp.com>.
Hi Chad,

Unfortunately I'm not able to view your JSP file (there isn't any file attached in your e-mail, probably because the proxy removed it).
Could you resend it?

Thanks in advance,
 - Max

> -----Original Message-----
> From: Chad Schoettger [mailto:chad.schoettger@gmail.com] 
> Sent: mercoledì 26 luglio 2006 18.06
> To: Beehive Users
> Subject: Re: EJB Control doesn't work on java class
> 
> Hi Max,
> 
> As Chris said the reason you are getting the npe is because 
> the control is not being instantiated.
> 
> You can use a Beehive control directly from a JSP, it sounds 
> like that might work for you in this case.  I've attached a 
> sample JSP file from the Beehive controls-spring sample which 
> demonstrates how to use a control from a JSP.  You don't need 
> Spring to do this -- this was just the first sample I came across.
> 
>   - Chad
> 
> On 7/26/06, Chris Hogue <cs...@gmail.com> wrote:
> > Hi Max,
> >
> > I'm not sure you can use @Control instantiation in a regular Java 
> > class. I don't believe there's anything that triggers the 
> > instantiation. When you run in a page flow or another control those 
> > have a "control container" that handles this.
> >
> > Have you tried programmatic instantiation as described here?
> >
> > 
> http://beehive.apache.org/docs/1.0.1/controls/programming.html#Program
> > matic+Instantiation
> >
> >
> > -Chris
> >
> >
> > On 7/26/06, Ricci, Massimiliano (HPS C&I, HP-Italy) 
> > <ma...@hp.com> wrote:
> > > Hi folks,
> > >
> > > I'm trying to use Beehive EJB control in my project.
> > > I've done two tests.
> > > In the first one I've created a Session EJB ("ProvaSessionBean") 
> > > using IBM Application Server Toolkit (AST), with just one method 
> > > (String welcomeName (String name)), and imported (the jar 
> file) it 
> > > on BEA Workshop 9.2.0 for Weblogic Platform. I've created a new 
> > > "Dynamic Web Project" using Beehive facets (Controls & NetUI). By 
> > > the wizard I've created an EJB Control (filling the field "JNDI 
> > > Name" with the value in META-INF\ibm-ejb-jar-bnd.xmi 
> > > ("ejb/ejbs/ProvaSessionBeanHome") and from 
> META-INF\ejb-jar.xml for 
> > > Home/Business Interface ("ejbs.ProvaSessionBean" and 
> "ejbs.ProvaSessionBeanHome")).
> > >
> > > In Controller class I've instanced the EJB Control by annotation
> > > (@Control) and call the EJB method in the Controller method. I've 
> > > exported the ear file and deployed it on IBM WebSphere 
> Application 
> > > Server 6.1 In this case all work correctly.
> > >
> > > Then I've tried to use the EJB Control in a normal Java class.
> > > I've imported the EJB (jar) in my project, and created a "Dynamic 
> > > Web Project" not using Beehive technology (in particular 
> Beehive NetUI).
> > > I've imported jar to use EJB Control (beehive-controls.jar,
> > > beehive-ejb-control.jar) and created EJB Control
> > > (ProvaSessioBeanCtrl.java) following the same step 
> described above. 
> > > Then I've created a (simple) Java class (Prova.java) to 
> instance the 
> > > control (using annotation @Control) and use EJB method, and a jsp 
> > > page where I called this java class.
> > > I've exported the ear file and deployed it on IBM WebSphere 
> > > Application Server 6.1.
> > > When I've tested the application a 
> "java.lang.NullPointerException" 
> > > was generated because the EJB Control in java class not 
> was instanced!
> > > I've checked that every class by APT was created (Prova.class, 
> > > Prova.controls.properties, ProvaClientInitializer.class, 
> > > ProvaSessioBeanCtrl.class, ProvaSessioBeanCtrlBean.class, 
> > > ProvaSessioBeanCtrlBean.class.manifest,
> > > ProvaSessioBeanCtrlBeanBeanInfo.class) and all seems correct.
> > >
> > > Have anybody some idea because EJB Control doesn't work 
> on java class?
> > > Is it possibile use Beehive EJB Control (or Beehive Control in 
> > > general) in a Java class instead in a PageFlow?
> > >
> > > Thanks in advance,
> > > Max
> > >
> >
> 

Re: EJB Control doesn't work on java class

Posted by Chad Schoettger <ch...@gmail.com>.
Hi Max,

As Chris said the reason you are getting the npe is because the
control is not being instantiated.

You can use a Beehive control directly from a JSP, it sounds like that
might work for you in this case.  I've attached a sample JSP file from
the Beehive controls-spring sample which demonstrates how to use a
control from a JSP.  You don't need Spring to do this -- this was just
the first sample I came across.

  - Chad

On 7/26/06, Chris Hogue <cs...@gmail.com> wrote:
> Hi Max,
>
> I'm not sure you can use @Control instantiation in a regular Java
> class. I don't believe there's anything that triggers the
> instantiation. When you run in a page flow or another control those
> have a "control container" that handles this.
>
> Have you tried programmatic instantiation as described here?
>
> http://beehive.apache.org/docs/1.0.1/controls/programming.html#Programmatic+Instantiation
>
>
> -Chris
>
>
> On 7/26/06, Ricci, Massimiliano (HPS C&I, HP-Italy)
> <ma...@hp.com> wrote:
> > Hi folks,
> >
> > I'm trying to use Beehive EJB control in my project.
> > I've done two tests.
> > In the first one I've created a Session EJB ("ProvaSessionBean") using
> > IBM Application Server Toolkit (AST), with just one method (String
> > welcomeName (String name)), and imported (the jar file) it on BEA
> > Workshop 9.2.0 for Weblogic Platform. I've created a new "Dynamic Web
> > Project" using Beehive facets (Controls & NetUI). By the wizard I've
> > created an EJB Control (filling the field "JNDI Name" with the value in
> > META-INF\ibm-ejb-jar-bnd.xmi ("ejb/ejbs/ProvaSessionBeanHome") and from
> > META-INF\ejb-jar.xml for Home/Business Interface
> > ("ejbs.ProvaSessionBean" and "ejbs.ProvaSessionBeanHome")).
> >
> > In Controller class I've instanced the EJB Control by annotation
> > (@Control) and call the EJB method in the Controller method. I've
> > exported the ear file and deployed it on IBM WebSphere Application
> > Server 6.1
> > In this case all work correctly.
> >
> > Then I've tried to use the EJB Control in a normal Java class.
> > I've imported the EJB (jar) in my project, and created a "Dynamic Web
> > Project" not using Beehive technology (in particular Beehive NetUI).
> > I've imported jar to use EJB Control (beehive-controls.jar,
> > beehive-ejb-control.jar) and created EJB Control
> > (ProvaSessioBeanCtrl.java) following the same step described above. Then
> > I've created a (simple) Java class (Prova.java) to instance the control
> > (using annotation @Control) and use EJB method, and a jsp page where I
> > called this java class.
> > I've exported the ear file and deployed it on IBM WebSphere Application
> > Server 6.1.
> > When I've tested the application a "java.lang.NullPointerException" was
> > generated because the EJB Control in java class not was instanced!
> > I've checked that every class by APT was created (Prova.class,
> > Prova.controls.properties, ProvaClientInitializer.class,
> > ProvaSessioBeanCtrl.class, ProvaSessioBeanCtrlBean.class,
> > ProvaSessioBeanCtrlBean.class.manifest,
> > ProvaSessioBeanCtrlBeanBeanInfo.class) and all seems correct.
> >
> > Have anybody some idea because EJB Control doesn't work on java class?
> > Is it possibile use Beehive EJB Control (or Beehive Control in general)
> > in a Java class instead in a PageFlow?
> >
> > Thanks in advance,
> > Max
> >
>

Re: EJB Control doesn't work on java class

Posted by Chad Schoettger <ch...@gmail.com>.
Hi Max,

If you really want to do this, the following pattern should work.  It
is not very pretty and a bit cumbersome, but the only way I'm aware of
to get a control which relies on lifecycle events to function in a
pojo.

I should also note that for the current version of Beehive controls
this is not a supported use case and only became possible recently
after the ControlTestContainerContext was written.

Any how, here's the pattern:

public class PojoTest {

    public void pojoMethod() throws Exception {

      org.apache.beehive.controls.test.container.ControlTestContainerContext
ctcc
       = new org.apache.beehive.controls.test.container.ControlTestContainerContext();

      ctcc.beginContext();
      ControlLifecycleBean clb =
Controls.instantiate(ControlLifecycleBean.class, null, ctcc, null);

      //
      // use the control
      //

      ctcc.endContext();
    }
}

The following should be noted:

1) The control must be instantiated via programmatic instantiation.
2) The beginContext() and endContext() roughly correspond to
onAquire/onRelease lifecycle invocations.
3) beginContext() must be invoked BEFORE the control is instantiated.

Hope this helps,

   - Chad

On 8/4/06, Ricci, Massimiliano (HPS C&I, HP-Italy)
<ma...@hp.com> wrote:
> Hi Chris,
>
> _Probably_ the problem is that the EJB Control need a "container context" to run. Is it possible to add a "container context" to a simple a Java class to use an EJB Control?
>
> Thanks in advance,
> Max
>
> > -----Original Message-----
> > From: Chris Hogue [mailto:cshogue@gmail.com]
> > Sent: 27 July 2006 21:20
> > To: Beehive Users
> > Subject: Re: EJB Control doesn't work on java class
> >
> > This actually looks more problematic than it first appears.
> > The EJB control (and others) rely on some of the lifecycle
> > methods like onAcquire and onRelease to get and release their
> > resources.
> >
> > So unfortunately I don't know of a quick answer to that
> > problem outside of a control container, it will take some
> > digging. If others have tips on how to accomplish this or
> > where to look that would be helpful.
> >
> > -Chris
> >
> > On 7/27/06, Ricci, Massimiliano (HPS C&I, HP-Italy)
> > <ma...@hp.com> wrote:
> > > Hi Chris,
> > >
> > > I'm retyped the code using programmatic and declarative
> > mechanism to instance the control.
> > >
> > > Unfortunately calling the two method (welcomeDeclarative,
> > welcomeProgrammatic) I'm getting in both case the same exception:
> > >
> > > org.apache.beehive.controls.api.ControlException: Control
> > > initialization failure[Contextual service
> > > org.apache.beehive.controls.api.context.ResourceContext is not
> > > available]
> > >
> > > Do you have any advice to solve this (two) problems
> > (declarative (if is possible) and programmatic)?
> > >
> > > This is my client class:
> > >
> > > package controls;
> > >
> > > import org.apache.beehive.controls.api.bean.Control;
> > > import org.apache.beehive.controls.api.bean.Controls;
> > > import org.apache.beehive.controls.api.context.ControlThreadContext;
> > >
> > > public class Prova {
> > >
> > >         @Control
> > >         private ProvaSessioBeanCtrl provaSessioBeanCtrl;
> > >
> > >         public Prova() throws ClassNotFoundException {
> > >
> > >                 try {
> > >                         Controls.initializeClient(null, this, null);
> > >                 } catch (ClassNotFoundException e) {
> > >
> > >                         e.printStackTrace();
> > >                 }
> > >         }
> > >
> > >         public String welcomeProgrammatic(String name) {
> > >                 String ritorno = "bubububu";
> > >                 try {
> > >
> > >                         ProvaSessioBeanCtrlBean
> > provaSessioBeanCtrl = (ProvaSessioBeanCtrlBean) Controls
> > >
> > .instantiate(ProvaSessioBeanCtrlBean.class, null,
> > >
> > ControlThreadContext.getContext(),
> > >
> > "provaSessioBeanCtrl");
> > >                         ritorno =
> > > provaSessioBeanCtrl.welcomeName(name);
> > >
> > >                 } catch (Exception ex) {
> > >                         //cnfe.printStackTrace();
> > >                         ritorno = "Exception by
> > Programmatic: " + ex.toString();
> > >                 }
> > >                 return ritorno;
> > >         }
> > >
> > >         public String welcomeDeclarative(String name) {
> > >                 String ritorno = "bububub";
> > >                 try {
> > >
> > >                         ritorno =
> > provaSessioBeanCtrl.welcomeName(name);
> > >                 } catch (Exception cnfe) {
> > >                         //cnfe.printStackTrace();
> > >                         ritorno = "Exception by
> > Declarative: " + cnfe.toString();
> > >                 }
> > >                 return ritorno;
> > >         }
> > >
> > > }
> > >
> > > > -----Original Message-----
> > > > From: Chris Hogue [mailto:cshogue@gmail.com]
> > > > Sent: mercoledì 26 luglio 2006 16.23
> > > > To: Beehive Users
> > > > Subject: Re: EJB Control doesn't work on java class
> > > >
> > > > Hi Max,
> > > >
> > > > I'm not sure you can use @Control instantiation in a regular Java
> > > > class. I don't believe there's anything that triggers the
> > > > instantiation. When you run in a page flow or another
> > control those
> > > > have a "control container" that handles this.
> > > >
> > > > Have you tried programmatic instantiation as described here?
> > > >
> > > > http://beehive.apache.org/docs/1.0.1/controls/programming.html
> > > > #Programmatic+Instantiation
> > > >
> > > >
> > > > -Chris
> > > >
> > > >
> > > > On 7/26/06, Ricci, Massimiliano (HPS C&I, HP-Italy)
> > > > <ma...@hp.com> wrote:
> > > > > Hi folks,
> > > > >
> > > > > I'm trying to use Beehive EJB control in my project.
> > > > > I've done two tests.
> > > > > In the first one I've created a Session EJB
> > > > ("ProvaSessionBean") using
> > > > > IBM Application Server Toolkit (AST), with just one
> > method (String
> > > > > welcomeName (String name)), and imported (the jar file)
> > it on BEA
> > > > > Workshop 9.2.0 for Weblogic Platform. I've created a new
> > > > "Dynamic Web
> > > > > Project" using Beehive facets (Controls & NetUI). By the
> > > > wizard I've
> > > > > created an EJB Control (filling the field "JNDI Name" with
> > > > the value
> > > > > in META-INF\ibm-ejb-jar-bnd.xmi
> > > > ("ejb/ejbs/ProvaSessionBeanHome") and
> > > > > from META-INF\ejb-jar.xml for Home/Business Interface
> > > > > ("ejbs.ProvaSessionBean" and "ejbs.ProvaSessionBeanHome")).
> > > > >
> > > > > In Controller class I've instanced the EJB Control by annotation
> > > > > (@Control) and call the EJB method in the Controller
> > method. I've
> > > > > exported the ear file and deployed it on IBM WebSphere
> > Application
> > > > > Server 6.1 In this case all work correctly.
> > > > >
> > > > > Then I've tried to use the EJB Control in a normal Java class.
> > > > > I've imported the EJB (jar) in my project, and created a
> > > > "Dynamic Web
> > > > > Project" not using Beehive technology (in particular
> > Beehive NetUI).
> > > > > I've imported jar to use EJB Control (beehive-controls.jar,
> > > > > beehive-ejb-control.jar) and created EJB Control
> > > > > (ProvaSessioBeanCtrl.java) following the same step
> > described above.
> > > > > Then I've created a (simple) Java class (Prova.java) to
> > > > instance the
> > > > > control (using annotation @Control) and use EJB method, and
> > > > a jsp page
> > > > > where I called this java class.
> > > > > I've exported the ear file and deployed it on IBM WebSphere
> > > > > Application Server 6.1.
> > > > > When I've tested the application a
> > "java.lang.NullPointerException"
> > > > > was generated because the EJB Control in java class not was
> > > > instanced!
> > > > > I've checked that every class by APT was created (Prova.class,
> > > > > Prova.controls.properties, ProvaClientInitializer.class,
> > > > > ProvaSessioBeanCtrl.class, ProvaSessioBeanCtrlBean.class,
> > > > > ProvaSessioBeanCtrlBean.class.manifest,
> > > > > ProvaSessioBeanCtrlBeanBeanInfo.class) and all seems correct.
> > > > >
> > > > > Have anybody some idea because EJB Control doesn't work on
> > > > java class?
> > > > > Is it possibile use Beehive EJB Control (or Beehive Control in
> > > > > general) in a Java class instead in a PageFlow?
> > > > >
> > > > > Thanks in advance,
> > > > > Max
> > > > >
> > > >
> > >
> >
>

RE: EJB Control doesn't work on java class

Posted by "Ricci, Massimiliano (HPS C&I, HP-Italy)" <ma...@hp.com>.
Hi Chris,

_Probably_ the problem is that the EJB Control need a "container context" to run. Is it possible to add a "container context" to a simple a Java class to use an EJB Control?

Thanks in advance,
Max

> -----Original Message-----
> From: Chris Hogue [mailto:cshogue@gmail.com] 
> Sent: 27 July 2006 21:20
> To: Beehive Users
> Subject: Re: EJB Control doesn't work on java class
> 
> This actually looks more problematic than it first appears. 
> The EJB control (and others) rely on some of the lifecycle 
> methods like onAcquire and onRelease to get and release their 
> resources.
> 
> So unfortunately I don't know of a quick answer to that 
> problem outside of a control container, it will take some 
> digging. If others have tips on how to accomplish this or 
> where to look that would be helpful.
> 
> -Chris
> 
> On 7/27/06, Ricci, Massimiliano (HPS C&I, HP-Italy) 
> <ma...@hp.com> wrote:
> > Hi Chris,
> >
> > I'm retyped the code using programmatic and declarative 
> mechanism to instance the control.
> >
> > Unfortunately calling the two method (welcomeDeclarative, 
> welcomeProgrammatic) I'm getting in both case the same exception:
> >
> > org.apache.beehive.controls.api.ControlException: Control 
> > initialization failure[Contextual service 
> > org.apache.beehive.controls.api.context.ResourceContext is not 
> > available]
> >
> > Do you have any advice to solve this (two) problems 
> (declarative (if is possible) and programmatic)?
> >
> > This is my client class:
> >
> > package controls;
> >
> > import org.apache.beehive.controls.api.bean.Control;
> > import org.apache.beehive.controls.api.bean.Controls;
> > import org.apache.beehive.controls.api.context.ControlThreadContext;
> >
> > public class Prova {
> >
> >         @Control
> >         private ProvaSessioBeanCtrl provaSessioBeanCtrl;
> >
> >         public Prova() throws ClassNotFoundException {
> >
> >                 try {
> >                         Controls.initializeClient(null, this, null);
> >                 } catch (ClassNotFoundException e) {
> >
> >                         e.printStackTrace();
> >                 }
> >         }
> >
> >         public String welcomeProgrammatic(String name) {
> >                 String ritorno = "bubububu";
> >                 try {
> >
> >                         ProvaSessioBeanCtrlBean 
> provaSessioBeanCtrl = (ProvaSessioBeanCtrlBean) Controls
> >                                         
> .instantiate(ProvaSessioBeanCtrlBean.class, null,
> >                                                         
> ControlThreadContext.getContext(),
> >                                                         
> "provaSessioBeanCtrl");
> >                         ritorno = 
> > provaSessioBeanCtrl.welcomeName(name);
> >
> >                 } catch (Exception ex) {
> >                         //cnfe.printStackTrace();
> >                         ritorno = "Exception by 
> Programmatic: " + ex.toString();
> >                 }
> >                 return ritorno;
> >         }
> >
> >         public String welcomeDeclarative(String name) {
> >                 String ritorno = "bububub";
> >                 try {
> >
> >                         ritorno = 
> provaSessioBeanCtrl.welcomeName(name);
> >                 } catch (Exception cnfe) {
> >                         //cnfe.printStackTrace();
> >                         ritorno = "Exception by 
> Declarative: " + cnfe.toString();
> >                 }
> >                 return ritorno;
> >         }
> >
> > }
> >
> > > -----Original Message-----
> > > From: Chris Hogue [mailto:cshogue@gmail.com]
> > > Sent: mercoledì 26 luglio 2006 16.23
> > > To: Beehive Users
> > > Subject: Re: EJB Control doesn't work on java class
> > >
> > > Hi Max,
> > >
> > > I'm not sure you can use @Control instantiation in a regular Java 
> > > class. I don't believe there's anything that triggers the 
> > > instantiation. When you run in a page flow or another 
> control those 
> > > have a "control container" that handles this.
> > >
> > > Have you tried programmatic instantiation as described here?
> > >
> > > http://beehive.apache.org/docs/1.0.1/controls/programming.html
> > > #Programmatic+Instantiation
> > >
> > >
> > > -Chris
> > >
> > >
> > > On 7/26/06, Ricci, Massimiliano (HPS C&I, HP-Italy) 
> > > <ma...@hp.com> wrote:
> > > > Hi folks,
> > > >
> > > > I'm trying to use Beehive EJB control in my project.
> > > > I've done two tests.
> > > > In the first one I've created a Session EJB
> > > ("ProvaSessionBean") using
> > > > IBM Application Server Toolkit (AST), with just one 
> method (String 
> > > > welcomeName (String name)), and imported (the jar file) 
> it on BEA 
> > > > Workshop 9.2.0 for Weblogic Platform. I've created a new
> > > "Dynamic Web
> > > > Project" using Beehive facets (Controls & NetUI). By the
> > > wizard I've
> > > > created an EJB Control (filling the field "JNDI Name" with
> > > the value
> > > > in META-INF\ibm-ejb-jar-bnd.xmi
> > > ("ejb/ejbs/ProvaSessionBeanHome") and
> > > > from META-INF\ejb-jar.xml for Home/Business Interface 
> > > > ("ejbs.ProvaSessionBean" and "ejbs.ProvaSessionBeanHome")).
> > > >
> > > > In Controller class I've instanced the EJB Control by annotation
> > > > (@Control) and call the EJB method in the Controller 
> method. I've 
> > > > exported the ear file and deployed it on IBM WebSphere 
> Application 
> > > > Server 6.1 In this case all work correctly.
> > > >
> > > > Then I've tried to use the EJB Control in a normal Java class.
> > > > I've imported the EJB (jar) in my project, and created a
> > > "Dynamic Web
> > > > Project" not using Beehive technology (in particular 
> Beehive NetUI).
> > > > I've imported jar to use EJB Control (beehive-controls.jar,
> > > > beehive-ejb-control.jar) and created EJB Control
> > > > (ProvaSessioBeanCtrl.java) following the same step 
> described above.
> > > > Then I've created a (simple) Java class (Prova.java) to
> > > instance the
> > > > control (using annotation @Control) and use EJB method, and
> > > a jsp page
> > > > where I called this java class.
> > > > I've exported the ear file and deployed it on IBM WebSphere 
> > > > Application Server 6.1.
> > > > When I've tested the application a 
> "java.lang.NullPointerException"
> > > > was generated because the EJB Control in java class not was
> > > instanced!
> > > > I've checked that every class by APT was created (Prova.class, 
> > > > Prova.controls.properties, ProvaClientInitializer.class, 
> > > > ProvaSessioBeanCtrl.class, ProvaSessioBeanCtrlBean.class, 
> > > > ProvaSessioBeanCtrlBean.class.manifest,
> > > > ProvaSessioBeanCtrlBeanBeanInfo.class) and all seems correct.
> > > >
> > > > Have anybody some idea because EJB Control doesn't work on
> > > java class?
> > > > Is it possibile use Beehive EJB Control (or Beehive Control in
> > > > general) in a Java class instead in a PageFlow?
> > > >
> > > > Thanks in advance,
> > > > Max
> > > >
> > >
> >
> 

Re: EJB Control doesn't work on java class

Posted by Chris Hogue <cs...@gmail.com>.
This actually looks more problematic than it first appears. The EJB
control (and others) rely on some of the lifecycle methods like
onAcquire and onRelease to get and release their resources.

So unfortunately I don't know of a quick answer to that problem
outside of a control container, it will take some digging. If others
have tips on how to accomplish this or where to look that would be
helpful.

-Chris

On 7/27/06, Ricci, Massimiliano (HPS C&I, HP-Italy)
<ma...@hp.com> wrote:
> Hi Chris,
>
> I'm retyped the code using programmatic and declarative mechanism to instance the control.
>
> Unfortunately calling the two method (welcomeDeclarative, welcomeProgrammatic) I'm getting in both case the same exception:
>
> org.apache.beehive.controls.api.ControlException: Control initialization failure[Contextual service org.apache.beehive.controls.api.context.ResourceContext is not available]
>
> Do you have any advice to solve this (two) problems (declarative (if is possible) and programmatic)?
>
> This is my client class:
>
> package controls;
>
> import org.apache.beehive.controls.api.bean.Control;
> import org.apache.beehive.controls.api.bean.Controls;
> import org.apache.beehive.controls.api.context.ControlThreadContext;
>
> public class Prova {
>
>         @Control
>         private ProvaSessioBeanCtrl provaSessioBeanCtrl;
>
>         public Prova() throws ClassNotFoundException {
>
>                 try {
>                         Controls.initializeClient(null, this, null);
>                 } catch (ClassNotFoundException e) {
>
>                         e.printStackTrace();
>                 }
>         }
>
>         public String welcomeProgrammatic(String name) {
>                 String ritorno = "bubububu";
>                 try {
>
>                         ProvaSessioBeanCtrlBean provaSessioBeanCtrl = (ProvaSessioBeanCtrlBean) Controls
>                                         .instantiate(ProvaSessioBeanCtrlBean.class, null,
>                                                         ControlThreadContext.getContext(),
>                                                         "provaSessioBeanCtrl");
>                         ritorno = provaSessioBeanCtrl.welcomeName(name);
>
>                 } catch (Exception ex) {
>                         //cnfe.printStackTrace();
>                         ritorno = "Exception by Programmatic: " + ex.toString();
>                 }
>                 return ritorno;
>         }
>
>         public String welcomeDeclarative(String name) {
>                 String ritorno = "bububub";
>                 try {
>
>                         ritorno = provaSessioBeanCtrl.welcomeName(name);
>                 } catch (Exception cnfe) {
>                         //cnfe.printStackTrace();
>                         ritorno = "Exception by Declarative: " + cnfe.toString();
>                 }
>                 return ritorno;
>         }
>
> }
>
> > -----Original Message-----
> > From: Chris Hogue [mailto:cshogue@gmail.com]
> > Sent: mercoledì 26 luglio 2006 16.23
> > To: Beehive Users
> > Subject: Re: EJB Control doesn't work on java class
> >
> > Hi Max,
> >
> > I'm not sure you can use @Control instantiation in a regular
> > Java class. I don't believe there's anything that triggers
> > the instantiation. When you run in a page flow or another
> > control those have a "control container" that handles this.
> >
> > Have you tried programmatic instantiation as described here?
> >
> > http://beehive.apache.org/docs/1.0.1/controls/programming.html
> > #Programmatic+Instantiation
> >
> >
> > -Chris
> >
> >
> > On 7/26/06, Ricci, Massimiliano (HPS C&I, HP-Italy)
> > <ma...@hp.com> wrote:
> > > Hi folks,
> > >
> > > I'm trying to use Beehive EJB control in my project.
> > > I've done two tests.
> > > In the first one I've created a Session EJB
> > ("ProvaSessionBean") using
> > > IBM Application Server Toolkit (AST), with just one method (String
> > > welcomeName (String name)), and imported (the jar file) it on BEA
> > > Workshop 9.2.0 for Weblogic Platform. I've created a new
> > "Dynamic Web
> > > Project" using Beehive facets (Controls & NetUI). By the
> > wizard I've
> > > created an EJB Control (filling the field "JNDI Name" with
> > the value
> > > in META-INF\ibm-ejb-jar-bnd.xmi
> > ("ejb/ejbs/ProvaSessionBeanHome") and
> > > from META-INF\ejb-jar.xml for Home/Business Interface
> > > ("ejbs.ProvaSessionBean" and "ejbs.ProvaSessionBeanHome")).
> > >
> > > In Controller class I've instanced the EJB Control by annotation
> > > (@Control) and call the EJB method in the Controller method. I've
> > > exported the ear file and deployed it on IBM WebSphere Application
> > > Server 6.1 In this case all work correctly.
> > >
> > > Then I've tried to use the EJB Control in a normal Java class.
> > > I've imported the EJB (jar) in my project, and created a
> > "Dynamic Web
> > > Project" not using Beehive technology (in particular Beehive NetUI).
> > > I've imported jar to use EJB Control (beehive-controls.jar,
> > > beehive-ejb-control.jar) and created EJB Control
> > > (ProvaSessioBeanCtrl.java) following the same step described above.
> > > Then I've created a (simple) Java class (Prova.java) to
> > instance the
> > > control (using annotation @Control) and use EJB method, and
> > a jsp page
> > > where I called this java class.
> > > I've exported the ear file and deployed it on IBM WebSphere
> > > Application Server 6.1.
> > > When I've tested the application a "java.lang.NullPointerException"
> > > was generated because the EJB Control in java class not was
> > instanced!
> > > I've checked that every class by APT was created (Prova.class,
> > > Prova.controls.properties, ProvaClientInitializer.class,
> > > ProvaSessioBeanCtrl.class, ProvaSessioBeanCtrlBean.class,
> > > ProvaSessioBeanCtrlBean.class.manifest,
> > > ProvaSessioBeanCtrlBeanBeanInfo.class) and all seems correct.
> > >
> > > Have anybody some idea because EJB Control doesn't work on
> > java class?
> > > Is it possibile use Beehive EJB Control (or Beehive Control in
> > > general) in a Java class instead in a PageFlow?
> > >
> > > Thanks in advance,
> > > Max
> > >
> >
>

RE: EJB Control doesn't work on java class

Posted by "Ricci, Massimiliano (HPS C&I, HP-Italy)" <ma...@hp.com>.
Hi Chris,

In this pdf "dev2dev.bea.com/2005/09/excerpt_apache_controls.pdf" I've read:
"
Understanding the Resource Client
The resource client is the code that calls this resource. This needs to be in the same VM as
the resource and is typically a Web Service, another Control, a Page Flow, or just some other
Java object.
"
So I think should be possibile instantiate a (EJB) Control in a java class.

I've already tried to use programmatic model for instantiation with the same results!
Thanks a lot for you suggest,
Max

> -----Original Message-----
> From: Chris Hogue [mailto:cshogue@gmail.com] 
> Sent: mercoledì 26 luglio 2006 16.23
> To: Beehive Users
> Subject: Re: EJB Control doesn't work on java class
> 
> Hi Max,
> 
> I'm not sure you can use @Control instantiation in a regular 
> Java class. I don't believe there's anything that triggers 
> the instantiation. When you run in a page flow or another 
> control those have a "control container" that handles this.
> 
> Have you tried programmatic instantiation as described here?
> 
> http://beehive.apache.org/docs/1.0.1/controls/programming.html
> #Programmatic+Instantiation
> 
> 
> -Chris
> 
> 
> On 7/26/06, Ricci, Massimiliano (HPS C&I, HP-Italy) 
> <ma...@hp.com> wrote:
> > Hi folks,
> >
> > I'm trying to use Beehive EJB control in my project.
> > I've done two tests.
> > In the first one I've created a Session EJB 
> ("ProvaSessionBean") using 
> > IBM Application Server Toolkit (AST), with just one method (String 
> > welcomeName (String name)), and imported (the jar file) it on BEA 
> > Workshop 9.2.0 for Weblogic Platform. I've created a new 
> "Dynamic Web 
> > Project" using Beehive facets (Controls & NetUI). By the 
> wizard I've 
> > created an EJB Control (filling the field "JNDI Name" with 
> the value 
> > in META-INF\ibm-ejb-jar-bnd.xmi 
> ("ejb/ejbs/ProvaSessionBeanHome") and 
> > from META-INF\ejb-jar.xml for Home/Business Interface 
> > ("ejbs.ProvaSessionBean" and "ejbs.ProvaSessionBeanHome")).
> >
> > In Controller class I've instanced the EJB Control by annotation
> > (@Control) and call the EJB method in the Controller method. I've 
> > exported the ear file and deployed it on IBM WebSphere Application 
> > Server 6.1 In this case all work correctly.
> >
> > Then I've tried to use the EJB Control in a normal Java class.
> > I've imported the EJB (jar) in my project, and created a 
> "Dynamic Web 
> > Project" not using Beehive technology (in particular Beehive NetUI).
> > I've imported jar to use EJB Control (beehive-controls.jar,
> > beehive-ejb-control.jar) and created EJB Control
> > (ProvaSessioBeanCtrl.java) following the same step described above. 
> > Then I've created a (simple) Java class (Prova.java) to 
> instance the 
> > control (using annotation @Control) and use EJB method, and 
> a jsp page 
> > where I called this java class.
> > I've exported the ear file and deployed it on IBM WebSphere 
> > Application Server 6.1.
> > When I've tested the application a "java.lang.NullPointerException" 
> > was generated because the EJB Control in java class not was 
> instanced!
> > I've checked that every class by APT was created (Prova.class, 
> > Prova.controls.properties, ProvaClientInitializer.class, 
> > ProvaSessioBeanCtrl.class, ProvaSessioBeanCtrlBean.class, 
> > ProvaSessioBeanCtrlBean.class.manifest,
> > ProvaSessioBeanCtrlBeanBeanInfo.class) and all seems correct.
> >
> > Have anybody some idea because EJB Control doesn't work on 
> java class?
> > Is it possibile use Beehive EJB Control (or Beehive Control in 
> > general) in a Java class instead in a PageFlow?
> >
> > Thanks in advance,
> > Max
> >
> 

RE: EJB Control doesn't work on java class

Posted by "Ricci, Massimiliano (HPS C&I, HP-Italy)" <ma...@hp.com>.
Hi Chris,

I'm retyped the code using programmatic and declarative mechanism to instance the control.

Unfortunately calling the two method (welcomeDeclarative, welcomeProgrammatic) I'm getting in both case the same exception:

org.apache.beehive.controls.api.ControlException: Control initialization failure[Contextual service org.apache.beehive.controls.api.context.ResourceContext is not available]

Do you have any advice to solve this (two) problems (declarative (if is possible) and programmatic)?

This is my client class:

package controls;

import org.apache.beehive.controls.api.bean.Control;
import org.apache.beehive.controls.api.bean.Controls;
import org.apache.beehive.controls.api.context.ControlThreadContext;

public class Prova {

	@Control
	private ProvaSessioBeanCtrl provaSessioBeanCtrl;

	public Prova() throws ClassNotFoundException {

		try {
			Controls.initializeClient(null, this, null);
		} catch (ClassNotFoundException e) {

			e.printStackTrace();
		}
	}

	public String welcomeProgrammatic(String name) {
		String ritorno = "bubububu";
		try {

			ProvaSessioBeanCtrlBean provaSessioBeanCtrl = (ProvaSessioBeanCtrlBean) Controls
					.instantiate(ProvaSessioBeanCtrlBean.class, null,
							ControlThreadContext.getContext(),
							"provaSessioBeanCtrl");
			ritorno = provaSessioBeanCtrl.welcomeName(name);

		} catch (Exception ex) {
			//cnfe.printStackTrace();
			ritorno = "Exception by Programmatic: " + ex.toString();
		}
		return ritorno;
	}

	public String welcomeDeclarative(String name) {
		String ritorno = "bububub";
		try {
			
			ritorno = provaSessioBeanCtrl.welcomeName(name);
		} catch (Exception cnfe) {
			//cnfe.printStackTrace();
			ritorno = "Exception by Declarative: " + cnfe.toString();
		}
		return ritorno;
	}

}

> -----Original Message-----
> From: Chris Hogue [mailto:cshogue@gmail.com] 
> Sent: mercoledì 26 luglio 2006 16.23
> To: Beehive Users
> Subject: Re: EJB Control doesn't work on java class
> 
> Hi Max,
> 
> I'm not sure you can use @Control instantiation in a regular 
> Java class. I don't believe there's anything that triggers 
> the instantiation. When you run in a page flow or another 
> control those have a "control container" that handles this.
> 
> Have you tried programmatic instantiation as described here?
> 
> http://beehive.apache.org/docs/1.0.1/controls/programming.html
> #Programmatic+Instantiation
> 
> 
> -Chris
> 
> 
> On 7/26/06, Ricci, Massimiliano (HPS C&I, HP-Italy) 
> <ma...@hp.com> wrote:
> > Hi folks,
> >
> > I'm trying to use Beehive EJB control in my project.
> > I've done two tests.
> > In the first one I've created a Session EJB 
> ("ProvaSessionBean") using 
> > IBM Application Server Toolkit (AST), with just one method (String 
> > welcomeName (String name)), and imported (the jar file) it on BEA 
> > Workshop 9.2.0 for Weblogic Platform. I've created a new 
> "Dynamic Web 
> > Project" using Beehive facets (Controls & NetUI). By the 
> wizard I've 
> > created an EJB Control (filling the field "JNDI Name" with 
> the value 
> > in META-INF\ibm-ejb-jar-bnd.xmi 
> ("ejb/ejbs/ProvaSessionBeanHome") and 
> > from META-INF\ejb-jar.xml for Home/Business Interface 
> > ("ejbs.ProvaSessionBean" and "ejbs.ProvaSessionBeanHome")).
> >
> > In Controller class I've instanced the EJB Control by annotation
> > (@Control) and call the EJB method in the Controller method. I've 
> > exported the ear file and deployed it on IBM WebSphere Application 
> > Server 6.1 In this case all work correctly.
> >
> > Then I've tried to use the EJB Control in a normal Java class.
> > I've imported the EJB (jar) in my project, and created a 
> "Dynamic Web 
> > Project" not using Beehive technology (in particular Beehive NetUI).
> > I've imported jar to use EJB Control (beehive-controls.jar,
> > beehive-ejb-control.jar) and created EJB Control
> > (ProvaSessioBeanCtrl.java) following the same step described above. 
> > Then I've created a (simple) Java class (Prova.java) to 
> instance the 
> > control (using annotation @Control) and use EJB method, and 
> a jsp page 
> > where I called this java class.
> > I've exported the ear file and deployed it on IBM WebSphere 
> > Application Server 6.1.
> > When I've tested the application a "java.lang.NullPointerException" 
> > was generated because the EJB Control in java class not was 
> instanced!
> > I've checked that every class by APT was created (Prova.class, 
> > Prova.controls.properties, ProvaClientInitializer.class, 
> > ProvaSessioBeanCtrl.class, ProvaSessioBeanCtrlBean.class, 
> > ProvaSessioBeanCtrlBean.class.manifest,
> > ProvaSessioBeanCtrlBeanBeanInfo.class) and all seems correct.
> >
> > Have anybody some idea because EJB Control doesn't work on 
> java class?
> > Is it possibile use Beehive EJB Control (or Beehive Control in 
> > general) in a Java class instead in a PageFlow?
> >
> > Thanks in advance,
> > Max
> >
>