• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to test cmp entity bean in jbuilder6+bes5?

 
Ranch Hand
Posts: 416
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello
i generate a cmp ejb automatically by using jb6,it map to the jobs table of
pubs database within the mssqlserver2000,as follow:

local interface: Jobs.class
localhome interface: JobsHome.class
remote interface: JobsRemote.class
remotehome interface: JobsRemoteHome.class
implementation class: JobsBean.class

after that,i create a test program by using the "test client wizard" in
jb6,as follow:

package jobentity;
import com.mansion.ejb.entity.*;
import javax.naming.*;
import javax.rmi.PortableRemoteObject;
public class JobsTestClient1 {
private JobsRemoteHome jobsRemoteHome = null;

public JobsTestClient1() {
try {
Context ctx = new InitialContext();
Object ref = ctx.lookup("JobsRemote");
jobsRemoteHome = (JobsRemoteHome) PortableRemoteObject.narrow
(ref,JobsRemoteHome.class);
}
catch(Exception e) {
e.printStackTrace();
}
}
public JobsRemoteHome getHome() {
return jobsRemoteHome;
}
public static void main(String[] args) {
JobsTestClient1 client = new JobsTestClient1();
try{
JobsRemote jobsRemote=client.getHome().findByPrimaryKey(new
Integer(1));
}catch(Exception e){
System.out.println(e.getMessage());
}
}
}

when i run the test program,it tell me "Must call within a valid transaction
context",as follow:

java.lang.IllegalStateException: Must call within a valid transaction
context
at
com.inprise.visitransact.jta.TransactionMapImpl.getTxKey(TransactionMapImpl.
java:15)
at
com.inprise.visitransact.jta.TransactionMapImpl.get(TransactionMapImpl.java:
23)
at com.inprise.ejb.Global$1.getTxContext(Global.java:544)
at com.borland.ejb.pm.DataEntityManager.c(Unknown Source)
at com.borland.ejb.pm.JdbcEntityManager.e(Unknown Source)
at com.borland.ejb.pm.DataEntityManager.d(Unknown Source)
at com.borland.ejb.pm.DataEntityManager.createTrustedPrimaryKey(Unknown
Source)
at
com.inprise.ejb.deployment.CMP2EntityDescriptor.convertToTrustedPK(CMP2Entit
yDescriptor.java:80)
at com.inprise.ejb.EntityHome.find(EntityHome.java:174)
at com.inprise.ejb.EJBHome.invoke(EJBHome.java:279)
at com.inprise.ejb.EJBHome.access$400(EJBHome.java:6)
at com.inprise.ejb.EJBHome$RemoteStrategyImpl.invoke(EJBHome.java:665)
at
com.mansion.ejb.entity.JobsRemoteHomePOAInvokeHandler.findByPrimaryKey(JobsR
emoteHomePOAInvokeHandler.java:36)
at
com.mansion.ejb.entity.JobsRemoteHomePOAInvokeHandler.findByPrimaryKey(JobsR
emoteHomePOAInvokeHandler.java:88)
at
com.mansion.ejb.entity.JobsRemoteHomePOA._invoke(JobsRemoteHomePOA.java:63)
at
com.mansion.ejb.entity.JobsRemoteHomePOA._invoke(JobsRemoteHomePOA.java:43)
at com.inprise.vbroker.poa.POAImpl.invoke(POAImpl.java:2597)
at
com.inprise.vbroker.poa.ActivationRecord.invoke(ActivationRecord.java:105)
at
com.inprise.vbroker.poa.ServerInterceptorManager$ARWrapper.invoke(ServerInte
rceptorManager.java:95)
at
com.inprise.vbroker.GIOP.GiopProtocolAdapter.doRequest(GiopProtocolAdapter.j
ava:621)
at
com.inprise.vbroker.IIOP.ServerProtocolAdapter.doRequest(ServerProtocolAdapt
er.java:68)
at
com.inprise.vbroker.GIOP.GiopProtocolAdapter.dispatchMessage(GiopProtocolAda
pter.java:833)
at
com.inprise.vbroker.orb.TPDispatcherImpl$TPDispatcher.run(TPDispatcherImpl.j
ava:99)
at com.inprise.vbroker.orb.ThreadPool$PoolWorker.run(ThreadPool.java:76)


who can tell me how i can solve the problem?
thank you!
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
check ur transaction attribute . if that is mandatory ... replace that with required.....
i think .... i am not sure.
 
reply
    Bookmark Topic Watch Topic
  • New Topic