Hi everyone.
I hope someone can point me in the right direction.
I have a Swing application that invokes an EJB and retrieves information back. This works fine in development mode.
I just want to able to deploy my Swing application now without hardcoding the name of the JNDI context. I should be able to just invoke my EJB with something like :
try
{
InitialContext ctx = new InitialContext(h);
Object o = ctx.lookup("java:/comp/env/ejb/emp");
EmpHome home = (EmpHome) PortableRemoteObject.narrow(o, EmpHome.class);
Emp remote = home.create();
list = remote.getAllEmployees();
copy = new ArrayList(list);
System.out.println("List EJB = " + list.size());
}
instead of :
try
{
InitialContext ctx = new InitialContext(h);
Object o = ctx.lookup("EmpJNDI");
EmpHome home = (EmpHome) PortableRemoteObject.narrow(o, EmpHome.class);
Emp remote = home.create();
list = remote.getAllEmployees();
copy = new ArrayList(list);
System.out.println("List EJB = " + list.size());
}
I read that I need to create an application-client.xml file and I came up with :
<application-client>
<display-name>SwingModule</display-name>
<ejb-ref>
<description>Reference to employee bean from a SWING application</description>
<ejb-ref-name>ejb/employeeBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>employee.EmpHome</home>
<remote>employee.Emp</remote>
<ejb-link>EJBModuleEmp.jar#Emp</ejb-link>
</ejb-ref>
<callback-handler>ui.Driver</callback-handler>
</application-client>
But I am lost on how to compile and run a Swing application that references an EJB. Please can some1 illustrate or point me to the right location how I can accomplish this.
P.s, I am not using any IDE's and would prefer any answers to take this into consideration.
Thanks alot
Priya
I hope someone can point me in the right direction.
I have a Swing application that invokes an EJB and retrieves information back. This works fine in development mode.
I just want to able to deploy my Swing application now without hardcoding the name of the JNDI context. I should be able to just invoke my EJB with something like :
try
{
InitialContext ctx = new InitialContext(h);
Object o = ctx.lookup("java:/comp/env/ejb/emp");
EmpHome home = (EmpHome) PortableRemoteObject.narrow(o, EmpHome.class);
Emp remote = home.create();
list = remote.getAllEmployees();
copy = new ArrayList(list);
System.out.println("List EJB = " + list.size());
}
instead of :
try
{
InitialContext ctx = new InitialContext(h);
Object o = ctx.lookup("EmpJNDI");
EmpHome home = (EmpHome) PortableRemoteObject.narrow(o, EmpHome.class);
Emp remote = home.create();
list = remote.getAllEmployees();
copy = new ArrayList(list);
System.out.println("List EJB = " + list.size());
}
I read that I need to create an application-client.xml file and I came up with :
<application-client>
<display-name>SwingModule</display-name>
<ejb-ref>
<description>Reference to employee bean from a SWING application</description>
<ejb-ref-name>ejb/employeeBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>employee.EmpHome</home>
<remote>employee.Emp</remote>
<ejb-link>EJBModuleEmp.jar#Emp</ejb-link>
</ejb-ref>
<callback-handler>ui.Driver</callback-handler>
</application-client>
But I am lost on how to compile and run a Swing application that references an EJB. Please can some1 illustrate or point me to the right location how I can accomplish this.
P.s, I am not using any IDE's and would prefer any answers to take this into consideration.
Thanks alot
Priya