• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

Prolem in EJB

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Am facing some probs while creating a jar file using weblogic5.1.

Here's my entire code
Remote Interface---
===========================================================================
package emp;
import java.rmi.*;
import javax.ejb.*;
public interface empRemote extends EJBObject {
public int getEmpno() throws RemoteException;
public double getSal() throws RemoteException;
public void setSal(double sal) throws RemoteException;
}
============================================================================
Home interface--
===========================================================================
package emp;
import java.rmi.*;
import javax.ejb.*;
import java.util.*;
public interface empHome extends EJBHome {
public empRemote create(int empno) throws RemoteException, CreateException;
public empRemote findByPrimaryKey(empPK primaryKey) throws RemoteException, FinderException;
public Enumeration findBigSal(double sal) throws RemoteException, FinderException;
}
==============================================================================
Bean class
============================================================================
package emp;
import java.rmi.*;
import javax.ejb.*;
public class empBean implements EntityBean {
EntityContext entityContext;
public int empno;
public double sal;
public empPK ejbCreate(int empno) throws CreateException {
this.empno = empno;
return new empPK(empno);
}
public void ejbPostCreate(int empno) throws CreateException {
}
public void ejbRemove() throws RemoveException {
}
public void ejbActivate() {
}
public void ejbPassivate() {
}
public void ejbLoad() {
}
public void ejbStore() {
}
public void setEntityContext(EntityContext entityContext) {
this.entityContext = entityContext;
}
public void unsetEntityContext() {
entityContext = null;
}
public int getEmpno()
{
return empno;
}
public double getSal()
{
return sal;
}
public void setSal(double sal)
{
this.sal = sal;
}

}
============================================================================
PK class
==========================================================================
package emp;
import java.io.*;
public class empPK implements Serializable {
public int empno;
public empPK() {
}
public empPK(int key) {
empno = key;
}
public boolean equals(Object obj) {
if (obj==null | | !(obj instanceof empPK))
return false;
else if (((empPK)obj).empno == empno)
return true;
else
return false;
}
public int hashCode() {
return empno;
}
public String toString()
{
return String.valueOf(empno);
}
}
=============================================================================
So pl tell me where am wrong( this is a CMP bean)
Waiting for your reply



[This message has been edited by Mary, Cole (edited March 07, 2001).]
 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
It's better if u say the error u getting.. but still u can check the following things..
#. U haven't declared any business methods, which can be accessed by clients, in the remote interface..
like getEmpno() getSal() setSal(double sal)..
# The ejbCreate method shud return null..
HTH
Saran
 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi saran,
Am sorry that I haven't included the business methods in my remote interface.
Am getting this error in weblogic deployer tool on the messages tab
================================================================
Compiler failed executable.exec([Ljava.lang.String;[D:/JBuilder4/jdk1.3/bin/javac.exe, -classpath, F:\jdk1.3\jre\lib\rt.jar;F:\jdk1.3\jre\lib\i18n.jar;F:\jdk1.3\jre\lib\sunrsasign.jar;F:\jdk1.3\jre\classes;G:/weblogic/classes;G:/weblogic/license;G:/weblogic/lib/weblogicaux.jar;G :/weblogic/myserver/serverclasses;;G:\weblogic\emp\emp.jar;G:\weblogic\lib\persistence\WebLogic_RDBMS.jar;E:\WINNT\Profiles\Administrator\.ejbdeployer\deployer-projects\Emp\ejb-jar ;;E:\WINNT\Profiles\Administrator\.ejbdeployer\deployer-projects\emp\ejb-jar;;E:\WINNT\Profiles\Administrator\.ejbdeployer\deployer-projects\emp\ejb-jar, -d, E:\WINNT\Profiles\Administrator\.ejbdeployer\deployer-projects\emp\ejb-jar, E:\WINNT\Profiles\Administrator\.ejbdeployer\deployer-projects\emp\ejb-jar\emp\empBeanHomeImpl.java, E:\WINNT\Profiles\Administrator\.ejbdeployer\deployer-projects\emp\ejb-jar\emp\empBeanEOImpl.java, E:\WINNT\Profiles\Administrator\.ejbdeployer\deployer-projects\emp\ejb-jar\emp\empPS.java])
===============================================================
and in the other tab( console tab) of the deployer tool, it says
==============================================================
E:\WINNT\Profiles\Administrator\.ejbdeployer\deployer-projects\emp\ejb-jar\emp\empBeanEOImpl.java:56: incompatible types
found : int
required: emp.empPK
pk = bean.empno;
^
1 error
===============================================================
I tried it by returning null in the ejbCreate method of the bean, but got the same error.
Pl tell me where am going wrong.
 
Saran Vel
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
In u'r ejb-jar.xml remove the <primkey-field> declaration..and
have only <prim-key-class> delaration.
Hope this Helps..
Saran
 
Saran Vel
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oops.. where the xml tags have gone..!!!???
Ok.. remove the primkey-field definition from ejb-jar.xml
have only the prim-key-class definition..
Hope now i got it right..!!
Saran
 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Saran,

Thanx for your advice.I got it.
 
Opportunity is missed by most people because it is dressed in overalls and looks like work - Edison. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic