Javax.ejb.NoSuchObjectLocalException when removing entitybean
Weblogic 10.3.0.0
EJB 2.1
Hi. I am using the below code to remove a record in the database. But it happens that I get a javax.ejb.NoSuchObjectLocalException.
Before this code is executed, I load the data from the database and create a list of sealsInfoTO that has to be removed, so I only get sealsInfoTO that exists in the database.
It all is in the same transaction that is started in a session bean.
It is not only happening with the seals, but also other objects that goes through likewise code
Iterator removedIterator = seals.removedIterator();
while (removedIterator.hasNext()) {
sealsInfoTO = (SealsInfoTO) removedIterator.next();
if ((sealsId = sealsInfoTO.getSealsId()) != null) {
sealsInfoLocal = BeanFactory.getInstance().getSealsInfoLocal(sealsId);
try {
sealsInfoLocal.remove();
log.debug("sealsInfoLocal with pk " + sealsId + " has been removed by the client");
} catch (RemoveException e) {
log.error("Can not remove SealsInfo", e);
throw new SystemException("Can not remove SealsInfo", e);
javax.ejb.NoSuchObjectLocalException: [EJB:010142]Instance of EJB 'SealsInfo' with primary key '183109' does not exist.: javax.ejb.NoSuchEntityException: [EJB:010142]Instance of EJB 'SealsInfo' with primary key '183109' does not exist.
at dk.steria.exp.midtier.model.declaration.ejb.SealsInfo_tjm27k__WebLogic_CMP_RDBMS.ejbRemove(SealsInfo_tjm27k__WebLogic_CMP_RDBMS.java:2682)
at weblogic.ejb.container.manager.DBManager.remove(DBManager.java:1661)
at weblogic.ejb.container.internal.EntityEJBLocalObject.remove(EntityEJBLocalObject.java:129)
at dk.steria.exp.midtier.model.declaration.ejb.SealsInfo_tjm27k_ELOImpl.remove(SealsInfo_tjm27k_ELOImpl.java:646)
at dk.steria.exp.midtier.tools.consumer.Process.processSealsInfo(Process.java:382)
at dk.steria.exp.midtier.tools.consumer.DeclarationConsumer.updateDeclaration(DeclarationConsumer.java:205)
at dk.steria.exp.midtier.tools.consumer.DeclarationConsumer.updateDeclaration(DeclarationConsumer.java:157)
at dk.steria.exp.midtier.tools.consumer.DeclarationConsumer.submitDeclaration(DeclarationConsumer.java:1207)
at dk.steria.exp.midtier.api.declaration.ejb.DeclarationSBBean.submitDeclaration(DeclarationSBBean.java:871)Edited by: Kristian Lind on Sep 4, 2012 10:56 AM
Yogavelan...for a faster response, post your question in the Oracle9i JDeveloper Forum:
JDeveloper and ADF
This forum is for member feedback about OTN services and content only; it is not monitored by product teams.
Similar Messages
-
Javax.ejb.NoSuchObjectLocalException
Hi All,
Am trying to test the EJB CMP from tables, I managed to create the EJB's, but when I try to test it using the JDeveloper new sample client test, I keep getting the following errors:
found.com.evermind.server.rmi.OrionRemoteException: javax.ejb.NoSuchObjectLocalException: 47551
This error is thrown after performing the following steps.
1) Session Bean lookup for the EntityBean and gets the LocalHome Interface.
2) Calls the finder method in the LocalHome interface which returns the LocalInterface object.
3) Calling the accessor method of the Entity bean with the LocalInterface object.
The error is thrown at step 3.
Here's the Nested Exception Stack Trace:
Nested exception is:
javax.ejb.NoSuchObjectLocalException: 47551
void F001Local_EntityBeanWrapper7.reActivateNew()
F001Local_EntityBeanWrapper7.java:34244
void F001Local_EntityBeanWrapper7.reActivateNewLocal()
F001Local_EntityBeanWrapper7.java:34216
java.lang.String F001Local_EntityBeanWrapper7.getForename_first()
F001Local_EntityBeanWrapper7.java:7532
java.lang.String scro.impl.AirwaveSessionBean.listBySurname(java.lang.String)
AirwaveSessionBean.java:92
java.lang.String AirwaveSession_StatelessSessionBeanWrapper2.listBySurname(java.lang.String)
AirwaveSession_StatelessSessionBeanWrapper2.java:112
java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[])
native code
void com.evermind.server.rmi.RMICallHandler.run(java.lang.Thread)
RMICallHandler.java:119
void com.evermind.server.rmi.RMICallHandler.run()
RMICallHandler.java:48
void EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run()
PooledExecutor.java:803
void java.lang.Thread.run()
Thread.java:484
at connection to localhost/127.0.0.1
void com.evermind.server.rmi.OrionRemoteException.receive(java.net.InetAddress, java.lang.String)
OrionRemoteException.java:130
void com.evermind.server.rmi.RMIConnection.handleMethodInvocationResponse()
RMIConnection.java:1673
void com.evermind.server.rmi.RMIConnection.run(java.lang.Thread)
RMIConnection.java:532
void com.evermind.server.rmi.RMIConnection.run()
RMIConnection.java:275
void EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run()
PooledExecutor.java:797
void java.lang.Thread.run()
Thread.java:484
Process exited with exit code 0.
I look forward to hearing from you.
Cheers
MoYogavelan...for a faster response, post your question in the Oracle9i JDeveloper Forum:
JDeveloper and ADF
This forum is for member feedback about OTN services and content only; it is not monitored by product teams. -
Can not find javax.ejb.CreateException when lookup and create EJB instance.
Hi,
I installed SAP CE 7.2 and NWDS 7.2. When i call create() of EJB's home interface from JAVA stand alone app to create EJB instance, the complier state that it need 'javax.ejb.CreateException'. How can i find the jar that contain 'javax.ejb.CreateException' to solve this problem?
Thank a lot,
Thongie
Edited by: Thongie on Jul 8, 2011 7:30 PMThank a lot, I can found EJB20.jar at 'usr\sap\<sid>\<instance_id>\j2ee\j2eeclient\'
-
Import javax.ejb errors when compiling
Hi,
when I am compiling my EJBs, (I am using Eclipse 2.1.1 , but I got the same thing using Bluej) I am getting errors that point to my import statements such as:
import javax.ejb.SessionBean;
do I need to install some jar files anywhere and configure my classpath? in order to be able to use EJBs?
many thanks
yanthanks,
I already have j2ee installed and I have the j2ee.jar file in my classpath
I was wondering if it was something more specific than this
yan -
Javax.ejb.CreateException: "Help.." :)
i am building two tables the relationship between them is one to many..
I just created a very simple test code run a JSP to call one of these entity beans.. and I got the Error like this...
javax.ejb.CreateException: Error creating EntityBean: ORA-01747: invalid user.table.column, table.column, or column specification
I have checked my Oracle Database and codes seems nothing is wrong.. I actually built this CMB by using JDeveloper 9031 and creating the entity bean from the table directly..
really no clues with this error now.. :( Help Help :)i just created this dummy program to test.. when two tables has realtionship how can i deal with the entity beans..
StudentHome Interface (part of the codes)
Student create(Long id, String name, String password, String email, Timestamp date, ClassesLocal classes_class_id) throws RemoteException, CreateException;
ClassesHome interface(part of the codes)
Classes create(String class_id, String name, String location, String roomid, String teacherid) throws RemoteException, CreateException;
my client Servlet (part of the codes)
try{
// get My Jobs for this user
Context ctx = new InitialContext();
Object jndiRef01 = ctx.lookup("Classes");
Object portableObj01 = PortableRemoteObject.narrow(jndiRef01, ClassesHome.class);
ClassesHome ejbHome01 = (ClassesHome) portableObj01;
System.out.println("00");
ejbHome01.create("xxx24","xxx24", "xxx24","xxx24","xxx24");
System.out.println("02");
Object jndiRef02 = ctx.lookup("Student");
Object portableObj02 = PortableRemoteObject.narrow(jndiRef01, StudentHome.class);
StudentHome ejbHome02 = (StudentHome) portableObj02;
Calendar dd = Calendar.getInstance();
ejbHome02.create(new Long(11),"11","11","ere", new Timestamp((dd.getTime()).getTime()), ????????????????);
}catch (Exception e)
e.printStackTrace();
=================================================================================
I used Jdeveloper 9032 IDE and built these two CMPs by mapping from Oracle database directly.... i didnot modify anything for these two CMPs since assume JDeveloper will do the setting for me..
One of the problems i am facing now is
what vale (ClassesLocal classes_class_id) should I put when call this create method... this paramter is gennerated by IDE.....
Student create(Long id, String name, String password, String email, Timestamp date, ClassesLocal classes_class_id) throws RemoteException, CreateException;
Thanks for your reply.. will check back later -
Javax.ejb.RemoveException: An attemp was made to remove stateful instance
Hi,
I am working with a SAP PI 7.1 File adapter without content conversion but attachments. I created an adapter module to change the attachments name and its Mime type. But get following error when i use this module. Even if i just pass the rinputModuleData back without any coding in between i get the same error. (Adapter engine is on the latest SP stack)
Does anyone know what is wrong and how to solve this problem ?
Error: javax.ejb.RemoveException: An attemp was made to remove stateful instance while it still participates in a transaction.This is strictly forbidden by the EJB Specification. However the current transaction won't be marked for rollback allowing you to recover from the error.
Regards,
AndreasHi Agasthuri,
thank you for your quick reply. I use exactly the scenario described in following Blog
/people/francesco.bersani/blog/2007/03/27/rename-attachment-adapter-module
The only thing i did is changing the coding a bit so that it fits PI7.1
Regards,
Andreas -
BMP question : got javax.ejb.EJBException error Object state not saved
Could anybody please help me? I could not figure out what i did wrong.
I got the javax.ejb.EJBException error: Object state not saved
when i test the getname() method for findByPrimaryKey() and findAll() methods.
Here is my code:
package org.school.idxc;
import javax.sql.*;
import javax.naming.*;
import javax.ejb.*;
import javax.sql.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Vector;
* Bean implementation class for Enterprise Bean: status
public class statusBean implements javax.ejb.EntityBean {
private javax.ejb.EntityContext myEntityCtx;
private int id;
private String name;
private DataSource ds;
private String dbname = "jdbc/idxc";
private Connection con;
* ejbActivate
public void ejbActivate() {
* ejbLoad
public void ejbLoad() {
System.out.println("Entering EJBLoad");
try
Integer primaryKey = (Integer) myEntityCtx.getPrimaryKey();
String sqlstmt = "select id, name from from status where id =?";
con = ds.getConnection();
PreparedStatement stmt = con.prepareStatement(sqlstmt);
stmt.setInt (1,primaryKey.intValue());
ResultSet rs = stmt.executeQuery();
if (rs.next())
this.id = rs.getInt(1);
this.name = rs.getString (2).trim();
stmt.close();
} // if
else
stmt.close();
throw new NoSuchEntityException ("Invalid id " + id);
}// else
} // try
catch (SQLException e)
System.out.println("EJBLOad : " + e.getMessage());
} // catch
finally
try
if (con != null)
con.close();
}// try
catch (SQLException e)
System.out.println("EJBLOad finally" + e.getMessage());
} // catch
}// finally
* ejbPassivate
public void ejbPassivate() {
* ejbRemove
public void ejbRemove() throws javax.ejb.RemoveException {
System.out.println ("Entering ejb Removed");
try
String sqlstmt = "delete from status where id=" + id;
con = ds.getConnection();
Statement stmt = con.createStatement();
stmt.executeUpdate(sqlstmt);
stmt.close();
}// try
catch (SQLException e)
System.out.println("Ejb Remove" + e.getMessage());
} // catch
finally
try
if (con!=null)
con.close();
}// try
catch (SQLException e)
System.out.println ("EJBRemoved " + e.getMessage());
} // catch
} // finally
* ejbStore
public void ejbStore() {
System.out.println("Entering the ejbStore");
try
String sqlstmt = "update status set id=" + id + ",name='" + name + "' where id=" + id;
con = ds.getConnection();
Statement stmt = con.createStatement();
if (stmt.executeUpdate(sqlstmt) != 1)
throw new EJBException ("Object state not saved");
stmt.close();
} // try
catch (SQLException e)
System.out.println ("EJBStore : " + e.getMessage());
}// catch
finally
try
if (con != null)
con.close();
} // try
catch(SQLException e)
System.out.println ("EJBStore finally " + e.getMessage());
} // catch
} // finally
* getEntityContext
public javax.ejb.EntityContext getEntityContext() {
return myEntityCtx;
* setEntityContext
public void setEntityContext(javax.ejb.EntityContext ctx) {
myEntityCtx = ctx;
try
InitialContext initial = new InitialContext();
ds = (DataSource)initial.lookup(dbname);
} // try
catch (NamingException e)
throw new EJBException ("set Entity context : Invalid database");
}// catch
* unsetEntityContext
public void unsetEntityContext() {
myEntityCtx = null;
* ejbCreate
public Integer ejbCreate(Integer key, String name) throws javax.ejb.CreateException {
this.id = key.intValue();
this.name = name;
System.out.println ("Entering ejbCreated!!!");
try
String sqlstmt = "insert into status(id,name) values (" + id + ",'" + (name == null ? "" : name) + "')";
con = ds.getConnection();
Statement stmt = con.createStatement();
stmt.executeUpdate(sqlstmt);
stmt.close();
}// try
catch (SQLException e)
System.out.println("EJBCreate : SQLEXception ");
}// catch
finally
try
if (con!=null)
con.close();
}// try
catch (SQLException e)
System.out.println ("EJB Created Finally : SQLException");
e.getMessage();
} // catch
}// finally
this.id = key.intValue();
this.name = name;
return key ;
* ejbPostCreate
public void ejbPostCreate(Integer id, String name) throws javax.ejb.CreateException {
* ejbFindByPrimaryKey
public Integer ejbFindByPrimaryKey(
Integer key) throws javax.ejb.FinderException {
try
String sqlstmt = "select id from status where id=" + key.intValue();
con = ds.getConnection();
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sqlstmt);
if (!rs.next())
throw new ObjectNotFoundException();
} // if
rs.close();
stmt.close();
} // try
catch (SQLException e)
System.out.println ("EJBFindBYPrimaryKey " + e.getMessage());
} // catch
finally
try
if (con!=null)
con.close();
}// try
catch (SQLException e)
System.out.println ("EJB Find by primary key" + e.getMessage());
}// catch
}// finally
return key;
* @return Returns the name.
public String getName() {
return this.name;
* @return Returns id
public int getId() {
return this.id;
* @param name The name to set.
public void setName(String xname) {
this.name = xname;
* ejbFindByLastnameContaining
public Enumeration ejbFindAllNamne () throws javax.ejb.FinderException
try
String sqlstmt = "select id from status order by id";
con = ds.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(sqlstmt);
Vector keys = new Vector();
while (rs.next())
keys.add(new Integer(rs.getInt(1)));
}// while
rs.close();
s.close();
con.close();
return keys.elements();
} // try
catch (SQLException e)
throw new FinderException (e.toString());
} // catch
}Hi,
if you look at your error message you will see the problem. In your code you've missed to implement
public void ejbPassivate {}
so your code looks like this
import java.lang.Object;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import java.rmi.RemoteException;
import java.lang.Math;
import java.util.Random;
import java.io.*;
/** * Title: * Description: * Copyright: Copyright (c) 2001 * Company: * @author * @version 1.0 */
public class DiceEJB implements SessionBean, Serializable
public int[] Roll()
Random rng = new Random();
int[] diceArray = new int[5];
for(int i =0; i < diceArray.length;i++)
diceArray[i] = (Math.abs (rng.nextInt()) % 6) +1;
return diceArray;
public DiceEJB(){}
public void ejbCreate() {}
public void ejbRemove() {}
public void ejbActivate() {}
public void ejbPassivate() {}
public void setSessionContext (SessionContext sc)
private void writeObject(ObjectOutputStream oos) throws IOException
oos.defaultWriteObject();
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException
ois.defaultReadObject();
bye -
Hi,
I'm stuck on this problem since 10 days now. Please Please help.
I'm using Jboss 4.0.5GA and ejb 2.0 While executing the last query after running the ejbStore() of the bean, it breaks,
The error is below :
Executing SQL: UPDATE arinpchg SET modified_date=?, doc_num=?, printing_status=? WHERE trx_num=?
2007-11-29 15:52:55,593 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP1xFieldBridge.au.com.cams.cims.ar.ejb.Charge#modifiedDate] param: i=1, type=TIMESTAMP, value=2007-11-29 15:52:53.14
2007-11-29 15:52:55,593 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP1xFieldBridge.au.com.cams.cims.ar.ejb.Charge#docNum] param: i=2, type=VARCHAR, value=INV297217
2007-11-29 15:52:55,593 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP1xFieldBridge.au.com.cams.cims.ar.ejb.Charge#printingStatus] param: i=3, type=INTEGER, value=1
2007-11-29 15:52:55,593 TRACE [org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP1xFieldBridge.au.com.cams.cims.ar.ejb.Charge#trxNum] param: i=4, type=VARCHAR, value=ARTRX395716
2007-11-29 15:52:55,734 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException in method: public abstract au.com.cams.cims.ar.data.PendingChargeResponse au.com.cams.cims.business.ejb.PendingChargeManager.processPendingCharges(au.com.cams.cims.ar.data.PendingChargeRequest,au.com.cams.cims.core.data.DUser) throws au.com.cams.cims.core.util.StoredProcedureFailedException,au.com.cams.cims.core.util.UpdateFailedException,java.rmi.RemoteException, causedBy:
org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=MEL-LAP-XP-66/59, BranchQual=, localId=59] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException: Update failed. Expected one affected row: rowsAffected=0, id=au.com.cams.cims.ar.data.ChargePK@839418b6)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:372)
at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:501)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:361)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
at org.jboss.ejb.Container.invoke(Container.java:954)
at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)
at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:70)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:112)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
at $Proxy508.processPendingCharges(Unknown Source)
at au.com.cams.cims.ar.cmd.PendingChargeManagerCmdBean.doProcessPendingCharges(Unknown Source)
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:585)
at au.com.cams.cims.core.cmd.AbstractCmdBean.execute(Unknown Source)
at au.com.cams.cims.core.sys.CIMSCommandBeanManager.doCommandBeanExecute(Unknown Source)
at au.com.cams.cims.core.sys.CIMSCommandBeanManager.execute(Unknown Source)
at au.com.singtech.saf.MainServlet.doPost(Unknown Source)
at au.com.singtech.saf.MainServlet.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
Caused by: javax.ejb.EJBException: Update failed. Expected one affected row: rowsAffected=0, id=au.com.cams.cims.ar.data.ChargePK@839418b6
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.execute(JDBCStoreEntityCommand.java:169)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.storeEntity(JDBCStoreManager.java:666)
at org.jboss.ejb.plugins.CMPPersistenceManager.storeEntity(CMPPersistenceManager.java:428)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.storeEntity(CachedConnectionInterceptor.java:273)
at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:756)
at org.jboss.ejb.GlobalTxEntityMap$2.synchronize(GlobalTxEntityMap.java:149)
at org.jboss.ejb.GlobalTxEntityMap$GlobalTxSynchronization.synchronize(GlobalTxEntityMap.java:295)
at org.jboss.ejb.GlobalTxEntityMap$GlobalTxSynchronization.beforeCompletion(GlobalTxEntityMap.java:345)
at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1491)
at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1110)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:324)
My entityBean:
* Copyright 2000 by Sing Technologies Pty. Ltd.,
* Level 11, 269 Wickham Street, Fortitude Valley, Qld 4006, Australia
* All rights reserved.
* This software is the confidential and proprietary information
* of Sing Technologies Pty. Ltd. ("Confidential Information"). You
* shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement
* you entered into with Sing Technologies.
package au.com.cams.cims.ar.ejb;
import java.sql.*;
import javax.ejb.*;
import au.com.cams.cims.ar.data.*;
import au.com.cams.cims.core.data.*;
import au.com.cams.cims.core.util.*;
import au.com.cams.cims.core.ejb.*;
import au.com.cams.cims.core.app.*;
import org.apache.log4j.*;
import javax.naming.*;
import javax.rmi.*;
import java.util.*;
import java.rmi.RemoteException;
* @stereotype EntityBean
* @persistence Container
* @homeInterface au.com.cams.cims.ar.ejb.ChargeHome
* @remoteInterface au.com.cams.cims.ar.ejb.Charge
* @primaryKey au.com.cams.cims.ar.ejb.ChargePK
public class ChargeBean implements EntityBean {
static private Logger log = Logger.getLogger(ChargeBean.class.getName());
private static final String datasource = "java:ds/cims";
private static final String chargeLineRef = "java:comp/env/ejb/au.com.cams.cims.ar.ejb.ChargeLineHome";
// Used by the isModified extension
private transient boolean isDirty;
public boolean isModified() {
return isDirty;
/** @field Key VARCHAR(20) CIMSSchema.dbo.arinpchg.trx_num */
public String trxNum;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.apply_to_num */
public String applyToNum;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.terms_code */
public String termsCode;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.fin_chg_code */
public String finChgCode;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.shipping_code */
public String shippingCode;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.posting_code */
public String postingCode;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.tax_code */
public String taxCode;
/** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.aging_date */
public Timestamp agingDate;
/** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.due_date */
public Timestamp dueDate;
/** @field FLOAT(15) CIMSSchema.dbo.arinpchg.gross_amount */
public Double grossAmount;
/** @field FLOAT(15) CIMSSchema.dbo.arinpchg.tax_amount */
public Double taxAmount;
/** @field FLOAT(15) CIMSSchema.dbo.arinpchg.tax_included_amount */
public Double taxIncludedAmount;
/** @field FLOAT(15) CIMSSchema.dbo.arinpchg.freight_amount */
public Double freightAmount;
/** @field FLOAT(15) CIMSSchema.dbo.arinpchg.tax_on_freight_amount */
public Double taxOnFreightAmount;
/** @field FLOAT(15) CIMSSchema.dbo.arinpchg.net_amount */
public Double netAmount;
/** @field FLOAT(15) CIMSSchema.dbo.arinpchg.paid_amount */
public Double paidAmount;
/** @field FLOAT(15) CIMSSchema.dbo.arinpchg.due_amount */
public Double dueAmount;
/** @field INTEGER(10) CIMSSchema.dbo.arinpchg.trx_type */
public Integer trxType;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.doc_num */
public String docNum;
/** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.doc_date */
public Timestamp docDate;
/** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.apply_date */
public Timestamp applyDate;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.debtor_num */
public String debtorNum;
/** @field INTEGER(10) CIMSSchema.dbo.arinppyt.trx_status */
public Integer trxStatus;
/** @field INTEGER(10) CIMSSchema.dbo.arinppyt.approval_status */
public Integer approvalStatus;
/** @field INTEGER(10) CIMSSchema.dbo.arinpchg.printing_status */
public Integer printingStatus;
/** @field INTEGER(10) CIMSSchema.dbo.arinpchg.posting_status */
public Integer postingStatus;
/** @field INTEGER(10) CIMSSchema.dbo.arinpchg.hold_status */
public Integer holdStatus;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.hold_reason */
public String holdReason;
/** @field VARCHAR(2000) CIMSSchema.dbo.arinpchg.notes */
public String notes;
/** @field VARCHAR(200) CIMSSchema.dbo.arinpchg.message */
public String message;
/** @field INTEGER(10) CIMSSchema.dbo.arinpchg.next_sequence_id */
public Integer nextSequenceId;
/** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.billing_addressee */
public String billingAddressee;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.billing_job_position */
public String billingJobPosition;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.billing_addr1 */
public String billingAddr1;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.billing_addr2 */
public String billingAddr2;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.billing_addr3 */
public String billingAddr3;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.billing_locality */
public String billingLocality;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.billing_state */
public String billingState;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.billing_postcode */
public String billingPostcode;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.billing_country */
public String billingCountry;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_phone_home */
public String billingPhoneHome;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_phone_business */
public String billingPhoneBusiness;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_phone_mobile */
public String billingPhoneMobile;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_phone_car */
public String billingPhoneCar;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_fax_home */
public String billingFaxHome;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.billing_fax_business */
public String billingFaxBusiness;
/** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.billing_email */
public String billingEmail;
/** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.billing_email2 */
public String billingEmail2;
/** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.billing_website */
public String billingWebsite;
/** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.shipping_addressee */
public String shippingAddressee;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.shipping_job_position */
public String shippingJobPosition;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.shipping_addr1 */
public String shippingAddr1;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.shipping_addr2 */
public String shippingAddr2;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.shipping_addr3 */
public String shippingAddr3;
/** @field VARCHAR(50) CIMSSchema.dbo.arinpchg.shipping_locality */
public String shippingLocality;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.shipping_state */
public String shippingState;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.shipping_postcode */
public String shippingPostcode;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.shipping_country */
public String shippingCountry;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_phone_home */
public String shippingPhoneHome;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_phone_business */
public String shippingPhoneBusiness;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_phone_mobile */
public String shippingPhoneMobile;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_phone_car */
public String shippingPhoneCar;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_fax_home */
public String shippingFaxHome;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.shipping_fax_business */
public String shippingFaxBusiness;
/** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.shipping_email */
public String shippingEmail;
/** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.shipping_email2 */
public String shippingEmail2;
/** @field VARCHAR(100) CIMSSchema.dbo.arinpchg.shipping_website */
public String shippingWebsite;
/** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.created_date */
public Timestamp createdDate;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.created_by */
public String createdBy;
/** @field TIMESTAMP(23) CIMSSchema.dbo.arinpchg.modified_date */
public Timestamp modifiedDate;
/** @field VARCHAR(30) CIMSSchema.dbo.arinpchg.modified_by */
public String modifiedBy;
/** @field VARCHAR(20) CIMSSchema.dbo.arinpchg.print_job_num *//*
public String printJobNum;*/
* The container assigned reference to the entity
private EntityContext context;
* Sets the context of the bean
* @param ec
public void setEntityContext(EntityContext ec) {
context = ec;
// to do: code goes here.
* Clears the context of the bean
public void unsetEntityContext() {
this.context = null;
// to do: code goes here.
* This method is called when the container picks this entity object
* and assigns it to a specific entity object. Insert code here to
* acquire any additional resources that it needs when it is in the
* ready state.
public void ejbActivate() {
* This method is called when the container diassociates the bean
* from the entity object identity and puts the instance back into
* the pool of available instances. Insert code to release any
* resources that should not be held while the instance is in the
* pool.
public void ejbPassivate() {
* The container invokes this method on the bean whenever it
* becomes necessary to synchronize the bean's state with the
* state in the database. This method is called after the container
* has loaded the bean's state from the database.
public void ejbLoad() {
System.out.println("#### VJ: ChargeBean.ejbLoad()");
* The container invokes this method on the bean whenever it
* becomes necessary to synchronize the state in the database
* with the state of the bean. This method is called before the
* container extracts the fields and writes them into the database.
public void ejbStore() {
System.out.println("#### VJ: ChargeBean.ejbStore()");
this.isDirty = false;
updateTotals();
System.out.println("#### VJ: ChargeBean.context.getPrimaryKey(): " + context.getPrimaryKey().toString());
System.out.println("#### VJ: ChargeBean.trxNum: " + trxNum);
* The container invokes this method in response to a client-invoked
* remove request. Insert code to implement any actions before the
* bean is removed from the database.
public void ejbRemove() throws RemoveException {
public ChargePK ejbCreate(DCharge charge, DUser user)
throws CreateException {
System.out.println("#### VJ: ChargeBean.ejbCreate(DCharge, DUser)");
Connection con = null;
ChargePK key = new ChargePK();
if (charge == null)
throw new CreateException("charge cannot be null");
if (user == null)
throw new CreateException("user cannot be null");
try {
// set the pk
con = DatabaseUtilities.getConnection(log, datasource);
this.trxNum = AppJDBCHelper.getNextTrxNum(con);
key.trxNum = this.trxNum;
// set other attributes
setAttributes(charge);
// set mod history
this.createdDate = new Timestamp(new java.util.Date().getTime());
this.createdBy = user.getUsername();
this.modifiedDate = new Timestamp(new java.util.Date().getTime());
this.modifiedBy = user.getUsername();
} catch (GetNextIdFailedException gnife) {
log.error("ejbCreate", gnife);
throw new CreateException(gnife.getMessage());
} catch (NullPointerException ex1) {
ex1.printStackTrace();
log.warn("ejbCreate(): " + ex1);
throw new CreateException("ejbCreate(): " + ex1);
} finally {
if (con != null) DatabaseUtilities.close(con, log, "ejbCreate()");
//System.out.println("#### VJ: ChargeBean.ejbCreate(DCharge, DUser) context.getPrimaryKey(): " + context.getPrimaryKey().toString());
System.out.println("#### VJ: ChargeBean.ejbCreate(DCharge, DUser) (ChargeBean) trxNum: " + trxNum);
System.out.println("#### VJ: ChargeBean.ejbCreate(DCharge, DUser) (ChargePK) key.trxNum: " + key.trxNum);
System.out.println("#### VJ: ChargeBean.ejbCreate(DCharge, DUser) (DCharge): " + charge.getTrxNum());
return (key);
* The container invokes this method after invoking the ejbCreate
* method with the same arguments.
* @param charge
* @param user
public void ejbPostCreate(DCharge charge, DUser user) {
System.out.println("#### VJ: ChargeBean.ejbPostCreate(DCharge, DUser)");
updateTotals();
isDirty = false;
System.out.println("#### VJ: ChargeBean.ejbPostCreate(DCharge, DUser) context.getPrimaryKey(): " + context.getPrimaryKey().toString());
System.out.println("#### VJ: ChargeBean.ejbPostCreate(DCharge, DUser) (ChargeBean) trxNum: " + trxNum);
System.out.println("#### VJ: ChargeBean.ejbPostCreate(DCharge, DUser) (DCharge): " + charge.getTrxNum());
* @exception ReadFailedException
* @return
public DCharge getDetails()
throws ReadFailedException {
DCharge charge = new DCharge();
try {
updateTotals();
charge.setTrxNum(this.trxNum);
getAttributes(charge);
DModificationHistory history = new DModificationHistory();
history.setCreatedDate(this.createdDate);
history.setCreatedBy(this.createdBy);
history.setModifiedDate(this.modifiedDate);
history.setModifiedBy(this.modifiedBy);
charge.setModificationHistory(history);
} catch (InvalidDataException ex1) {
log.warn("getDetails(): " + ex1);
throw new ReadFailedException("getDetails(): " + ex1.toString());
} catch (NullPointerException ex2) {
log.warn("getDetails(): " + ex2);
throw new ReadFailedException("getDetails(): " + ex2.toString());
return (charge);
* @exception ReadFailedException
* @return
public DCharge getAllDetails()
throws ReadFailedException {
DCharge charge = null;
try {
// get non dependant object data
charge = getDetails();
// declare and init search home ejbs
Context ctx = new InitialContext();
// used for searching
ChargePK chargePK = new ChargePK();
chargePK.trxNum = this.trxNum;
System.out.println("#### VJ: ChargeBean.getAllDetails() chargePK.trxNum(): " + chargePK.trxNum);
System.out.println("#### VJ: ChargeBean.getAllDetails() charge.getTrxNum(): " + charge.getTrxNum());
// load the charge line items
try {
Object obj = ctx.lookup("java:comp/env/ejb/au.com.cams.cims.ar.ejb.ChargeLineSearchHome");
ChargeLineSearchHome chargeLineSearchHome = (ChargeLineSearchHome) PortableRemoteObject.narrow(obj, ChargeLineSearchHome.class);
ChargeLineSearch chargeLineSearch = chargeLineSearchHome.create();
System.out.println("ChargePK: " + chargePK.trxNum);
charge.setLineItems(chargeLineSearch.searchByCharge(chargePK));
} catch (NamingException ne) {
log.warn("getAllDetails(): couldn't lookup ChargeLineSearchHome " + ne.toString());
} catch (InvalidDataException ide) {
log.warn("getAllDetails(): couldn't set ChargeLineSearchHome " + ide.toString());
} catch (SearchFailedException sfe) {
log.warn("getAllDetails(): search failed " + sfe.toString());
} catch (CreateException ce) {
log.warn("getAllDetails(): couldn't create ChargeLineSearchHome " + ce.toString());
} catch (RemoteException re) {
log.warn("getAllDetails(): " + re.toString());
} catch (NamingException ex) {
log.warn("getAllDetails(): couldn't get an initial context " + ex.toString());
throw new ReadFailedException("getAllDetails(): " + ex.toString());
return charge;
* @param charge
* @param user
* @exception UpdateFailedException
public void setDetails(DCharge charge, DUser user)
throws UpdateFailedException {
System.out.println("#### VJ: ChargeBean.setDetails(DCharge, DUser)");
try {
// set other attributes
setAttributes(charge);
updateTotals();
// set mod history
this.modifiedDate = new Timestamp(new java.util.Date().getTime());
this.modifiedBy = user.getUsername();
} catch (NullPointerException ex1) {
log.warn("setDetails(): " + ex1);
throw new UpdateFailedException("setDetails(): " + ex1.toString());
* Increments the next sequenceId and returns the current sequenceId (before incrememt)
* @exception java.rmi.RemoteException
* @exception UpdateFailedException
public Integer incNextSequenceId()
throws UpdateFailedException {
Integer nextId = null;
try {
int current = this.nextSequenceId.intValue();
// make a copy of the existing id
nextId = new Integer(current);
// now inc it
this.nextSequenceId = new Integer(++current);
} catch (EJBException e) {
log.error("incNextSequenceId(): couldn't inc next sequenceId: " + e.toString());
throw new UpdateFailedException(e.getMessage());
return nextId;
* Used by setDetails, ejbCreate.
* @param member
protected void setAttributes(DCharge charge) {
System.out.println("#### VJ: ChargeBean.setAttributes(DCharge)");
this.isDirty = true;
ARTransactionManager mgr = null;
try {
Context ctx = new InitialContext();
Object obj = ctx.lookup("java:comp/env/ejb/au.com.cams.cims.ar.ejb.ARTransactionManagerHome");
ARTransactionManagerHome mgrHome = (ARTransactionManagerHome) PortableRemoteObject.narrow(obj, ARTransactionManagerHome.class);
mgr = mgrHome.create();
} catch (NamingException ne) {
log.warn("setAttributes(): couldn't lookup ARTransactionManagerHome " + ne.toString());
throw new EJBException(ne.toString());
} catch (CreateException ce) {
log.warn("setAttributes(): couldn't create ARTransactionManagerHome " + ce.toString());
throw new EJBException(ce.toString());
} catch (RemoteException ex) {
log.error(ex.toString());
throw new EJBException(ex.toString());
try {
TaxCode tc = mgr.getTaxCode(charge.getTaxCode());
TaxAmounts amounts = ARUtilities.calculateTax(charge.getFreightAmount(), tc);
this.taxOnFreightAmount = new Double(amounts.getAmountTax().doubleValue() - amounts.getAmountTaxIncluded().doubleValue());
} catch (ReadFailedException rfe) {
log.error("ReadFailedException reading tax code : " + charge.getTaxCode(), rfe);
throw new EJBException(rfe.toString());
} catch (RecordNotFoundException rnfe) {
log.error("RecordNotFoundException reading tax code : " + charge.getTaxCode(), rnfe);
throw new EJBException(rnfe.toString());
} catch (RemoteException ex) {
log.error(ex.toString());
throw new EJBException(ex.toString());
System.out.println("#### VJ: ChargeBean.setAttributes(DCharge) prior setters");
this.applyToNum = charge.getApplyToNum();
this.termsCode = charge.getTermsCode();
this.finChgCode = charge.getFinanceChargeCode();
this.shippingCode = charge.getShippingCode();
this.postingCode = charge.getPostingCode();
this.taxCode = charge.getTaxCode();
this.agingDate = new Timestamp(charge.getAgingDate().getTime());
this.dueDate = new Timestamp(charge.getDueDate().getTime());
this.grossAmount = charge.getGrossAmount();
this.taxAmount = charge.getTaxAmount();
this.taxIncludedAmount = charge.getTaxIncludedAmount();
this.freightAmount = charge.getFreightAmount();
this.netAmount = charge.getNetAmount();
this.paidAmount = charge.getPaidAmount();
this.dueAmount = charge.getDueAmount();
this.trxType = charge.getTrxType();
this.docNum = charge.getDocNum();
this.docDate = new Timestamp(charge.getDocDate().getTime());
this.applyDate = new Timestamp(charge.getApplyDate().getTime());
this.debtorNum = charge.getDebtorNum();
this.trxStatus = charge.getTrxStatus();
this.approvalStatus = charge.getApprovalStatus();
this.printingStatus = charge.getPrintingStatus();
this.postingStatus = charge.getPostingStatus();
this.holdStatus = charge.getHoldStatus();
this.holdReason = charge.getHoldReason();
this.notes = charge.getNotes();
this.message = charge.getMessage();
this.nextSequenceId = charge.getNextSequenceId();
DAddress billingAddress = charge.getBillingAddress();
if (billingAddress != null) {
this.billingAddressee = billingAddress.getAddressee();
this.billingJobPosition = billingAddress.getPosition();
this.billingAddr1 = billingAddress.getAddress1();
this.billingI've solved this problem using JDBC.
Thanks
Smile
Message was edited by:
nsqsmile -
Warning: Unable to create new entry, caught: "javax.ejb.CreateException", message is: "Error creating EntityBean: Io exception: The Network Adapter could not establish the connection".
while executing JSP:<%
* add.jsp
* Adds a new entry through EmployeeBean. This is a JSP that serves 2
* functions. First of all, when called with no arguments, it will display a
* table with a few input fields. The user should enter empNo, empName and
* salary of the new record to be added. When she submits this
* information, it is sent to this page again. If it is successful, then the
* user can continue adding new entries. If it is not, then the old data will
* be displayed, and a warning message will be shown to her.
%>
<%@ page import="com.webstore.*,java.io.*,java.util.*,javax.naming.*" %>
<%
// Make sure this page will not be cached by the browser
response.addHeader("Pragma", "no-cache");
response.addHeader("Cache-Control", "no-store");
// We will send error messages to System.err, for verbosity. In a real
// application you will probably not want this.
PrintStream errorStream = System.err;
// If we find any fatal error, we will store it in this variable.
String error = null;
// In a moment we will check if all columns were passed to this page
String param_1 = "";
String param_2 = "";
String param_3 = "";
long dptNo = 0;
String dptName = null;
// This variable indicates what function of this page is currently used. If
// this page is called with parameters, then a new entry should be
// added. In that case this variable is true.
boolean submitting = false;
// We will first attempt to get the reference to EmployeeHome from the
// session. The "list.jsp" page sets this attribute in the session.
DepartmentHome home = (DepartmentHome) session.getAttribute("DepartmentHome");
if (home == null) {
error = "No previous connection to DepartmentBean.";
} else {
// Attempt to get all 3 parameters from the session
param_1 = request.getParameter("DPTNO");
param_2 = request.getParameter("DPTNAME");
// If all 3 parameters are specified, then this is probably a submission by
// this very page. Note that if the user left one of the fields blank, then
// the corresponding parameter will be "", not null.
if (param_1 != null && param_2 != null) {
param_1 = param_1.trim();
param_2 = param_2.trim();
submitting = true;
// In the following variable we will store a (non-fatal) warning message. This
// message will be displayed in the page, but so will the submission form.
String warning = null;
if (submitting) {
warning = "";
// If there is an empty param_1, param_2 and/or param_3, then this will be noted
// in the warning message.
if ("".equals(param_1)) {
warning = "Null param_1 specified. ";
if ("".equals(param_2)) {
warning += "Null param_2 specified. ";
// If we don't have a warning message yet, then we will attempt to create
// a new record.
if ("".equals(warning)) {
try {
dptNo = (long)Long.parseLong(param_1);
dptName = new String(param_2);
Department rec = (Department) home.create(dptNo);
rec.setDptname(dptName);
// empty columns after insert for effect
param_1 = "";
param_2 = "";
// If we got this far, then there was no problem detected.
warning = null;
} catch (Exception e) {
// Set the warning variable to indicate a problem.
warning = "Unable to create new entry, caught: \"" +
e.getClass().getName() + "\", message is: \"" +
e.getMessage() + "\".";
// Decide what the title will be.
String title;
if (error != null) {
title = "Error";
} else {
title = "com.webstore | Add entry";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE><%= title %></TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF">
<H1><%= title %></H1>
<%
// If there was a fatal error, then display the error message
if (error != null) {
%>
<P><BLOCKQUOTE><%= error %></BLOCKQUOTE>
<%
// Otherwise display a table with fields to be filled in.
} else {
// If there was a warning, then display it.
if (warning != null) {
%>
<TABLE border="1" bgcolor="#FF2222">
<TR><TD><FONT color="#FFFFFF"><STRONG>Warning: <%= warning %></STRONG></FONT></TD></TR>
</TABLE>
<%
} /* if */
// Display the table with fields. There are two columns. The left column
// contains the names of the fields, while the right column contains the
// fields.
%>
<FORM action="dptadd.jsp" method="GET">
<P><TABLE border="1">
<TR>
<TD><STRONG>DptNo:</STRONG></TD>
<TD><INPUT type="text" name="DPTNO" value="<%= param_1 %>"></INPUT></TD>
</TR>
<TR>
<TD><STRONG>DptName:</STRONG></TD>
<TD><INPUT type="text" name="DPTNAME" value="<%= param_2 %>"></INPUT></TD>
</TR>
<TR>
<TD colspan="3" align="center"><INPUT type="submit" value="Add this entry"></INPUT></TD>
</TR>
</TABLE>
</FORM>
<%
} /* else */
%>
<P><TABLE border="1">
<TR><TD>Back to list</TD></TR>
</TABLE>
</BODY>
</HTML>
Please guide me..Rajive,
This is the same problem as in your other post:
sql is running very slow
So please refer to my answer there.
Good Luck,
Avi. -
ORA-01407 when removing a CMP Entity Bean with WLS 9.1
Hi all !
I hope you can help me to solve this ?:|
I'm migrating my application from WLS 8.1 SP3 to WLS 9.1.
I'm getting now an SQLException when I try to remove a CMP Entity Bean.
The stacktrace is as follows:
java.sql.SQLException: ORA-01407: cannot update ("USER"."MY_TABLE"."THE_CMR_FIELD") to NULL
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1120)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1278)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3415)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3498)
at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:128)
Of course, I replaced the table and column names above to be more readable ;-)
The table MY_TABLE has a CMR field called THE_CMR_FIELD. The column is not nullable in the database (by the way, it's an Oracle 9i).
Everything is fine under WLS8.1
I tried two different Oracle JDBC drivers (9.2.0.5 and 10.2.0.1.0), but the result is always the same within WLS9.1.
Any ideas or suggestions (or even questions) are more than welcome!
Thanks
EricWhat's even more weird is that I have what seams to be the same problem on Weblogic 6.1 (SP4).
Here's the stacktrace:
<pre>
javax.ejb.EJBException:
Start server side stack trace:
java.sql.SQLException: ORA-01407: cannot update ("SCHEMA"."TIM_WP_DAY_CORE_PERIODS"."TWD_ID") to NULL
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate(P6LogPreparedStatement.java:183)
at weblogic.jdbc.jts.Statement.executeUpdate(Statement.java:503)
at package.WorkPatternDayCorePeriods_vd9y46__WebLogic_CMP_RDBMS.__WL_store(WorkPatternDayCorePeriods_vd9y46__WebLogic_CMP_RDBMS.java:2317)
at weblogic.ejb20.manager.DBManager.flushModified(DBManager.java:438)
at weblogic.ejb20.internal.TxManager$TxListener.flushModifiedKeys(TxManager.java:552)
at weblogic.ejb20.internal.TxManager.flushModifiedBeans(TxManager.java:298)
at weblogic.ejb20.manager.BaseEntityManager.flushModifiedBeans(BaseEntityManager.java:1246)
at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.flushModifiedBeans(RDBMSPersistenceManager.java:1106)
at weblogic.ejb20.manager.BaseEntityManager.cascadeDeleteRemove(BaseEntityManager.java:840)
at weblogic.ejb20.manager.DBManager.remove(DBManager.java:656)
at weblogic.ejb20.internal.EntityEJBLocalObject.remove(EntityEJBLocalObject.java:97)
at package.WorkPatternDayCorePeriodsEJB_vd9y46_ELOImpl.remove(WorkPatternDayCorePeriodsEJB_vd9y46_ELOImpl.java:722)
at package.PersonWorkPatternBC.removeWorkPatternDay(PersonWorkPatternBC.java:571)
at package.remove(PersonWorkPatternBC.java:708)
at package.TimPersonCalendarServiceEJB.removeWorkPattern(TimPersonCalendarServiceEJB.java:140)
</pre>
In fact I have this setup:
<pre>
workpattern 1..n workpatternday -| 1..n dayperiod
| 1..n daycoreperiod
</pre>
And before 'ejbRemove'ing the workpattern I first remove the days and before that the periods and core periods.
I start with the periods and instead of removing them in the DB he tries to update the FK to the day with '' (p6spy result).
When I remove the not null constraint on the foreign key everything passes to the day where the workpatternId cannot be set to null.
He does not throw errors on the coreperiod (where the not null constraint to day is still present).
When I invert the sequence of deleting
(first the core periods then the 'regular' periods) he complains about the dayId on the core periods table.
So it's completely absurd :S
I hope weblogic 8.1 might solve this problem as this development code is still to be migrated to 8.1 before going in production...
I would just like to know what's wrong. There are other places with just about the same relationships (CMR and DB) where he does not complain... -
EJBException thrown when using EntityBean
I am currently developing on the BEA Weblogic server 8.1 on Win2k SP4. The application
is currently up and running under Weblogic. I've added a new EntityBean (along
with the necessarn DB tables, classes, and descriptor file updates). Everything
compiles and the jar file builds. However, when I run the application and attempt
to access the new bean I get the following runtime exception:
javax.ejb.EJBException: Attempt to pass a reference to an EJBLocalObject to a
remote client. A local EJB component may only be accessed by clients co-located
in the same ear or standalone jar file..
javax.ejb.EJBException: Attempt to pass a reference to an EJBLocalObject to a
remote client. A local EJB component may only be accessed by clients co-located
in the same ear or standalone jar file.
at com.jsims.ws.ejbgame.ejb.Metadata_na2102_ELOImpl.writeObject(Ljava.io.ObjectOutputStream;)V(Metadata_na2102_ELOImpl.java:355)
at COM.jrockit.reflect.NativeMethodInvoker.invoke0(ILjava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Native
Method)
where Metadata is the new bean added to the system. Could someone give me a clue
as to how I would start to debug this problem? I've gone over every file and I
can't see any issues.
Thanks in advance.Right, but you're returning a Collection of EJBLocalObjects. That's the
problem.
-- Rob
Bill Beebe wrote:
Rob Woollen <[email protected]> wrote:
It looks like your GameFacade EJB has a remote call trying to return
the
Local Metadata EJBI wish that were true, but it's just returning a Collection. I've attached another
file that includes code snippets of the various classes (from the client to the
EJBs) stripped down to their bare essentials as well as the section in the ejb-jar.xml
file where the ejb is defined.
Here is the home interface class:
package com.jsims.ws.ejbgame.ejb;
import java.util.Collection;
import javax.ejb.EJBLocalHome;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
public interface MetadataHome extends EJBLocalHome
public static final String
JNDI_NAME = "cirrus/ejb/Metadata";
public MetadataLocal create(
String toeId,
String entityName,
Integer count,
String entityType,
Integer parent,
String symbolCode)
throws
CreateException;
public MetadataLocal findByPrimaryKey(MetadataKey primeKey)
throws FinderException;
public Collection findAllUnits()
throws FinderException;
public Collection findUnitEgs(String toeId)
throws FinderException;
public Collection findAllByDomain(String domain)
throws FinderException;
Here is the EJBLocalObject definition:
package com.jsims.ws.ejbgame.ejb;
import javax.ejb.EJBLocalObject;
* The local interface for the Metadata bean.
public interface MetadataLocal extends EJBLocalObject
public String getToeId();
public String getEntityName();
public Integer getCount();
public String getEntityType();
public Integer getParent();
public String getSymbolCode();
Here are the methods defined in GameFacade (and Bean):
public interface GameFacade extends EJBObject
public Collection getUnitsByDomain(String domain)
throws RemoteException;
Here is the implementation in the bean:
public class GameFacadeBean
extends NullEventListener
implements SessionBean
public Collection getUnitsByDomain(String domainName)
Collection
domainUnits = Collections.EMPTY_LIST;
try
domainUnits = metadataHome.findAllByDomain(domainName);
catch(FinderException ex)
ex.printStackTrace();
domainUnits = Collections.EMPTY_LIST;
return domainUnits;
and here is where it is being used on the client:
public TemplateView(int en, Framework fw)
framework = fw;
// Get the GameFacade and perform the query.
Collection
templates =
framework.getGame().getUnitsByDomain(domainName);
Here is the definition in the ejb-jar.xml entry:
<entity>
<display-name>Metadata</display-name>
<ejb-name>Metadata</ejb-name>
<local-home>com.jsims.ws.ejbgame.ejb.MetadataHome</local-home>
<local>com.jsims.ws.ejbgame.ejb.MetadataLocal</local>
<ejb-class>com.jsims.ws.ejbgame.ejb.MetadataBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>com.jsims.ws.ejbgame.ejb.MetadataKey</prim-key-class>
<reentrant>False</reentrant>
<abstract-schema-name>Metadata</abstract-schema-name>
<cmp-field>
<field-name>toeId</field-name>
</cmp-field>
<cmp-field>
<field-name>entityName</field-name>
</cmp-field>
<cmp-field>
<field-name>count</field-name>
</cmp-field>
<cmp-field>
<field-name>entityType</field-name>
</cmp-field>
<cmp-field>
<field-name>parent</field-name>
</cmp-field>
<cmp-field>
<field-name>symbolCode</field-name>
</cmp-field>
<query>
<query-method>
<method-name>findAllUnits</method-name>
<method-params/>
</query-method>
<ejb-ql>SELECT OBJECT(f) FROM Metadata AS f WHERE f.count = 0 OrderBy f.toeId</ejb-ql>
</query>
<query>
<query-method>
<method-name>findUnitEgs</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>SELECT OBJECT(f) FROM Metadata AS f WHERE f.toeId = ?1 AND f.count > 0 OrderBy f.count</ejb-ql>
</query>
<query>
<query-method>
<method-name>findAllByDomain</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>SELECT OBJECT(f) FROM Metadata AS f, TOE as t, ToeTemplateMappings as t2 WHERE f.toeId = t2.toeId AND t2.templateId = t.templateId AND t.domain=?1 and f.count = 0 OrderBy f.toeId</ejb-ql>
</query>
<!--query>
<query-method>
<method-name>findAllUnitKeys</method-name>
<method-params/>
</query-method>
<ejb-ql>SELECT f.toeId FROM Metadata AS f WHERE f.count = 0 OrderBy f.toeId</ejb-ql>
</query-->
</entity> -
Javax.ejb.DuplicateKeyException: Exception [EJB - 10007]
Hi,
I am deploying an EJB application in OAS10.1.3.1. (it comes with toplink)
The application executes bean.remove() and removes the bean and then it creates
the same bean again using bean.create() in the same transaction.
When bean.create() executes the following exception is encountered.
Is there any setting in toplink that will help me avoid this situation.
javax.ejb.DuplicateKeyException: Exception [EJB - 10007]: Exception creating bean of type [XXXX]. Bean already exists.
at oracle.toplink.internal.ejb.cmp.EJBExceptionFactory.duplicateKeyException(EJBExceptionFactory.java:195)
at oracle.toplink.internal.ejb.cmp.oc4j.Oc4jPersistenceManager.createBean(Oc4jPersistenceManager.java:163)
at com.evermind.server.ejb.interceptor.system.TopLinkCreateInterceptor.invoke(TopLinkCreateInterceptor.java:51)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:50)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.SecurityRoleInterceptor.invoke(SecurityRoleInterceptor.java:47)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
at com.evermind.server.ejb.AbstractEJBHome.OC4J_invokeMethod(AbstractEJBHome.java:723)Thanks for the response and the direction.
Its Bug No.6713854
Could you please shed some light on toplink flavors and support/fixes.
That is:
1. Is toplink that comes with OAS different than the open source toplink?
2. If so, how are bugs tracked. where should I go and look for the bugs for the open source version?
3. Could we use the open source version for OC4J?
Thanks :) -
I am onto the 3rd day of a nasty problem getting our BCC ProductionAgent unstuck. Unfortunately, a series of direct SQL bad-advice has removed the Project that is causing the problems from the ATGPUB database, but the Agent is convinced it still has deployment work to do and is not allowing me to Cancel the Project and get the ProductionAgent back in line. I would like to know how I can just tell the Agent it is done...delete the Agent entirely...create a new one to take its place....do a Full Deployment on it and get the whole Publishing thing working again.
Currently, when I attempt Cancel the current Deployment from BCC, the ATGPublishing server.log produces long stacktraces like...
<pre>
2012-03-28 19:42:54,056 ERROR [nucleusNamespace.atg.epub.deployment.DeploymentFormHandler] (http-0.0.0.0-8180-1)
CAUGHT AT:
CONTAINER:atg.deployment.common.DeploymentException: ; SOURCE:javax.ejb.ObjectNotFoundException
at atg.deployment.common.ResourceUtil.exception(ResourceUtil.java:373)
</pre>
...if I try instead to "Resume" it, the stacktrace is shorter, but essentially the same...
<pre>
2012-03-28 19:52:23,893 ERROR [nucleusNamespace.atg.epub.DeploymentServer] (Thread-419)
CAUGHT AT:
CONTAINER:atg.deployment.common.DeploymentException: ; SOURCE:javax.ejb.ObjectNotFoundException
at atg.deployment.common.ResourceUtil.exception(ResourceUtil.java:373)
at atg.deployment.server.DeploymentServer.fetchProject(DeploymentServer.java:2259)
at atg.deployment.server.DeploymentServer.fetchProjects(DeploymentServer.java:2286)
at atg.deployment.server.Deployment.verifyParameters(Deployment.java:2260)
at atg.deployment.server.Deployment.run(Deployment.java:1668)
at java.lang.Thread.run(Thread.java:636)
Caused by: javax.ejb.ObjectNotFoundException
at atg.repository.tojava.runtime.RJSupport.executeRqlStatementForOne(RJSupport.java:1103)
at atg.epub.project._ProjectHome_ReposImpl.findById(_ProjectHome_ReposImpl.java:71)
at atg.deployment.server.DeploymentServer.fetchProject(DeploymentServer.java:2252)
... 4 more
</pre>
How can I just make this Agent abandon this deployment attempt and let me Full Deploy on it and get on with my life?
As always, any help is greatly appreciated.That seems to have done the trick. Thanks. Now I'm just waiting for a Full Deployment of the Production instance. I hope this works.
-
Javax.ejb.ObjectNotFoundException: Bean with primary key '555' was not foun
When I delete a particular entity bean instance, i get the following exception:
javax.ejb.ObjectNotFoundException: Bean with primary key '555' was not found by 'findByPrimaryKey'.
But, the instance is being deleted from the database.
Anyone please help,
Thank u,
SeshuGreetings,
When I delete a particular entity bean instance, i get
the following exception:
javax.ejb.ObjectNotFoundException: Bean with primary
key '555' was not found by 'findByPrimaryKey'.Interesting. How is your client calling the bean's remove method? Directly or through its home? Is it calling findByPrimaryKey before or after the call to remove? What is the PrimaryKey class type of your bean? Is the client passing a correct instance? All are things to be considered when troubleshooting your application. If more assistance is required, then seeing the relevant source code would be more helpful.
But, the instance is being deleted from the database.As is generally to be expected. No?
Anyone please help,
Thank u,
SeshuRegards,
Tony "Vee Schade" Cook -
Hi !
I have a little problem. When I deploy my jar file, I have the next message :
"javax.ejb.EJBException: Method is not a known CMP field accessor, CMR field accessor, or ejbSelect method: methodName=compareTo"
Is there someone to tell me why ? ^_^
I didn't put the source code in this topic, not to pollute it, but if you need it, tell me ;)
Thx for your help.Hi Spidey !
Thx for you help but... Giving my method doesn't require the use of EJBQL, I don't think I have to define it in my deployment descriptor (this is not a query)...
I give you an idea of my (experimental ^_^) source code :
public class CountryBean implements EntityBean{
public int compareTo(Country c){
SOP("COMPARE TO");
return 0;
public class MySession implements SessionBean{
public int doIt(){
MyComparator comparator = new MyComparator();
return comparator.compare(country1, country2);
public class MyComparator implements Comparator{
public int compare(Object o1, Object o2){
return compare((Country)o1, (Country)o2);
public int compare(Country c1, Country c2){
SOP("COMPARE");
return c1.compareTo(c2);
When I call doIt(), the message "COMPARE" is written and just after, there's this message (the message "COMPARE TO" is never written):
"11:29:44,204 ERROR [LogInterceptor] TransactionRolledbackException, causedBy:
javax.ejb.EJBException: Method is not a known CMP field accessor, CMR field accessor, or ejbSelect method: methodName=compareTo
at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:110)
at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:59)
at CountryBean$Proxy.compareTo(<generated>)"
I hope this is clear ^__^
Thx for helping me ;)
Maybe you are looking for
-
JPEG subfolder after using "Image Processor" ...
Hi, I use "Photoshop->Image Processor" to resize my photos and I get always a JPEg subfolder in my target dirtory, I don''t want to. In the "Image Processor" I selected the option "Save in Same Location" and under "File Type" the option "Save as JPEG
-
Does Firefox have developer tools for debugging javascript code?
I am learning to write javascript in web pages. I have written some code that does not work as expected. I would like to set break points and check variables as the code executes. Are there add-ons or built-in tools that provide this functionality in
-
Hi Exports, i have dought regarding IR onjects could any one help. What is the Context Objects and External definidions in IR with their usage?
-
Scope of a java class in JSP page
Hi If I use a java bean using the <jsp:useBean id="beanSomeName" scope="page|request|session|applicaton I can specify the scope of of the bean after which I can assume it is Garbage Collected. However if I just create a new Java Class in a jsp bean (
-
LUMIRA: Values disappear in column Chart
Hi Experts, I have been working with Lumira, I am using column Chart, but when I put in the dimension X Axis the Dirección. I cannot see all the values (we have nine directions). These values disappear. If I change the chart to position "Horizontal",