Multiple create methods of entity beans in single transcation
Hi,
I have some entity beans with CMR. I am managing these entity beans with a Stateful session bean whose transaction type is Container Managed for all its methods.
In one particular method of this Session bean I am calling two entity bean's create method. i.e I am creating two entity beans through home.create() methods. There are two home.create() methods one after another inside a try catch block.
I want that the entire operation be under just one transcation so i have also given the transaction attribute as Required for all methods of Session bean and Entity Beans.
However if i pass invalid parameters to second create method so that it generates exception then still the first create statement is successful and database is updated.
what i want is that the first create also should be roll backed.
How can i acheive this through Container Managed Transaction Session Bean?
Hi Ashwini,
"Ashwini" <[email protected]> wrote in message news:400291af$[email protected]..
I have some entity beans with CMR. I am managing these entity beans with a Stateful session bean whose transactiontype is Container Managed for all its methods.
>
In one particular method of this Session bean I am calling two entity bean's create method. i.e I am creatingtwo entity beans through home.create() methods. There are two home.create() methods one after another inside a try catch
block.
>
I want that the entire operation be under just one transcation so i have also given the transaction attribute asRequired for all methods of Session bean and Entity Beans.
>
However if i pass invalid parameters to second create method so that it generates exception then still the firstcreate statement is successful and database is updated.
what i want is that the first create also should be roll backed.
How can i acheive this through Container Managed Transaction Session Bean?o Do you use TXDatasource with your entity beans?
o In CMT transactions are automatically rolled back only when RuntimeExceptions
are thrown. What kind of exception is thrown in your case?
Regards,
Slava Imeshev
Similar Messages
-
How to handle multiple tables data in Entity Beans?
How to handle multiple tables data in Entity Beans?
i mean, my bean (non trivial) is responsible for frequent
insertion in one table and some deletion on another table.
Can anyone of you...please..?Is your data model right? If you are adding in one and deleting in another it sounds to me more like a process that an entity, in which case you may revisit your data model and simplify it, add in a session bean with the process method to co-ordinate between the two.
However, if you want to map multiple different tables within a single entity bean it is possible and just part of the mapping. How you actualyl specify it depends on which implementation you are working with.
Cheers,
Peter. -
RE: Consuming and Creating a CMP Entity Bean
Hi There,
I have been trying to find an answer for 1 day. I don't know ehre to look next.
I am creating a CMP entity bean. I have created all the set and get mehtods as abstract functions. I have added a ejbCreate and a matching ejbPostCreate. The class code looks like this.
public abstract class COrderBean implements EntityBean {
protected EntityContext entctx;
//abstract declarations of property accessors
public abstract int getId();
public abstract void setId(int intid);
public abstract String getCustomerID();
public abstract void setCustomerID(String strcustomerid);
public abstract Date getDate();
public abstract void setDate(Date datorder);
public abstract String getNotes();
public abstract void setNotes(String strnotes);
public void ejbActivate() {}
public void ejbPassivate() {}
public void ejbRemove() {}
public void ejbLoad() {}
public void ejbStore() {}
public void setEntityContext(EntityContext context)
entctx = context;
public void unsetEntityContext()
entctx = null;
public COrderPK ejbCreate()
return null;
public COrderPK ejbCreate(int new_id, String new_customerid, Date new_order_date, String new_notes) throws CreateException
setId(new_id);
setCustomerID(new_customerid);
setDate(new_order_date);
setNotes(new_notes);
return new COrderPK(getId());
public void ejbPostCreate(int id, String customerid, Date order_date, String notes) {}
My client code works with both BMP entity beans and session beans. It is shown below. I am working with Sun's Application Server 8.0 and I created the database schema with the capture-schema.exe command.
Properties prps = new Properties();
props.put("javax.rmi.CORBA.UtilClass","com.sun.corba.ee.impl.javax.rmi.CORBA.Util");
props.put("org.omg.CORBA.ORBClass","com.sun.corba.ee.impl.orb.ORBImpl");
props.put("org.omg.CORBA.ORBSingletonClass","com.sun.corba.ee.impl.orb.ORBSingleton");
Context context = new InitialContext(props);
Object obj = context.lookup("corbaname:iiop:localhost:3700#COrderBean");
//Object obj = context.lookup("entitybean.OrderItem");
IOrderHome home = (IOrderHome)PortableRemoteObject.narrow(obj,Class.forName("ctaejb.entitybean.order.IOrderHome"));
//use create
IOrderRemote remote = home.findByPrimaryKey(new COrderPK(1));
System.out.println(remote.getDate().toString());
I am getting the follwing error. Can someone please help. Thanks in advance.
WARNING: "IOP00810257: (MARSHAL) Could not find class"
org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:7987)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1013)
at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:259)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:1989)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2213)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1221)
at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:400)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:330)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:296)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1034)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:879)
at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:255)
at com.sun.corba.ee.spi.servicecontext.UEInfoServiceContext.<init>(UEInfoServiceContext.java:30)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at com.sun.corba.ee.spi.servicecontext.ServiceContextData.makeServiceContext(ServiceContextData.java:114)
at com.sun.corba.ee.spi.servicecontext.ServiceContexts.unmarshal(ServiceContexts.java:195)
at com.sun.corba.ee.spi.servicecontext.ServiceContexts.get(ServiceContexts.java:365)
at com.sun.corba.ee.spi.servicecontext.ServiceContexts.get(ServiceContexts.java:353)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(CorbaClientRequestDispatcherImpl.java:470)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(CorbaClientRequestDispatcherImpl.java:327)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:158)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:129)
at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(Unknown Source)
at ctaejb.entitybean.order._IOrderHome_DynamicStub.findByPrimaryKey(_IOrderHome_DynamicStub.java)
at mainapp.CTestApplication.main(CTestApplication.java:32)
Caused by: java.lang.ClassNotFoundException
... 27 more
org.omg.CORBA.UNKNOWN: vmcid: 0x0 minor code: 0 completed: Maybe
at com.sun.corba.ee.spi.servicecontext.UEInfoServiceContext.<init>(UEInfoServiceContext.java:34)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at com.sun.corba.ee.spi.servicecontext.ServiceContextData.makeServiceContext(ServiceContextData.java:114)
at com.sun.corba.ee.spi.servicecontext.ServiceContexts.unmarshal(ServiceContexts.java:195)
at com.sun.corba.ee.spi.servicecontext.ServiceContexts.get(ServiceContexts.java:365)
at com.sun.corba.ee.spi.servicecontext.ServiceContexts.get(ServiceContexts.java:353)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(CorbaClientRequestDispatcherImpl.java:470)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(CorbaClientRequestDispatcherImpl.java:327)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:158)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:129)
at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(Unknown Source)
at ctaejb.entitybean.order._IOrderHome_DynamicStub.findByPrimaryKey(_IOrderHome_DynamicStub.java)
at mainapp.CTestApplication.main(CTestApplication.java:32)Forget it. All the code works. I didn't know that the Sun App Server required a Persistence Manager to work with CMP entity beans. Once I added the persistence manager, all was OK. Have a good day.
-
Exception when invoking create method on entity ejb's home object
I have a simple entity bean. I am able to get the reference to the entity's home object. But when I run create method on entity's home interface, I get the following exception. The create method takes no arguments as the primary key is Auto-Increment field in MYSQL database. Here is the exception. I am using jdeveloper and embedded OC4J as server.
07/06/22 15:51:15 java.lang.NullPointerException
07/06/22 15:51:15 at EmployeeHome_EntityHomeWrapper2.create(EmployeeHome_EntityHomeWrapper2.java:1168)
07/06/22 15:51:15 at com.pd.EmpAddInput.addEmployee(EmpAddInput.java:64)
07/06/22 15:51:15 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
07/06/22 15:51:15 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
07/06/22 15:51:15 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
07/06/22 15:51:15 at java.lang.reflect.Method.invoke(Method.java:585)
07/06/22 15:51:15 at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
07/06/22 15:51:15 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
07/06/22 15:51:15 at javax.faces.component.UICommand.broadcast(UICommand.java:332)
07/06/22 15:51:15 at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:287)
07/06/22 15:51:15 at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:401)
07/06/22 15:51:15 at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
07/06/22 15:51:15 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
07/06/22 15:51:15 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
07/06/22 15:51:15 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
07/06/22 15:51:15 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:712)
07/06/22 15:51:15 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:369)
07/06/22 15:51:15 at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:865)
07/06/22 15:51:15 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:447)
07/06/22 15:51:15 at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:215)
07/06/22 15:51:15 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)
07/06/22 15:51:15 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)
07/06/22 15:51:15 at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
07/06/22 15:51:15 at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
07/06/22 15:51:15 at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
07/06/22 15:51:15 at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
07/06/22 15:51:15 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
07/06/22 15:51:15 at java.lang.Thread.run(Thread.java:595)
What may be causing this exception.I have solved the problem. It had to do with the autocommit=true feature of the MYSQL connection. However I have ran into another trouble. I am getting the following exception.
java.lang.IllegalStateException: Can not call getPrimaryKey() inside ejbCreate(...) methods, the entity does not have an identity yet, see the EJB 2.0 specification chapter 10.5.4
at com.evermind.server.ejb.EJBUtils.throwGetPrimaryKeyInEJBCreateException(EJBUtils.java:892)
at EmployeeRemote_EntityBeanWrapper0.getPrimaryKey(EmployeeRemote_EntityBeanWrapper0.java:1686)
at EmployeeHome_EntityHomeWrapper2.create(EmployeeHome_EntityHomeWrapper2.java:1055)
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 com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:53)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
java.lang.IllegalStateException: Can not call getPrimaryKey() inside ejbCreate(...) methods, the entity does not have an identity yet, see the EJB 2.0 specification chapter 10.5.4
at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMICall.java:109)
at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:125)
at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:517)
at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:461)
at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
at __Proxy0.create(Unknown Source)
at com.pd.model.EmployeeRemoteClient.main(EmployeeRemoteClient.java:37)
I am not calling getPrimaryKey() in ejbCreate() then why this exception -
how many Finder method in Entity bean i can write ?
look below...
public Account findByPrimaryKey(AccountPK key) throws FinderException,
RemoteException;
public Enumeration findByOwnerName(String name) throws FinderException,
RemoteException;here 2 finder methods are there.......i am asking how much freedom i have ? can write as many as finder method i wish ?
say, findXXXX() ?my problem is on the signature of the find
method.
OK let me ask you some other way.
java DOC says
Each enterprise Bean has a home interface. The home
interface must extend the javax.ejb.EJBHome
interface, and define the enterprise Bean type
specific create and finder methods (session Beans do
not have finders).
look it says " finder methods "....right .
so i want to ask 2 question about this phrase . PLZ
do confirm me whether i am right or wrong.
fact 1. finder methods means you can write
any method name which starts with word find
and ONLY find
Example: findABCD( ) , findEFGH(),
findBLAHBLAH()...any thing starts with find[i]
are called finder methods...others are NOT.
is This fact correct ?
Yes.
fact 2. Is not it Strange that i need to
append some letters after the word find to
get a finder method name !! why not wrting a simple
method name ( say abcdfgrty () instead of
findXXXX() which will do the job ??You can... but it has to be called form a findXXXX() method :)
As such there is no problem in writng a
find_ANY_WORDS_HERE() to get a finder method but
problem is why i need to stick to the word
find and append some words after it
t to get a finder method ? if i had to do it
seriously then whats the role of the container ? how
w it is linking ?Once someone takes the pain of going through the EJB specs, he would not have a problem. Imagine each vendor using his own brains and the developer getting bugged with new features in each AS. EJB specs are flexible enough already :) -
Why there are overloaded create methods in Statful bean?
Hi all,
I have a question ...!
Why there are overloaded create methods for Statefule beans? and why not for Stateless bean?
because any way these create methods are for giving referneces of EJB objects.hence, what is use of overloaded methods in stateful bean?
Thanks in advance.
Regards,
RahulHi Rahul,
Each stateful session bean is tied to a particular client. That means whatever state is passed in during create() is guaranteed
to be available on subsequent invocations. Allowing multiple create methods is a convenience.
For stateless session beans there is no prescribed relationship between the caller and which bean instance is used to handle
an invocation. It wouldn't make sense to allow creation parameters since there would be no guarantee that a subsequent
invocation is handled by an instance containing that particular initialization state.
All of this only applies to the EJB 2.1 and earlier API. Starting in EJB 3.0, there are no longer explicit create() methods.
As you've seen there isn't any benefit to having them in the stateless case. For stateful session beans in EJB 3.0, the
developer can perform initialization by just declaring a particular business method and calling that after first acquiring a
new stateful session bean reference.
--ken -
Creating a Session & Entity bean in Weblogic
Hii javaities
I am new 2 EJB , and i want 2 create a apllication using EJB.
I want 2 create a session , and entity bean in WEblogic.
Can anybody help me i this
Or if u have some good links , plz pass it 2 me.
Thanking in anticipationhttp://java.sun.com/blueprints/corej2eepatterns/Patterns/SessionFacade.html
http://www.oracle.com/technology/sample_code/tech/java/j2ee/designpattern/businesstier/sessionfacade/readme.html
google search for more. -
How to invoke create method within manage bean
Hi experts,
I'm developing Jdeveloper 11.1.2.2.0
I want to call 'create method' of certain veiwobject programmertically within a manage bean.
Pls advice.
Thanks.
Charithimport oracle.adf.model.BindingContext;
import oracle.binding.BindingContainer;
import oracle.binding.OperationBinding;
public class Test
public Test()
public BindingContainer getBindings()
return BindingContext.getCurrent().getCurrentBindingsEntry();
public String cb1_action()
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("CreateInsert");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty())
return null;
return null;
} -
Creating Webservice with entity bean
I am trying to create a webservice(using entity bean). Using ANT i am building
up the .ear file. My source files are placed in a directory (c:\test) . I have
set the path and invoked ANT .In the build.xml file , when it is trying to compile
the ejb classes , it gives me the following error:
ERROR: Error from ejbc: Could not locate bean with ejb-name 'EBankEJBean'
in weblogic-ejb-jar.xml
Can anybody pls help me out !
thanx
arthiWLS 7.0 only supports stateless session bean or a plain java
class as web service.
From your post it seems you have trouble doing ejbc.
You will get better answer if you post this in the ejb
newsgroup.
regards,
-manoj
"arthi" <[email protected]> wrote in message
news:[email protected]..
I am trying to create a webservice(using entity bean). Using ANT i am building
up the .ear file. My source files are placed in a directory (c:\test) . I have
set the path and invoked ANT .In the build.xml file , when it is trying to
compile
the ejb classes , it gives me the following error:
ERROR: Error from ejbc: Could not locate bean with ejb-name 'EBankEJBean'
in weblogic-ejb-jar.xml
Can anybody pls help me out !
thanx
arthi
[att1.html] -
Multiple Database Pooling using Entity Bean
Hi,
Can anyone come across this problem? I have an entity bean (BMP). I want to connect to multiple databases(Oracle, My-SQL, MS-SQL Server). The application is like this. if a request come from the client i have to identify the client request and connect to the database. How to do this. How to connect to get the pool from the connection pooling. Please reply its urgent.
thanks
PremThanks for ur reply.
what the point is i want to identify the client request and send this request to that bean. i have developed 30 cmp beans, if i have to identify i have to change all cmp to bmp, is there any solution to this. -
How to use auto incremented tabe to create a CMP Entity Bean
hi,
I want create a CMP entitybean with an auto incremented table in
Oracel. So I need to know
- how to create a table with an auto-incremented field in oracel and
- how to change the create() method according to that.
I am using Sun studio enterprise for EJB developing.
kaushalyaFor auto increment in Oracle you should use Sequence/Trigger combination.
And useful thread from EJB forum:
http://forum.java.sun.com/thread.jspa?forumID=13&threadID=478783 -
Create empty blob inside create method of entity object
I would like to create an empty blob with this method:
BlobDomain.createEmptyBLOB(java.lang.Object context)
context - an internal framework context.
The problem I've got it is to figure out what is the framework context and how to get one.
thanksJohn,
I did not try with af:popup. But I did try with custom error handler and it worked as if I thought.
To help others I am explaining the steps below:
1. Create the custom error handler(MyErrorHandler.java) class by extending it from oracle.adf.model.binding.DCErrorHandlerImpl. Make sure that your java class contains a no argument constructor.
2. Override reportException() method by sending the arguments to super.report exception()
3. write code to call javascript through Extended Render Service Kit.
4. Open DataBindings.cpx and its property inspector
5. Select the root node of DataBindings.cpx and add your custom error handler class (MyErrorHandler.java) to the attribute "ErrorHandlerClass"
6. Run your code.
Voila!!! It runs great!!!
For more information, check http://docs.oracle.com/cd/E24382_01/web.1112/e16182/validation_model.htm
V. Praveen -
Getting Error while trying to create table using entity beans
This is the output on console.
javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; neste
d exception is: javax.ejb.EJBException: nested exception is: java.sql.SQLExcepti
on: [Oracle][ODBC][Ora]ORA-00942: table or view does not exist
javax.ejb.EJBException: nested exception is: java.sql.SQLException: [Oracle][ODB
C][Ora]ORA-00942: table or view does not exist
java.sql.SQLException: [Oracle][ODBC][Ora]ORA-00942: table or view does not exis
t
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6879)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7036)
at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3104)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedState
ment.java:214)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery(JdbcOdbcPrepared
Statement.java:89)
at com.sun.ejb.persistence.PersistenceManagerImpl.primaryKeyExists(Persi
stenceManagerImpl.java:289)
at com.sun.ejb.persistence.PartitionImpl.afterEjbCreate(PartitionImpl.ja
va:640)
at CallerBean_PM.ejbCreate(CallerBean_PM.java:96)This is the output on console.
javax.ejb.TransactionRolledbackLocalException:
Exception thrown from bean; neste
d exception is: javax.ejb.EJBException: nested
exception is: java.sql.SQLExcepti
on: [Oracle][ODBC][Ora]ORA-00942: table or view does
not exist
javax.ejb.EJBException: nested exception is:Look at what the bolded text is telling you. This could be because:
1. The table/view actually does not exist in the oracle instance that you've connected to
2. OR, the user id that you used to connect to the db does not have the right permissions granted to it. -
Timeout of session / entity bean
Hi all
We are facing "RollbackException: The transaction has been marked for rollback (timed out)" excpetion. please help us in resolving this.
Here is problem description.
Code Description:
Step1: Action class calls Session bean
Step2:Session Bean does three things
A. Reads various value from database and write it to fileOutputStream
B. Generate a Sequence number using Sequence
C. Call create method of Entity Bean by local reference to insert the created file (in step 2A) in database as blob
As per our observation session bean takes around 20-30 sec in processing 2A and 2B.
But at 2-C, code raises following error
TariffDocumentBlob is the Entity Bean
TariffSessionEJB is the Session Bean
javax.ejb.CreateException: Error creating EntityBean: RollbackException: The transaction has been marked for rollback (timed out)
05/10/24 16:04:01 at TariffDocumentBlobLocalHome_EntityHomeWrapper397.create(TariffDocumentBlobLocalHome_EntityHomeWrapper397.java:1135)
05/10/24 16:04:01 at com.derc.rims.businessservice.businessinterface.TariffSessionEJBBean.createTariffBlobMasterRecord(TariffSessionEJBBean.java:102)
05/10/24 16:04:01 at com.derc.rims.businessservice.businessinterface.TariffSessionEJBBean.uploadTariff(TariffSessionEJBBean.java:76)
05/10/24 16:04:01 at TariffSessionEJBLocal_StatelessSessionBeanWrapper96.uploadTariff(TariffSessionEJBLocal_StatelessSessionBeanWrapper96.java:80)
05/10/24 16:04:01 at com.derc.rims.businessservice.businessinterface.BISessionFacadeEJBBean.delegate(BISessionFacadeEJBBean.java:534)
05/10/24 16:04:01 at BISessionFacadeEJB_StatelessSessionBeanWrapper4.delegate(BISessionFacadeEJB_StatelessSessionBeanWrapper4.java:101)
05/10/24 16:04:01 at com.derc.rims.action.tariff.CalculateTariffAction.execute(CalculateTariffAction.java:75)
05/10/24 16:04:01 at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
05/10/24 16:04:01 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
05/10/24 16:04:01 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1485)05/10/24 16:04:01 at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:527)05/10/24 16:04:01 at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)05/10/24 16:04:01 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)05/10/24 16:04:01
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)05/10/24 16:04:01 at
oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)05/10/24 16:04:01 at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:649)05/10/24 16:04:01 at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)05/10/24 16:04:01 TRANSACTION OVER05/10/24
16:04:01 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
05/10/24 16:04:01 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
05/10/24 16:04:01 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
05/10/24 16:04:01 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
05/10/24 16:04:01 at java.lang.Thread.run(Thread.java:534)
com.evermind.server.rmi.OrionRemoteException: Transaction was rolled back: timed out at
BISessionFacadeEJB_StatelessSessionBeanWrapper4.delegate(BISessionFacadeEJB_StatelessSessionBeanWrapper4.java:159)
at com.derc.rims.action.tariff.CalculateTariffAction.execute(CalculateTariffAction.java:75)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1485)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:527)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:649)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)
Nested exception is:java.rmi.RemoteException: No Exception - originate from:java.lang.Exception: No Exception - originate from:; nested exception is:
java.lang.Exception: No Exception - originate from: at com.evermind.server.ejb.EJBUtils.makeException(EJBUtils.java:931)
at BISessionFacadeEJB_StatelessSessionBeanWrapper4.delegate(BISessionFacadeEJB_StatelessSessionBeanWrapper4.java:159)
at com.derc.rims.action.tariff.CalculateTariffAction.execute(CalculateTariffAction.java:75)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1485)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:527)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:649)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.Exception: No Exception - originate from: at com.evermind.server.ejb.EJBUtils.makeException(EJBUtils.java:930)
... 17 more
We have tried out .....
- Making new Enity Bean
- changing timeout of session bean by changing it in properties
<session-deployment name="TariffSessionEJB" timeout="300" >
We are using Oracle 10g application Sever and Oracle 10.1 database.Assuming you are using either 9.0.4 or 10.1.2, please note that default transaction time out is 30s and you can change that <transaction-config> element in server.xml. This is specified in millliseconds
-Debu -
Calling Stateful & Statless Methods from the same Entity Bean[EJB2.0]?
Dear All,
We using EJB2.0........
Regarding segregation of stateless and stateful methods..These methods are defined in Session bean.Now my question is
Is it a good practice to call Stateful and Stateless business methods from same single entity bean("EntityBean") defined at program level by extending MainBean..
The architecture is like
public class EntityBean extends MainBean
Public Methodxyz
stfobj.MakeConn();
stlobj.getXyz();
stfobj.CloseConn();
Public Class MainBean{lookup("stl");lookup(stf) ;stl_obj=home.create;stf_obj=home.create()............}
ejb-jar.xml
{ <session>
<description>Entity Bean Employee Example</description>
<ejb-name>stl</ejb-name>
<local-home>com.packg.stlHome</local-home>
<local>com.packg.stl</local>
<ejb-class>com.packg.stlBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
<session>
<description>Entity Bean Employee Example for stateful</description>
<ejb-name>stf</ejb-name>
<local-home>com.packg.stfHome</local-home>
<local>com.packg.ejbeans.stf</local>
<ejb-class>com.packg.stfBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
</session>
<session>
<description>Session bean for System Parameters</description>
<ejb-name>SysParam</ejb-name>
<local-home>com.packg.Home</local-home>
<local>com.packg.Param</local>
<ejb-class>com.packg.Bean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<ejb-local-ref>
<ejb-ref-name>stl</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.packg.stlHome</local-home>
<local>com.packg.ejbeans.stl</local>
<ejb-link>stl</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>stf</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.packg.stfHome</local-home>
<local>com.packg.stf</local>
<ejb-link>stf</ejb-link>
</ejb-local-ref>
</session>
Thanks !!
Edited by: user9052593 on Jun 18, 2012 2:20 AM
Edited by: user9052593 on Jun 18, 2012 2:25 AMAll Business logic resides in session beans[Stateful or Stateless]..For stateful beans we are opening connections in entity bean ,calling business methods and closing connection in entity bean itself..Problem is
I am doing lookup for stateful and stateless both since both objects are called by extending MainBean in same entity bean else will give null pointer exception..
So whenever i call a Stateful or Stateless method from entity bean Which ultimately extends/calling MainBean and thereby calling home.create methods of stateful and stateless both..creating objects..Is this way fine or it will affect the performance?
Do i need to segregate the Calls/invokation to Stateful / Stateless methods at entity bean level too..
For ex:- Whenever i call Methodxyz() method ..at the same time it create 2 objects as its extending MainBean...i want to extend/create 1 object either of stateful or stateless one for stateful and stateless methods call respectively..
See the code in entity bean is like
public class EntityBean extends MainBean
Public Methodxyz
stfobj.MakeConn(); call to stateful method defined in stateful bean
stlobj.getXyz();// call to stateless method defined in stateless bean
stfobj.CloseConn(); call to stateful method defined in stateful bean
------------------------------------------------------------
Maybe you are looking for
-
Error while creating a view and creating navigation link
Hi, i created one view with one button and on click of button it has to navigate to DeleteOperationview.This is the exception i am getting while running. can u plz tell me where the problem might beee... com.sap.tc.webdynpro.services.exceptions.Creat
-
when you go to do this it say that your iPod or whichever device will no longer be backed up to the computer it is currently backed up to, what exactly does that mean? Will i not be able to sync my iPod from that computer? Please help me and answer e
-
Error embedding a .pdf in Microsoft Word
I am using MS Word 2013 on Windows 7. I have Adobe Acrobat XI Pro installed as well, which is set as the default reader for .pdf files on my machine. (I also have Adobe Reader XI installed). When I attempt to embed a .pdf file as an object inside o
-
Files combined as a portfolio in Acrobat Pro corrupted when I send them
I have had an issue with combining files into a portfolio that has to include plans created in ArchiCAD which I have exported in Pdf form. When I combine these Pdf plans with others in Acrobat XI Pro, they look fine, but as soon as I send the file, i
-
2007 iMac, OS X 10.9.3, Boot Camp, Windows 8.1 OS X and Windows were working just fine together. Then I partitioned the OS X drive into two using the OS X Disk Utility, so I would end up with HD, HD 2, and Windows. Unfortunately now when I boot up th