SessionSynchronization methods in Stateless Bean with BMP
Hi,
Why cant we use SessionSynchronization methods in Stateless Bean with BMP?
Just cos the bean has full control over the transactions and it doesnt make sense at all or there is something more to add to this.
Thanks in advance,
Seetesh
Hi,
Why cant we use SessionSynchronization methods in
Stateless Bean with BMP?Stateless Session Bean does not miantain the state across the method call.And the Transaction control is lying within the method call.
Just cos the bean has full control over the
transactions and it doesnt make sense at all or there
is something more to add to this.I dont understand what you are trying to say here.As stateful session bean maintains the state across the method calls and maintains the conversational state which lies is as cache.The Transaction can be aborted either by making the changes to old value and throwing the Exception to client indicating regarding the failure.But this will be great lost of work hence you make(find mechanism) a recovery from the old values which should be saved.
It is for this the specification has come up with SessionSynchronization interface (useful for only Stateful) Session Bean and with (declarative Transaction) CMT.
Regards
Vicky
Similar Messages
-
EjbHome method vs stateless bean method
Does the ejbHome<method> and stateless bean method share the same concept?
Hi,
Basically the ejbHome<Method> will be the call onto the home object and it inturn uses the bean to make a call where as the stateless session bean method will be a call onto the ejb object.
So in the client code making a call you just make a looup and call the ejbHome<method> whereas in case of stateless session bean , you need to make a lookup and create and then use the object.
Hope this helps...
Bhgaya -
i have a very simple stateless bean with a single "hello" method running in WL 8.1 sp3. to test out Weblogic's behavior, i ran 2 seaparate scenarios on 2 separate occasions. in the first one, i secured all bean methods. in the 2nd one, i secured only the home's "create" mthod, while explicitely denoting all remote methods as "unchecked". next, i wrote a standalone client class where the aforemention bean's EJBHome.create() is called from within a PrivilegedAction-inherited class, while hello() method is called straight up without the use of PrivilegedAction. moreover, the hello() method also prints out the SessionContext.getCallerPrincipal().getName(). finally, an UNsecured servlet utilizing that class was deployed in Tomcat5 and another instance of Weblogic. this is where is gets interesting. when executing the standalone class or the Tomcat's servlet in both scenarios, the results are the same: both create() and hello() get called without a problem, while the latter method prints out correct principal name. however, Weblogic hosting the unsecured servlet behaves differently (and undesirably). in the first scenario where all methods are secured, create() is allowed to be executed, but calling hello() results in an insufficient privileges error. in the 2nd scenario, where only create() method is secured, Weblogic allows hello() to be called without a problem. however, the principal that it returns is "anonymous". my question is how is it possible for not only Tomcat, but even a standalone class to call a secured method without the use of PrivilegedAction and get back a correct principal? yet when absolutely identical code is called from another Weblogic instance, i cannot even obtain a correct principal despite the use of PrivilegedAction!!!
thanks!Hi "werwer" (or is that "wer" :-),
I haven't checked the forum archives, so I may have already mentioned
this to you (or I may have already mentioned it to someone else
on this forum), but there are many resources available on the
Internet that can answer nearly all your J2EE related questions!
I would like to mention two. (If you already know about them, then
I suggest you study them. If you have already studied them and
still don't know the difference between a stateful and a stateless
session bean, then perhaps you can be a bit more specific about
what, in particular, you are having difficulty with.)
1. "Mastering Enterprise JavaBeans" by Ed Roman
A book that you can download as a PDF file.
http://www.theserverside.com/books/masteringEJB/index.jsp
(Also look for the companion book -- at the same URL -- "EJB
Design Patterns")
Note that you need to become a "member" in order to download
these books -- but registration is free.
2. "Enterprise Java Beans, 3rd Edition" by Richard Monson-Haefel
This is an online book -- that you cannot download!
http://safari.informit.com/main.asp?bookname=entjbeans3
Note that "Safari" (at "InformIT") are offering a free, two-week
trial subscription.
Hope this helps you.
Good Luck,
Avi. -
Keeping alive an instance of a Stateless Bean
Hello Weblogic comunity:
I'm deploying a stateless bean with initial-beans-in-free-pool element in '1' (Weblogic 7.0). According with the EJB spec, at some moment of EJB lifecicle ejbRemove() will be called by the container removing the instance :(
Is there a way to keep 1+ instances always alive?Hans,
"Hans Nemarich" <[email protected]> wrote in message news:19065530.1096384306132.JavaMail.root@jserv5...
Hello Weblogic comunity:
I'm deploying a stateless bean with initial-beans-in-free-pool element in '1' (Weblogic 7.0). According with the EJB spec, at somemoment of EJB lifecicle ejbRemove() will be called by the container removing the instance :(
>
Is there a way to keep 1+ instances always alive?Please check this:
http://www.viewtier.com/newsgroups/thread.jspa?threadID=23&tstart=0
Regards,
Slava Imeshev -
Can Entity Bean with Home Business Method replace Stateless Session Bean?
Since Entity Bean can have business methods in the Home Interface, can we use Entity Bean with Home Business Methods to replace Stateless Session Bean?
I am assuming we can get better performance by doing this since the overhead of creating Component Object can be avoided as compared to stateless session beans.Requires-new makes the container start a new transaction. Only use that flag
at the point that you are certain that a NEW transaction should BEGIN. I
suggest you use Required as your default for all methods in the application,
and only change that to anything else when you are certain that you should.
Peace,
Cameron Purdy
Tangosol Inc.
<< Tangosol Server: How Weblogic applications are customized >>
<< Download now from http://www.tangosol.com/download.jsp >>
"A.J,LEE" <[email protected]> wrote in message
news:3ba5adb2$[email protected]..
>
> I find it result in "dead lock"
> when I call RequiresNew attributed CMP method in session Bean.
> Then, Is it possible to use CMP which is set with "RequiresNew"
transaction attribute?
>
> I Wonder why.
>
> Thanx in advance.
-
CacheFullException with Stateless bean
Hallo everbody,
I have a problem with a Stateless bean the log file give me this error:
javax.ejb.EJBException: Exception during transition from pooled to ready:
- with nested exception:
[weblogic.ejb20.cache.CacheFullException: Cache is at its limit of: '100' *active*
beans.]
I use this bean for several action, and just for an action I have this error.
What I can't underastand that Stateless bean get with the session and as the user
close the session the Bean have to expire, isn'it? So can't uderstand while 100
Bean still on the cache.
Could anyone help me?
Thank's a lot
Fausta1. check thread dump ... any threads actually still busy?
2. is it stateful or is it stateless? I don't mean how do you deploy it, but
I mean which is it really? does it have any state?
3. always call remove() ... this isn't the problem (Weblogic doesn't require
remove()) but you should do so anyway.
Peace,
Cameron Purdy
Tangosol, Inc.
Clustering Weblogic? You're either using Coherence, or you should be!
Download a Tangosol Coherence eval today at http://www.tangosol.com/
"Sachin Shah" <[email protected]> wrote in message
news:[email protected]..
>
Hi,
I have a statelesss session bean which i m using in the application.Initially
this bean was stateful bean but due to problems of timeout it was changedto stateless
bean. The problem is sometimes when i view the statistics from console, ifind
that there are max 20 beans allowed and all 20 are in use. Because ofwhich no
user can work further and i have to shutdown the server. I fail tounderstand
this cause being a stateless session bean it should be released (returnedto free
pool) as soon as the method is over. So why this behaviour. Any idea.
Thanks in Advance -
Custom finders in CMP dealing with BMP Beans as parameters
Hi all,
I need to create a custome finder method in a CMP Bean which has a parameter of type EJBLocalHome which is a BMP bean that has been already built. The problem is, I can't understand how to write the EJB-QL part of the finder. I will give some examples of my situation :
CMP Finder definition :
findByCustomer(CustomerLocal customer);
The CMP bean which I want the finder to be implemented has a CMP field for the Customer's primary key which is of type Integer. But, I need to pass a CustomerLocal object to the finder. How can I write a EJB-QL to this situation ?
Is there any known patterns for CMP-BMP relationships...?
Thanks.
Indy.Hi,
Your first point is, I think, is out of the question because, if you call a business method, then the bean will be loaded. That will lose the sole purpose of finders.
Second Point : There may be situations or projects that have to deal with CMP as well as BMP Beans together in a single project for reasons like the BMP beans coming from an already existing development. So, I can't really agree on your point saying that our design is questionable. We had to do it because, we had no other alternatives like changing all the BMP's into CMP's..
So, still my question seems to be unanswered....!!!!!!
Thanks anyway,
Indy. -
Performance of Session Stateless Bean in WebSphere with connection to DB
Im using WebSphere Advanced Single Server Edition Version 4.0.1. and a WebSphere DataSource to get my connections to Microsoft SQL 2000 (using netdirect's JSQLDriver).
For the EJB I set the transaction to 'requieresNew'.
For testing purposes I had been testing some code I'll be using in a Session Stateless Bean inside a servlet's method. In my servlet I use one single connection and preparedStatements to improve performance.
When I test it on the Servlet, this process takes around 3 minutes to complete, but when I put this code inside a Session Stateless Bean and call it from this servlet's method, it takes around 30 minutes to complete!. How is this possible?!
Worst of all, when the EJB ends and the process returns to the Servlet, it throws me this exception.
com.ibm.websphere.ce.cm.StaleConnectionException: class com.ibm.ejs.cm.proxy.PreparedStatementProxy is closed.
The code uses some utilities from a Framework we created, but I really doubt it affects the performance since I put such classes in a jar file and the EJB is accessing such classes correctly.
I thought that maybe I was missing something related with how I get the connection inside the EJB, but I had no luck trying to figure this out.
This is the code in my EJB, commented code was in use when this code was tested in the method of the servlet (some code has been removed or modified, so I just left the 'main' body of the code):
package cmx.ejb;
import cmx.common.*;
import java.util.*;
import qsi.sys.db.*;
import qsi.sys.util.*;
import java.rmi.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.*;
import javax.ejb.*;
import javax.naming.*;
import javax.rmi.*;
import javax.sql.DataSource;
* Bean implementation class for Enterprise Bean: SimuladorEJB
public class SimuladorEJBBean implements javax.ejb.SessionBean {
private javax.ejb.SessionContext mySessionCtx;
private Context ctx;
private DataSource ds;
private static final int TCONSUMO = 4;
private static final int CARACEQ = 6;
private static final int PPRODUC = 9;
private static final int PPUNTA = 12;
private static final int UTONHR = 8;
private static final int TPRODUCC = 3;
private Vector val = null;
private Vector vecArea = null;
private String query;
private Object[] params;
private int numAreas;
private int vSecDetHE;
//All the prepared statements I'll use in my process
private PreparedStatement pstmSelectSerial = null;
private PreparedStatement pstmUpdateSerial = null;
private PreparedStatement pstmgetPPEquipos = null;
private PreparedStatement pstmgetTransfers = null;
private PreparedStatement pstmaddRProduccion = null;
private PreparedStatement pstmupdInventario = null;
private PreparedStatement pstmgetServicios = null;
private PreparedStatement pstmaddConsumo = null;
private PreparedStatement pstmgetAreaEquipos = null;
private PreparedStatement pstmfindCE = null;
private PreparedStatement pstmcontEventoLogEq = null;
private PreparedStatement pstmaddLog = null;
private PreparedStatement pstmfindCaract = null;
private PreparedStatement pstmfindComposicion = null;
private PreparedStatement pstmfindCombAlt = null;
private PreparedStatement pstmaddInventarioH = null;
private PreparedStatement pstmgetAlmMatREM = null;
private PreparedStatement pstmfindAlmacen = null;
private PreparedStatement pstmcontEventoLogAlm = null;
private PreparedStatement pstmgetAlmacenes = null;
private PreparedStatement pstmfindInvHora = null;
private PreparedStatement pstmgetPeriodoHorario = null;
private PreparedStatement pstmgetProgramaCE = null;
private PreparedStatement pstmgetProgramaPP = null;
private PreparedStatement pstmgetProgramaParo = null;
private PreparedStatement pstmgetPrograma = null;
* getSessionContext
public javax.ejb.SessionContext getSessionContext() {
return mySessionCtx;
* setSessionContext
public void setSessionContext(javax.ejb.SessionContext ctx) {
mySessionCtx = ctx;
* ejbActivate
public void ejbActivate() {
* ejbCreate
public void ejbCreate() throws javax.ejb.CreateException {
System.out.println("ejbCreate()");
try {
Hashtable parms = new Hashtable();
parms.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
ctx = new InitialContext(parms);
ds = (DataSource)ctx.lookup("jdbc/datasource");
}catch (Exception e){
e.printStackTrace();
* ejbPassivate
public void ejbPassivate() {
* ejbRemove
public void ejbRemove() {
System.out.println("ejbRemove()");
pstmSelectSerial = null;
pstmUpdateSerial = null;
pstmgetPPEquipos = null;
pstmgetTransfers = null;
pstmaddRProduccion = null;
pstmupdInventario = null;
pstmgetServicios = null;
pstmaddConsumo = null;
pstmgetAreaEquipos = null;
pstmfindCE = null;
pstmcontEventoLogEq = null;
pstmaddLog = null;
pstmfindCaract = null;
pstmfindComposicion = null;
pstmfindCombAlt = null;
pstmaddInventarioH = null;
pstmgetAlmMatREM = null;
pstmfindAlmacen = null;
pstmcontEventoLogAlm = null;
pstmgetAlmacenes = null;
pstmfindInvHora = null;
pstmgetPeriodoHorario = null;
pstmgetProgramaCE = null;
pstmgetProgramaPP = null;
pstmgetProgramaParo = null;
pstmgetPrograma = null;
public void GenerarSimulacion(int pidSimulacion, String pfini, String pffin, int cveEntidad, int cveUsuario) throws Exception{
System.out.println("GenerarSimulacion()");
System.out.println("***Simulacion " + pidSimulacion + " en proceso...***");
Calendar inicioProceso = Calendar.getInstance();//Tiempo en que empezo el Proceso
Calendar finProceso = null;//Tiempo en que termino el Proceso
Connection cnn = null;
//boolean autoCommit = false;
try{
cnn = ds.getConnection();
autoCommit = cnn.getAutoCommit();
cnn.setAutoCommit(false);
cnn.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
pstmSelectSerial = cnn.prepareStatement("select iValor from CatConsecutivo where vcConsecutivo=?");
pstmUpdateSerial = cnn.prepareStatement("update CatConsecutivo set iValor = iValor+1 where vcConsecutivo=?");
pstmgetPPEquipos = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.getPPEquipos"));
pstmgetTransfers = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.getTransfers"));
pstmaddRProduccion = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.addRProduccion"));
pstmupdInventario = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.updInventario"));
pstmgetServicios = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.getServicios"));
pstmaddConsumo = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.addRConsumo"));
pstmgetAreaEquipos = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.getAreaEquipos"));
pstmfindCE = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.findCE"));
pstmcontEventoLogEq = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.contEventoLogEq"));
pstmaddLog = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.addLog"));
pstmfindCaract = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.findCaract"));
pstmfindComposicion = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.findComposicion"));
pstmfindCombAlt = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.findCombAlt"));
pstmaddInventarioH = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.addInventarioH"));
pstmgetAlmMatREM = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.getAlmMatREM"));
pstmfindAlmacen = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.findAlmacen"));
pstmcontEventoLogAlm = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.contEventoLogAlm"));
pstmgetAlmacenes = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.getAlmacenes"));
pstmfindInvHora = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.findInvHora"));
pstmgetPeriodoHorario = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.getPeriodoHorario"));
pstmgetProgramaCE = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.getProgramaCE"));
pstmgetProgramaPP = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.getProgramaPP"));
pstmgetProgramaParo = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.getProgramaParo"));
pstmgetPrograma = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.getPrograma"));
pstmgetAreaEquipos = cnn.prepareStatement(Manager.getParameter("cmx.admin.inicioSesion.getAreaEquipos"));
Map hmEqMat = null;
Iterator itEqMat = null;
Map.Entry meEqMat = null;
Map hmInvAlm = null;
Iterator itInvAlm = null;
Map.Entry meInvAlm = null;
Map hmPunta = null;
Iterator itPunta = null;
Map.Entry mePunta = null;
Iterator itPuntaEq = null;
HashMap hmPuntaEq = null;
Vector vecPuntaEq = null;
Iterator itPPEq = null;
HashMap hmPPEq = null;
Vector vecPPEq = null;
Iterator itCar = null;
HashMap hmCar = null;
Vector vecCar = null;
Iterator itLog = null;
HashMap hmLog = null;
Vector vecLog = null;
Iterator itCA = null;
HashMap hmCA = null;
Vector vecCA = null;
Iterator itCom = null;
HashMap hmCom = null;
Vector vecCom = null;
Iterator it = null;
HashMap hm = null;
Vector vecEv = null;
Iterator itEq = null;
HashMap hmEq = null;
Vector vecEq = null;
Vector vecSim = null;
Date d;
String sDSim = "";
Date dDiaPrevio;
String sDiaPrevio = "";
String consulta;
int vContador= 0;
int hr=0;
long vDiaPrevio = 0;
Integer idInvH;
Integer idProd;
Integer idCons;
Integer idLog;
int vCont = 0;
int vCiclo = 0;
int vArea = 0;
int vAreaAct = 0;
int vPuntaEquipo = 0;
// Periodo de Simulacion
long fini = getCurrDate(pfini);
long ffin = getCurrDate(pffin);
// Variables Generales
int vSecuencial = 0;
int vEvento = 0;
float vCostoE = 0;
int vAlmacenREM = 0;
// Variables de Transferencia
float vCantidad = 0;
int vTipoMov = 0;
int vUMedida = 0;
int vAlmacenTr = 0;
float vNIni = 0;
float vNMin = 0;
float vNMax = 0;
float vNAct = 0;
// Variables de Equipos
int vPPMaterial = 0;
int vPPEquipo = 0;
int vPPArea = 0;
int vMaterial = 0;
int vCaractEq = 0;
int vParo = 0;
int vEstatusParo = 0;
int vEstatus = 0;
float vMinPunta = 0;
float vPorcPunta = 0;
float vProporcion = 0;
float vTPH = 0;
float vGasto = 0;
float vKwNoProd = 0;
float vKwProd = 0;
int vAlmacen = 0;
// Variables de Composicion de Materiales
int vMaterialCom = 0;
float vPorcCom = 0;
float vFactorCC = 0;
int vTipoMovCom = 0;
int vUMedidaCom = 0;
int vAlmacenCom = 0;
float vNIniCom = 0;
float vNMinCom = 0;
float vNMaxCom = 0;
float vNActCom = 0;
int vMaterialCA = 0;
int vUMedidaCA = 0;
int vAlmacenCA = 0;
float vNIniCA = 0;
float vNMinCA = 0;
float vNMaxCA = 0;
float vNActCA = 0;
int vOk=0;
int h=0;
boolean vbOk=false;
boolean swArea=true;
Calendar dtH1;
vecSim = new Vector();
vecSim.add(new Integer(pidSimulacion));
for (long ld=fini; ld<=ffin; ld=getNextDate(new Date(ld), 1))
{ d = new Date(ld);
//The process which calls find(), upd(), AplicaEvento() and GetCostoEnergia() methods several times.
//The methods find() and upd() uses a util class (DataDB) which basically assigns the params to the PreparedStatement and executes it, returning the results in a Vector.
} // for ld : Dia de Simulacion
//Cerrar la transaccion
}catch (Exception e){
System.out.println("rollback...");
mySessionCtx.setRollbackOnly();
System.out.println("rollback ok!");
System.out.println(e.toString());
throw e;
}finally{
finProceso = Calendar.getInstance();
finProceso.setTime(new java.util.Date(finProceso.getTime().getTime() - inicioProceso.getTime().getTime()));
System.out.println("***Simulacion " + pidSimulacion + " procesada en: " + finProceso.get(Calendar.MINUTE) + ":" + finProceso.get(Calendar.SECOND) + "." + finProceso.get(Calendar.MILLISECOND) + ".***");
try {
if (cnn!=null && !cnn.isClosed()) {
System.out.println("close ok?");
cnn.close();
System.out.println("close ok!");
}catch (SQLException sqle){
sqle.printStackTrace();
System.out.println("commit ok?");
cnn.commit();
System.out.println("commit ok!");
}catch (Exception e){
e.printStackTrace();
System.out.println(e.toString());
try {
if (cnn!=null && !cnn.isClosed()) {
System.out.println("rollback ok?");
cnn.rollback();
System.out.println("rollback ok!");
}catch (SQLException sqle){
sqle.printStackTrace();
}finally{
finProceso = Calendar.getInstance();
finProceso.setTime(new java.util.Date(finProceso.getTime().getTime() - inicioProceso.getTime().getTime()));
System.out.println("Simulacion procesada en: " + finProceso.get(Calendar.MINUTE) + ":" + finProceso.get(Calendar.SECOND) + "." + finProceso.get(Calendar.MILLISECOND) + ".***");
try {
if (cnn!=null && !cnn.isClosed()) {
System.out.println("autocommit ok?");
cnn.setAutoCommit(autoCommit);
System.out.println("autocommit ok!");
System.out.println("close ok?");
cnn.close();
System.out.println("close ok!");
}catch (SQLException sqle){
sqle.printStackTrace();
private float GetCostoEnergia(float pfKw, long plFecha, int piHora,int cveEntidad) throws Exception {
float exito = -1;
//calculations and has access to DB throught method find()
return exito;
private int AplicaEvento(int pidMaterial, int pidEvento, int pidSecuencial, int pidSimulacion, long plFecha, int piHora) throws Exception {
int exito = -1;
//calculations and has access to DB throught method find()
return exito;
private Iterator find(PreparedStatement pstm, Vector values) throws Exception {
params = (values!=null)? values.toArray() : null;
Vector data = DataDB.executeQuery(pstm, params); //This util class is in a external jar file, such util basically assigns the params to the PreparedStatement and executes it, returning the results in a Vector.
return data.iterator();
private int upd(PreparedStatement pstm, Vector values) throws Exception {
params = values.toArray();
return DataDB.executeUpdate(pstm, params); //This util class is in a external jar file, such util basically assigns the params to the PreparedStatement and executes it.
Help will be REALLY appreciated!
Thanks in advance.Thanks Paul for your comments.
In fact, I call my EJB in the servlet just once. Im sure calling the same EJB. My project requieres it to be stateless.
This is my last log
1/2/03 13:15:00:481 CST] 17fac55b SystemOut U -ejbCreate()-
[1/2/03 13:15:00:591 CST] 17fac55b SystemOut U jdbc/xa/oye
[1/2/03 13:15:00:651 CST] 17fac55b SystemOut U -GenerarSimulacion()-
[1/2/03 13:15:00:741 CST] 17fac55b SystemOut U ***Simulacion 32 en proceso...??***
[1/2/03 13:15:01:012 CST] 17fac55b SystemOut U JSQLConnect(2.2721) Trial license - expires on:Tue Jan 07 13:01:32 CST 2003, unlimited connections
[1/2/03 13:15:01:092 CST] 17fac55b SystemOut U Connection OK!
[1/2/03 13:15:01:392 CST] 17fac55b SystemOut U PreparedStatements OK!
[1/2/03 13:15:01:402 CST] 17fac55b SystemOut U Comenzando Sim...
I forgot to mention that I create a connection (autocommit false) at the begining of my servlet, which I use throught all the servlet, then I call the EJB, and after the EJB succeds I also close the transaction in the Servlet (to commit what is on the servlet, not the EJB). Thats why I set the transaction in the EJB to requiresNew, so after the EJB ends it commits its own transaction, Am I right?.
The Exception I get I think its because the connection used in the servlet timed out while waiting for the EJB to finish.
This issue has become urgent, so please if you know why I have this problem reply ASAP.
Thanks! -
BMP-/CMP-Entity Beans with JBoss 3.0 & MySQL 3.23
Hi @all!
Sorry, I`m a beginner in development of EJBs, but I`ve got already two of them (a session bean, a cmp-bean with Hypersonic DB) running.
Now my question:
Is it possible to develop bmp- or cmp-beans with JBuilder 6.0 and AppServer JBoss 3.0 and MySQL as relational database.
If anybody here, has ever done this.
Please contact for one or two short questions like:
What will I have to do to get MySQL as persistence medium in JBoss?
What will I have to do to get MySQL by a bmp-entity-bean over JNDI?
What will I have to do to run my program? ;-)
I�m always getting error messages like:
...no such entity...
Or:
...MyDB not bound...
Thanks
MichaelNow, I`ve done a little step in the right direction:
It is possible to create CMP-Beans with JBoss 3.0 and MySQL database.
You just have to put both on the same machine ;-) (Incredible...)
But now I`ve got problems to implement a bean-managed-persistence Bean with JBoss 3.0 and mySQL.
If I start my client application, I get the following error messages, although my EJB is correctly deployed:
-- I`m calling: create(17, max, [email protected])
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.ServerException: null
Embedded Exception
null; nested exception is:
javax.ejb.EJBException: null
Embedded Exception
null
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)-- Erfolglos: create(17, max, [email protected])
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:250)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:226)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:136)
at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:128)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:108)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:73)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:76)
at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:185)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
at $Proxy0.create(Unknown Source)
at gaestebuch.BMPTestClient.create(BMPTestClient.java:71)
at gaestebuch.BMPTestClient.main(BMPTestClient.java:309)
Caused by: java.rmi.ServerException: null
Embedded Exception
null; nested exception is:
javax.ejb.EJBException: null
Embedded Exception
null
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:119)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:167)
at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:104)
at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:109)
at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
at org.jboss.ejb.Container.invoke(Container.java:726)
at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
Caused by: javax.ejb.EJBException: null
Embedded Exception
null
at org.jboss.ejb.plugins.BMPPersistenceManager.createEntity(BMPPersistenceManager.java:246)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:270)
at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:728)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1116)
at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:257)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:215)
at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:134)
at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:79)
at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:44)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:98)
... 19 more
-- return of create(17, max, [email protected]): null.
What is my mistake?
Thanks, Michael -
CMP Entity Bean with ejb-ql finder methods and INFORMIX database
Hi,
I have some CMP Entity Beans with finder methods defined in ejb-ql. In my ejb-jar, within <entity> definitions I have something like:
<entity>
<abstract-schema-name>BeanName</abstract-schema-name>
<cmp-field><field-name>fieldOne</field-name></cmp-field>
<cmp-field><field-name>fieldTwo</field-name></cmp-field>
<query>
<query-method>
<method-name>findAll</method-name>
<method-params></method-params>
</query-method>
<ejb-ql>SELECT OBJECT(o) FROM BeanName o</ejb-ql>
</query>
<entity>
And in persistent.xml:
<db-properties>
<data-source-name>datasource_name</data-source-name>
</db-properties>
<entity-bean>
<ejb-name>BeanName</ejb-name>
<table-name>table_name</table-name>
<field-map key-type="NoKey">
<field-name>fieldOne</field-name>
<column><column-name>column_one</column-name></column>
</field-map>
<field-map key-type="NoKey">
<field-name>fieldTwo</field-name>
<column><column-name>column_two</column-name></column>
</field-map>
<finder-descriptor>
<method-name>findAll</method-name>
<method-params/>
</finder-descriptor>
Once deployed, on server side, I can found a java source file (with corresponding compiled class file) in path:
j2ee/cluster/server0/apps/companyName/MyEARApp/EJBContainer/temp/temp38837373733/route/to/package/
with names:
BeanName0_0pm.java
BeanName0_0PM.class
and the generated java file contains this code:
public java.util.Enumeration ejbFindAll() throws javax.ejb.FinderException, javax.ejb.EJBException {
TransactionContext tc = pm.getTransactionContext();
Connection conn = null;
PreparedStatement pSt = null;
ResultSet ejb_rs = null;
int status = javax.transaction.xa.XAResource.TMSUCCESS;
try {
conn = pm.getConnectionForFindMethod();
pSt = conn.prepareStatement("SELECT \"O\".\"COLUMN_ONE\",\"O\".\"COLUMN_TWO\", FROM \"TABLE_NAME\" \"O\"");
ejb_rs = pSt.executeQuery();
I'm trying to call this method but it throws a SQLException when preparing the statement.
It seems that Informix does not like this SQL syntax because of upper case names, doble quotes on table alias, or something else.
When editing persistent.xml in netweaver, I can define the element <datasource-vendor> as ORACLE, SAPDB, MS_SQL_SERVER, DB2_UDB_AS400 or DB2_UDB_OS390 but INFORMIX is not an accepted value.
Is there any way to define how this SQL query is build?
Thanks in advance.The return type of the finder method defined in the remote home interface is either the entity bean's remote interface or a collection of objects implementing the entity bean's remote interface. The return type of the finder method defined in the local home interface is either the entity bean's local interface or a collection of objects implementing the entity bean's local interface
-
Can we call a method in stateless session bean ?
Can we call a method in stateless session bean in onMessage method?
Hi,
The purpose of service locator is to abstract the lookup of the server side services like ejb and DSNs. It should be a normal java class but as such there is no such restriction. You can have a look at the service locator patter at the j2ee blue prints.
/Ashwani -
Regarding stateless bean create() method problem
hi every body,
I am Learning EJB now for this i created one StatelessBean with a eho functionality with jsp. it is working good for the first time but when i am trying to run that jsp once again it shows the following error in server console
11:32:13,090 ERROR [LogInterceptor] EJBException in method: public abstract beans.StatelessRemote beans.StatelessHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException:
javax.ejb.EJBException: Invalid invocation, check your deployment packaging, method=public abstract beans.StatelessRemote beans.StatelessHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException
i am using Netbeans and J2EE 1.4 version and using Jboss 4.2.2.GA
please help me in this regard
yours,
-sat-Bean :::::::::::::
package beans;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
public class StatelessBean implements SessionBean {
SessionContext context;
// The public business method. This must be coded in the
// remote interface also.
public String getEchoString(String clientString) {
return (clientString.toUpperCase() + " - from session bean");
// Standard ejb methods
public void ejbActivate() {
System.out.println("ejb activate called");}
public void ejbPassivate() {
System.out.println("ejb passivate called");}
public void ejbRemove() {
System.out.println("ejb remove called");}
public void ejbCreate() {
System.out.println("ejb create called");}
public void setSessionContext(SessionContext context) {
System.out.println("setSessionContext called");
this.context=context;
Home interface::::::::::::::::::::::::::
package beans;
import java.rmi.RemoteException;
import javax.ejb.EJBHome;
import javax.ejb.CreateException;
public interface StatelessHome extends EJBHome {
// The create() method for the SimpleSession bean
public StatelessRemote create()
throws CreateException, RemoteException;
Remote interface::::::::::::
package beans;
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
public interface StatelessRemote extends EJBObject {
// The public business method on the SimpleSession bean
public String getEchoString(String clientString)
throws RemoteException;
client ie.. index.jsp
<%@ page import="java.util.*,java.io.*,java.lang.*" %>
<%@ page import="beans.*,javax.naming.InitialContext,javax.naming.Context,javax.rmi.PortableRemoteObject" %>
<%--
Document : index
Created on : Dec 2, 2008, 11:33:10 AM
Author : sathish.kumar
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
Properties pro=new Properties();
StatelessHome home;
StatelessRemote simpleSession;
String result=new String();
try {
// Get a naming context
pro.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
pro.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
pro.put(Context.PROVIDER_URL,"localhost:1099");
InitialContext JContext = new InitialContext(pro);
System.out.println("context::::::::::::::>"+JContext);
// Get a reference to the SimpleSession JNDI entry
Object ref =JContext.lookup("StatelessBean");
// Get a reference from this to the Bean's Home interface
home = (StatelessHome)PortableRemoteObject.narrow(ref, StatelessHome.class);
// Create a SimpleSession object from the Home interface
simpleSession = home.create();
// Loop through the words
for (int i = 0; i < 10; i++) {
String returnedString = simpleSession.getEchoString("hello"+i+"::>>");
System.out.println("sent string: " +"hello"+i+"::>>" +
", received string: " + returnedString);
result+=returnedString;
} catch(Exception e) {
e.printStackTrace();
%><form name="my" method=post>
<h2>Hello World!<hr><br><%= result%><hr></h2></form>
</body>
</html> -
Can CMT Session Bean call BMP Entity Bean in WebLogic 6.0?
Hi
Does anybody successfully use CMT Session Bean calling BMP +CMT Entity bean in
WebLogic6.0? I have the following problem.
Any idea will be appreciated.
--Winston
Let's say we have a Session bean SB, it uses container to manage the transaction.
A method of SB will call an Entity Bean EB which adopts bean-managed persistence.
Both SB and EB use CMT and all of their methods use "required" in the descriptor
file.
1. If the connection con.getAutoCommit() is true in the EB, then the transaction
within SB cannot be rolled back as the ejbCreate() has already commit into the
database.
2. On the other hand if Connecton of EB con.getAutoCommit() is false, then container
cannot successfully commit the transaction from SB's method, as EjbCreate and
EjbStore() in EB are likely using the different database connections, which causes
EbjStore() fail and the following error message will be sent to the Console:
============================================================
"<Jul 9, 2001 4:16:48 PM PDT> <Error> <EJB> <Exception during commit of transacti
on transaction=(IdHash=7738920,Name = [EJB TraderBeanImpl.buy()],Xid=105:5e6719a
ded42e332,Status=Rolled back. [Reason = weblogic.utils.NestedRuntimeException:
E
rror writing from beforeCompletion - with nested exception:
[java.rmi.NoSuchObjectException: Exception from ejbStore:javax.ejb.NoSuchEntityE
xception: ejbStore: AccountBean (4003) not updated]],numRepliesOwedMe=0,numRepli
esOwedOthers=0,seconds since begin=0,seconds left=30,SCInfo[examplesServer]=(sta
te=rolledback),properties=({weblogic.transaction.name=[EJB TraderBeanImpl.buy()]
})): java.rmi.NoSuchObjectException: Exception from ejbStore:javax.ejb.NoSuchEnt
ityException: ejbStore: AccountBean (4003) not updated
at weblogic.ejb20.internal.EJBRuntimeUtils.throwRemoteException(EJBRunti
meUtils.java:57)
at weblogic.ejb20.manager.DBManager.beforeCompletion(DBManager.java:364)
at weblogic.ejb20.internal.TxManager$TxListener.beforeCompletion(TxManag
er.java:211)
at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(Serv
erSCInfo.java:511)
at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(Se
rverSCInfo.java:78)
at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAn
dChain(ServerTransactionImpl.java:893)
at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(
ServerTransactionImpl.java:1229)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
sactionImpl.java:168)
at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:2
01)
at examples.ejb.basic.statefulSession.TraderBeanEOImpl.buy(TraderBeanEOI
mpl.java:37)
at examples.ejb.basic.statefulSession.TraderBeanEOImpl_WLSkel.invoke(Tra
derBeanEOImpl_WLSkel.java:76)
at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
va:373)
at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
va:237)
at weblogic.rmi.internal.BasicRequestHandler.handleRequest(BasicRequestH
andler.java:118)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
.java:17)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
--------------- nested within: ------------------
weblogic.utils.NestedRuntimeException: Error writing from beforeCompletion - wit
h nested exception:
[java.rmi.NoSuchObjectException: Exception from ejbStore:javax.ejb.NoSuchEntityE
xception: ejbStore: AccountBean (4003) not updated]
at weblogic.ejb20.internal.TxManager$TxListener.beforeCompletion(TxManag
er.java:220)
at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(Serv
erSCInfo.java:511)
at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(Se
rverSCInfo.java:78)
at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAn
dChain(ServerTransactionImpl.java:893)
at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(
ServerTransactionImpl.java:1229)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
sactionImpl.java:168)
at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:2
01)
at examples.ejb.basic.statefulSession.TraderBeanEOImpl.buy(TraderBeanEOI
mpl.java:37)
at examples.ejb.basic.statefulSession.TraderBeanEOImpl_WLSkel.invoke(Tra
derBeanEOImpl_WLSkel.java:76)
at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
va:373)
at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
va:237)
at weblogic.rmi.internal.BasicRequestHandler.handleRequest(BasicRequestH
andler.java:118)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
.java:17)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
--------------- nested within: ------------------
weblogic.transaction.RollbackException: Unexpected exception in beforeCompletion
: sync = weblogic.ejb20.internal.TxManager$TxListener@356eb0
Error writing from beforeCompletion - with nested exception:
[weblogic.utils.NestedRuntimeException: Error writing from beforeCompletion -
wi
th nested exception:
[java.rmi.NoSuchObjectException: Exception from ejbStore:javax.ejb.NoSuchEntityE
xception: ejbStore: AccountBean (4003) not updated]]
at weblogic.transaction.internal.TransactionImpl.throwRollbackException(
TransactionImpl.java:1261)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
sactionImpl.java:218)
at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:2
01)
at examples.ejb.basic.statefulSession.TraderBeanEOImpl.buy(TraderBeanEOI
mpl.java:37)
at examples.ejb.basic.statefulSession.TraderBeanEOImpl_WLSkel.invoke(Tra
derBeanEOImpl_WLSkel.java:76)
at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
va:373)
at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
va:237)
at weblogic.rmi.internal.BasicRequestHandler.handleRequest(BasicRequestH
andler.java:118)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
.java:17)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>"
We did receive a 4.5.1 / 5.1 interoperability patch - but it wasn't quite 'seamless'.
We never tried to use it.
SOAP? Isn't that around 50 times slower than RMI?
Mike
"Gary Mui" <[email protected]> wrote:
We ran into this issue last fall and got some feedback from weblogic
support. They originally said that it could be done (as well as different
versions talking to one another via JMS) but it turned out that they
were
incorrect and ended up saying that it is not possible. Before 6.0 went
GA,
BEA said that there would be a interoperability patch to do this, but
I've
never seen nor heard of anything regarding it. As a workaround, we
implemented 4.5.1 / 6.0 communication via SOAP.
Mike Reiche wrote in message <3b1bcaec$[email protected]>...
I have the same question - and more. Last year we were told that wecould
not use
RMI (and ejbs) between 4.5.1 and 5.1. Which seems kinda weird becauseI've
heard
of people using WL ejbs from Tomcat. This issue has caused us to avoidusing
WL ejbs in any future development which has any chance of ever beingused
by any
app server (WL included) that is not under the direct control of thedata
center.
I've been trying to convince the Architecture team here that we canuse WL
EJBs
and we can call them from other app servers - but can't seem to getany
supporting
statement from BEA (maybe I haven't tried hard enough).
Anyway, a response from BEA would be appreciated.
- Mike
"Madhu K" <[email protected]> wrote:
Is it possible to call a (stateless session) bean deployed in weblogic
6.0
from a bean in weblogic 5.1? I have two versions of weblogic running
on two
different hosts and I have to call a bean that is running in 6.0 from
5.1.
Are there any limitations?
Appreciate any feedback/suggestions.
Thanks,
Madhu -
Entity bean with another class as primary key generator class
Hi All,
I have a CMP entity bean in which I generate the primary key using my own class know as unique id generator.
I use it in ejbCreate method in the following manner
public Long ejbCreate(HospitalData hospitalData) throws CreateException{
Long myid = new Long(UniqueIdGenerator.getId());
System.out.println("My id generated ====== "+myid);
this.hospitalid = myid;
System.out.println("My id generated ====== "+this.hospitalid);
System.out.println("Came in ejbCreate method of HospitalEJB");
this.hospitalname = hospitalData.getHospitalname();
return null;
Can you tell me how I map this primary key in my ejb-jar.xml and jbosscmp-jdbc.xml.
Anyhelp would be appreciated.
Thanks
Sameer"Bhamu" <[email protected]> wrote in message
news:9keuo4$[email protected]..
I am trying to develop an entity bean attached to a key which have a
composite key using Primary Key Class. When I use the findByPrimaryKey
method of the bean it throws an exception as follows,I notice that you are using the reference CMP plugin.
at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)I'm also willing to bet that you may have created your own primary key class
with a single field, rather than using the fields type as a primitive
primary key class. If you do this, then SQLPersistenceManager will break.
It is badly written, and has some stupid assumptions. The one I remember
the most is that if you only have one primary key field, then
SQLPersistenceManager assumes you have used a primitive type such as
java.lang.String or java.lang.Integer, to represent it, rather than creating
your own <Enity>Pk.java file.
SQLPersistenceManager works for toy examples, but in general I would say it
is broken and unusable. Either use BMP, or splash out the money for Coco
Base from Thought Inc. Currently the only CMP plugin for iPlanet App server,
other than the reference implementation, that I know of. -
Entity Bean with Primary Key Class
Hi
I am trying to develop an entity bean attached to a key which have a
composite key using Primary Key Class. When I use the findByPrimaryKey
method of the bean it throws an exception as follows,
java.sql.SQLException: Parameter typecheck failed: invalid parameter type:
ORA-00000: normal, successful completion
at com.netscape.server.jdbc.PreparedStatement.verifyError(Unknown Source)
at com.netscape.server.jdbc.PreparedStatement.afterVerify(Unknown Source)
at com.netscape.server.jdbc.PreparedStatement.executeQuery(Unknown Source)
at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)
at
com.netscape.server.ejb.EntityDelegateManagerImpl.doPersistentFind(Unknown
Source)
at com.netscape.server.ejb.EntityDelegateManagerImpl.find(Unknown Source)
at com.kivasoft.eb.EBHomeBase.findSingleByParms(Unknown Source)
at
TestBean2.ejb_home_TestBean2_EntityBean2Bean.findByPrimaryKey(ejb_home_TestB
ean2_EntityBean2Bean.java:120)
at
TestBean2.ejb_kcp_skel_EntityBean2Home.findByPrimaryKey__TestBean2_EntityBea
n2__TestBean2_TestBKey(ejb_kcp_skel_EntityBean2Home.java:258)
at com.kivasoft.ebfp.FPRequest.invokenative(Native Method)
at com.kivasoft.ebfp.FPRequest.invoke(Unknown Source)
at
TestBean2.ejb_kcp_stub_EntityBean2Home.findByPrimaryKey(ejb_kcp_stub_EntityB
ean2Home.java:341)
at
TestBean2.ejb_stub_EntityBean2Home.findByPrimaryKey(ejb_stub_EntityBean2Home
..java:88)
at TestBean2.Simple1.defaultAction(Simple1.java:115)
at TestBean2.Simple1.doGet(Simple1.java:26)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
Source)
at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown
Source)
at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
at com.kivasoft.thread.ThreadBasic.run(Native Method)
at java.lang.Thread.run(Thread.java:479)
javax.ejb.FinderException
at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)
at
com.netscape.server.ejb.EntityDelegateManagerImpl.doPersistentFind(Unknown
Source)
at com.netscape.server.ejb.EntityDelegateManagerImpl.find(Unknown Source)
at com.kivasoft.eb.EBHomeBase.findSingleByParms(Unknown Source)
at
TestBean2.ejb_home_TestBean2_EntityBean2Bean.findByPrimaryKey(ejb_home_TestB
ean2_EntityBean2Bean.java:120)
at
TestBean2.ejb_kcp_skel_EntityBean2Home.findByPrimaryKey__TestBean2_EntityBea
n2__TestBean2_TestBKey(ejb_kcp_skel_EntityBean2Home.java:258)
at com.kivasoft.ebfp.FPRequest.invokenative(Native Method)
at com.kivasoft.ebfp.FPRequest.invoke(Unknown Source)
at
TestBean2.ejb_kcp_stub_EntityBean2Home.findByPrimaryKey(ejb_kcp_stub_EntityB
ean2Home.java:341)
at
TestBean2.ejb_stub_EntityBean2Home.findByPrimaryKey(ejb_stub_EntityBean2Home
..java:88)
at TestBean2.Simple1.defaultAction(Simple1.java:115)
at TestBean2.Simple1.doGet(Simple1.java:26)
[03/Aug/2001 15:26:41:7] error: Exception: SERVLET-execution_failed: Error
in executing servlet Simat
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServletple1: java.lang.ClassCastException:
com.netscape.server.deployment.EntityBeanDescriptor
Exception .service(HttpServlet.java:865)
at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
Source)
at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown
Source)Stack Trace:
java.lang.ClassCastException:
com.netscape.server.deployment.EntityBeanDescriptor
a
at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
at com.kivasoft.applogic.AppLogic.ext
com.netscape.server.servlet.servletrunner.AppInfo.popWebAppDescriptor(Unknow
n Source)
at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
Source)
at com.netscape.server.seecute(Unknown Source)
at com.kivasoft.thread.ThreadBasic.run(Native Method)
at java.lang.Threadrvlet.servletrunner.ServletRunner.execute(Unknown
Source)
at com.kivasoft.applogic.AppLogic.execu.run(Thread.java:479)
te(Unknown Source)
at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
at com.kivasoft.thread.ThreadBasic.run(Native Method)
at java.lang.Thread.run(Thread.java:479)
Any kind of help is appreciated. I am using iPlanet App Builder 6.0 with iAS
6.0 SP1.
Thanks
Bhaskara Murthy
Eclipse Networks Inc"Bhamu" <[email protected]> wrote in message
news:9keuo4$[email protected]..
I am trying to develop an entity bean attached to a key which have a
composite key using Primary Key Class. When I use the findByPrimaryKey
method of the bean it throws an exception as follows,I notice that you are using the reference CMP plugin.
at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)I'm also willing to bet that you may have created your own primary key class
with a single field, rather than using the fields type as a primitive
primary key class. If you do this, then SQLPersistenceManager will break.
It is badly written, and has some stupid assumptions. The one I remember
the most is that if you only have one primary key field, then
SQLPersistenceManager assumes you have used a primitive type such as
java.lang.String or java.lang.Integer, to represent it, rather than creating
your own <Enity>Pk.java file.
SQLPersistenceManager works for toy examples, but in general I would say it
is broken and unusable. Either use BMP, or splash out the money for Coco
Base from Thought Inc. Currently the only CMP plugin for iPlanet App server,
other than the reference implementation, that I know of.
Maybe you are looking for
-
Mainstage 2.1.3 - an error occurred Result code = -39
mainstage 2.1.3 - an error occurred Result code = -39 . What does this mean. How can I find out what error messages mean. And what can I do to fix it. My session became very unstable- previously saved versions (lighter ) were stable but still got er
-
Is VGA a common input to a video projector?
What are common inputs on video projectors? If I get a VGA adaptor for my iPad 2, can I feel confident that it will work with a projector at a meeting I will attend?
-
How to export more than 100 points from waveform to excel
Hi everyone. Novice here. I'm pretty sure other people had my problem, but I don't know how to word it... and can't find a solution for it... Maybe I just don't understand Labview enough to know what's going on. Here's what I'm doing: I have a wavef
-
Oracle Text query parser - sample code
I've posted a new entry on my "searchtech" blog which includes code for a "Google-like" query syntax parser: https://blogs.oracle.com/searchtech/entry/oracle_text_query_parser Currently it's just sample code, but if it goes down well we might include
-
We have an IDOC to File Scenario. We are FTPing the file on the Receiver end. When the receiver System is Down after certain number of attempts my job fails with the red flag. Once the file System is up, how to resend the Faile Message(As it is not p