Get row id after EJB create method.
Hi,
does any one know how to get an id of new created by CMP ejb row? When I create new object it's id is 0, when i call ejb create it creates new row in DB and crates new ID by increasing the old one, but how can I get this new ID after create has finished?
Now I have to look equals by some fields object in DB after creation, looks ugly.
So here is my CMP :
* @ejb.bean name="Dividend"
* type="CMP"
* view-type="local"
* primkey-field="id"
* schema="dividends"
* cmp-version="2.x"
* @ejb.value-object name="Dividend"
* match="*"
* @ejb.transaction type="Required"
* @ejb.persistence table-name="dividends"
* @ejb.finder signature="Collection findAll()"
* query="SELECT OBJECT(d) FROM dividends d"
* @jboss.query signature="Collection findAll()"
* @ejb.finder signature="Dividend findByActivityId(java.lang.Integer activityId)"
* query="SELECT OBJECT(d) FROM dividends d WHERE d.activityId = ?1"
* @jboss.query signature="Dividend findByActivityId(java.lang.Integer activityId)"
* strategy="on-load"
* @jboss.persistence create-table="false"
* remove-table="false"
* datasource="java:/ChronimDS"
* datasource-mapping="mySQL"
public abstract class DividendBean implements EntityBean {
//~ Methods ----------------------------------------------------------------
//==========================================
// Business methods
//==========================================
* @ejb.interface-method
public Dividend getDividend() {
Dividend dividend = new Dividend();
dividend.setId(this.getId());
dividend.setActivityId(this.getActivityId());
dividend.setLower(this.getIsLower());
dividend.setLowerAmount(this.getLowerAmount());
return dividend;
* @ejb.interface-method
public void setDividend(Dividend dividend) {
this.setActivityId(dividend.getActivityId());
this.setIsLower(dividend.isLower());
this.setLowerAmount(dividend.getLowerAmount());
//==========================================
// CMP fields
//==========================================
* @ejb.pk-field
* @ejb.persistence column-name="id"
* jdbc-type="INTEGER"
* sql-type="INTEGER"
* @ejb.interface-method
* @ejb.transaction type="NotSupported"
public abstract Integer getId();
public abstract void setId(Integer id);
* @ejb.persistence column-name="activityId"
* jdbc-type="INTEGER"
* sql-type="INTEGER"
public abstract Integer getActivityId();
public abstract void setActivityId(Integer activityId);
* @ejb.persistence column-name="isLower"
* jdbc-type="TINYINT"
* sql-type="TINYINT"
public abstract boolean getIsLower();
public abstract void setIsLower(boolean isLower);
* @ejb.persistence column-name="lowerAmount"
* jdbc-type="INTEGER"
* sql-type="INTEGER"
public abstract Integer getLowerAmount();
public abstract void setLowerAmount(Integer lowerAmount);
//==========================================
// EJB callbacks
//==========================================
* @ejb.create-method
public Integer ejbCreate(Dividend dividend)
throws CreateException {
this.setId(dividend.getId());
this.setIsLower(dividend.isLower());
this.setLowerAmount(dividend.getLowerAmount());
this.setActivityId(dividend.getActivityId());
return null;
public void ejbPostCreate(Dividend dividend)
throws CreateException {
// EntityBean (empty) implementation
public void setEntityContext(javax.ejb.EntityContext ec) {
public void unsetEntityContext() {
public void ejbLoad() {
public void ejbStore() {
public void ejbActivate() {
public void ejbPassivate() {
public void ejbRemove() {
As you can see I'm using xdoclets.
Suppose I need to create new row of this object :
Dividend d = new Dividend();
// fill dividend by values here but do not set it's id it is 0 before creation
// SQL server will set it automaticly
Object ref = context.lookup("DividendLocal");
DividendLocalHome dividendLocal = (DividendLocalHome) ref;
dividendLocal.create(dividend)
I create new row of dividend in my DB and want to get an ID of the new created row, I thought that dividend object will get this ID after creation automaticly, but no, his id is 0.
so here id will be 0 :
dividendLocal.create(dividend);
int id = dividend.getId(); // 0
and if I write this
dividendLocal.create(dividend).getId();
I get :
2007-06-25 14:44:02,384 ERROR [org.jboss.ejb.plugins.LogInterceptor]
EJBException in method: public abstract java.lang.Integer
com.xxx.xxx.ejb.SessionFacade.createDividend(
xxx.xxx.model.Contract) throws java.rmi.RemoteException:
javax.ejb.NoSuchObjectLocalException: Entity not found: primaryKey=0
Similar Messages
-
Getting error while calling ejb business methods from servlet
Hi
Iam getting error when i try to call a ejb method from servlet.Error is
"com.netscape.server.eb.UncheckedException: unchecked exception nested exception is:java.lang.NullPointerException".
I build the application and deployed it successfully.Iam using IAS 6.O with windows NT 4.0.
This is just a method which takes values from database and return as an array of bean to servlet.
Any help on this.Thanks ShankHi
I was using the session bean.Your suggestion helped me a lot.Perfect.
I debug my program and found that from ejbCreate()exception is getting.
I was getting the datasource object thro ejb create() initialisation.
Somehow the look up jndi which i mentioned was not interpretting from ejb-jar.xml ias-ejb-jar.xml and datasource ref .Due to this iam getting jndi Namenotfound exception which in turns to null pointer as datasource is getting null.
when i hardcoded in the ejb the the jndi name for datasource it is working fine.Bit worried all the existing ejbs working with the xml referenced datasource and jndi,but when i added a new ejb with same properties it is failing to get the jndi name.
Piece of code from ias-ejb-jar.xml
<resource-ref>
<res-ref-name>myDataSource</res-ref-name>
<jndi-name>jdbc/nb/myData</jndi-name>
</resource-ref>
Piece of code from ejb-jar.xml
<resource-ref>
<res-ref-name>myDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Thanks a lot meka -
I have question related ejb create method.
hi pals
i'm rookie about ejb.
so i have a lot of wonders.
i saw create method in ejb stateful session bean.
but the create method have parameter like this "create(john)"
the parameter "john" is not used in session bean.
I really wonder parameter "john" s role.
i'll expect reply. thanks for reading.
P.S)when i delete this parameter in source, there were errors
of course, i modified everyting related parameter "john".
but there were errors still~The bean developer writes the create method for a Stateful Session Bean, so it's up to the developer
to decide which (if any) parameters are needed at creation time. If a particular parameter is not used
in the body of the ejbCreate method, that's a developer oversight. It's no different than writing any other
plain Java method that ignores one of its parameters. It's not a fatal error but it's probably indicative of
a mistake in the bean logic. All the EJB container cares about is that the signature of the create method
in the Home/LocalHome interface matches a corresponding ejbCreate method in the bean class.
--ken -
Getting row information after an ALV sort
I am using cl_gui_alv_grid. My problem occurs after a user sorts the table. All of the index values no longer match to the original table I passed to the class. How do I match the results from
CALL METHOD my_catlistgrid->get_selected_rows
IMPORTING
et_index_rows = selected_rows.
to my original itab?Let me be more specific. I have an object that is handling the events double_click(), I have a button on the APP toolbar that will end up calling any or all of the following methods.
CALL METHOD my_catlistgrid->get_selected_rows
IMPORTING
et_index_rows = selected_rows.
CALL METHOD my_catlistgrid->get_selected_cells_id
IMPORTING
ET_CELLS = selected_cells_id.
CALL METHOD my_catlistgrid->get_selected_cells
IMPORTING
ET_CELL = selected_cells.
Each of this methid returns to me the index(position) of the selected row in the ALVgrid. After a sort in the ALV grid, row 1 does not relate to row 1 in the itab I passed to the ALV grid anymore. -
Setting transaction attributes for EJB Create methods
Dear developers
How do I set transaction attributes at the method level. I am able to set this only at the bean level.
I am trying to use container managed transactions.
Thanks
Naveenif you specify * in the <method-name> element, then it is the bean
otherwise, you can specify a particular method name in the <method-name> element.
Best regards...
Dear developers
How do I set transaction attributes at the method
level. I am able to set this only at the bean level.
I am trying to use container managed transactions.
Thanks
Naveen -
COM Exception when using DocumentSet.Create() method
I am trying to create a Document Set in a library that's in a different site collection from the one the user is logged in to (and where the code is executing), and I'm getting the following error:
Stack Trace:
[COMException (0x81070e97): <nativehr>0x80004005</nativehr><nativestack></nativestack>Updates are currently disallowed on GET requests. To allow updates on a GET, set the 'AllowUnsafeUpdates' property on SPWeb.]
Microsoft.SharePoint.Library.SPRequestInternalClass.UpdateFileOrFolderProperties(String bstrWebUrl, String bstrWebRelativeUrl, Object varProperties, Int32 fMigrationSemantics, Int32 fReGhost, Byte& piLevel) +0
Microsoft.SharePoint.Library.SPRequest.UpdateFileOrFolderProperties(String bstrWebUrl, String bstrWebRelativeUrl, Object varProperties, Int32 fMigrationSemantics, Int32 fReGhost, Byte& piLevel) +170
[SPException: Updates are currently disallowed on GET requests. To allow updates on a GET, set the 'AllowUnsafeUpdates' property on SPWeb.]
AIR_Shared_Elements.NewContentFolderRedirect.NewContentFolderRedirect.OnLoad(EventArgs e) +1743
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
Even though this exception gets thrown by the DocumentSet.Create() method, a document set with the correct name is created in the right place. It just doesn't have the correct properties, and it looks to me by the stack trace that what SharePoint is
choking on is the part of the process where it updates the properties of the newly created document set.
Now, the exception says I need to allow unsafe updates on the web, but that's already happening. I'm running the code with elevated privileges, and allowing unsafe updates on the remote web that is the parent web to the list where I'm trying to
create the document set.
Here is some pseudo code showing the process:
protected void MoveContentFolder()
try
SPSecurity.RunWithElevatedPrivileges(delegate
// reach into the other site collection
using (SPSite site = SPContext.Current.Site.WebApplication.Sites["other/sitecollection/url"])
using (SPWeb remoteWeb = site.OpenWeb())
remoteWeb.AllowUnsafeUpdates = true;
// find the document library we want
SPList remoteLib = remoteWeb.Lists[libraryName];
if (remoteLib != null)
// get a reference to the library's root folder where we want to put the document set
SPFolder libraryRoot = remoteLib.RootFolder;
// get the library's local copy of the doc set's content type ID
SPContentTypeId docLibMatchId = GetCTypeIdFromList(myDocSetCTypeParentID, remoteLib);
// set properties and name parameters for the Create() method
System.Collections.Hashtable properties = some_properties;
string name = "a name";
// create the doc set in the remote library
DocumentSet newDocSet = DocumentSet.Create(libraryRoot, name, docLibMatchId, properties, false);
// return to a different page
Page.Response.Redirect("some/other/url"));
else
throw new ArgumentNullException("remoteLib", "The document library specified could not be found.");
remoteWeb.AllowUnsafeUpdates = false; }
catch (Exception ex)
throw ex;
So does anyone know what's going on here? Why is an exception being thrown that says I need to allow unsafe updates when I already am allowing unsafe updates? Why is part of the document set creation process working, but the part where the doc
set item's properties are being set fails?
Thanks!Hi Dylan,
While creating a DocumentSet from code, SharePoint need to UpdateFileOrFolderProperties by calling COM. In the call, SharePoint may need to update some settings. But these updates are not allowed from Get request. That is why the issue happens.
Based on my experience, the issue generally happens when updating HttpThrottleSettings. Update HttpThrottleSettings from a web request(GET) is not allowed.
In this case, you can check from the ULS log, if there is error related to HttpThrottleSettings when "Updates are currently disallowed on GET requests. " happened. If so, please execute the following PowerShell from SharePoint 2010 Management Shell at first:
$web = get-spwebapplication http://nameofproblemwebapp
$web.HttpThrottleSettings
$web.Update()
If you have any more questions, please feel free to ask.
Thanks,
Jinchun Chen
Jinchun Chen
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff AT microsoft.com(Please replace AT with @) -
Creating new row right after popup opens (JBO-35007 because of trigger)
Hi,
I have the same popup (with an ADF form) to add and to edit data. But i have two buttons which displays this popup - Add new and Edit, Edit works OK, on add, i insert new record like this:
DCIteratorBinding dciter =
(DCIteratorBinding)bindingContainer.get(iterator);
ViewObject view = dciter.getViewObject();
Row newRow = view.createRow();
view.insertRow(newRow);
view.setCurrentRow(newRow);before popup is open. And it adds a new record. But the record has id -10 (or some other negative number). This -10 is shown on calling page (the page from which the popup is open) in ADF ReadOnly table as -10 as id and other cells in row empty. That shouldn't happen (se bellow why). User then edits empty form in popup, and commits - then i get JBO-35007 because -10 changed to 123 - because of trigger.
I tried to requery - it doesn't help, see Refresh after pop-up window closes.
Can you suggest a solution on how to create a row right after popup opens?
Also,
i create new record on button's LaunchListener method. This method seems to execute before popup is open and so it affects the calling page also. I think the problem would be solved if new row would be created after popup is opened, not while opening it. (clicking create in popup works fine)in my real case, i usually don't show ids; but to simplify debugging, i created test project where i show as many things as possible.
you mean, creating new record like following?
bindings.getOperationBinding("Create").execute();I don't use that because i don't get empty fields in popup window (although new record is created). Actually, i don't know how to set this created record to be selected one. Suggestions?
And I did some more testing, if I create new record with clicking on Create (not creating new row automatically), i get JBO-35007 only if there was selected any other than the first row in table.
and i tried to move create method binding in pagedef, so it's the first one.. But it seems like there is no effect.
btw, i found this in one of examples on web:
<invokeAction Binds="Execute"
id="refreshTableViewObjectAfterAddingNewApp"
Refresh="prepareModel"
RefreshCondition="#{processScope.addedNewApp}" />refresh condition must be true when adding new row and false for everything else. I'm not sure what that does, but it seems to work... :)
I really shouldn't use the same View Objects in popup and 'master' page, should I? -
How to get the previous state of my data after issuing coomit method
How to get the previous state of some date after issuing commit method in entity bean (It should not use any offline storage )
>
Is there any way to get the state apart from using
offline storage ?As I said the caller keeps a copy in memory.
Naturally if it is no longer in memory then that is a problem.
>
and also what do you mean by auditlog?
You keep track of every change to the database by keeping the old data. There are three ways:
1. Each table has a version number/delete flag for each record. A record is never updated nor deleted. Instead a new record is created with a new version number and with the new data.
2. Each table has a duplicate table which has all of the same columns. When the first table is modified the old data is moved to the duplicate table.
3. A single table is used which has columns for 'table', 'field', 'data' and 'activity' (update, delete). When a change is made in any table then this table is updated. This is generally of limited useability due to the difficulty in recovering the data.
All of the above can have a user id, timestamp, and/or additional information which is relevant to the data being changed.
Note that ALL of this is persisted storage.
I am not sure what this really has to do with "offline storage" unless you are using that term to refer to backed up data which is not readily available. -
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 -
60 Second Delays in Client Getting Entity Bean (after finder method)
I am running WLS5.1 with SP10. I have a stateless EJB that gets a
read-write BMP entity EJB. My test client that executes the stateless
session bean periodically encounters long delays (60 seconds or more)
when acquiring the entity bean using its finder method. Logging shows
the finder method is executing properly, and typically takes 180 ms to
locate the entity bean; however, from the stateless session beans side,
it appears to take 60 seconds. The test client is only a single thread,
so I know the pool is not depleted, or anything like that. Something
appears to be going haywire with the container.
Does anybody have an idea what might be going on?
Thanks.
GregHi Greg,
On a whim, I tried the same test with the thin driver, and the same
delay occurred. This time, instead of a rollback being at the top ofthe
thread dump stack trace, it was in some other Oracle call, with the
top of the stack trace being a socketreader.are you using MTS? Is the db-server a SMP-box? Which exact patch level
does your Oracle instance have? If yes, can you try to force a dedicated
server connection and see if the problem disappears? I guess for an OCI
connection you will have to edit tnsnames.ora, for a
thin-driver-connection you would have to modify the connect string to
something like this:
jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOS
T=<dnsname>)(PORT=1521)))(CONNECT_DATA=(SID=<your
sid>)(SERVER=DEDICATED))))
There is a bug in 8.1.6.0 which is supposed to be fixed in 8.1.6.3, but
I can still reproduce it in 9i :-(. It makes the MTS-dispatcher hang for
60 seconds if you have an SMP box with low load, so maybe this could be
your problem.
Daniel
-----Original Message-----
From: Greg Crider [mailto:[email protected]]
Posted At: Wednesday, November 28, 2001 8:17 AM
Posted To: ejb
Conversation: 60 Second Delays in Client Getting Entity Bean (after
finder method)
Subject: Re: 60 Second Delays in Client Getting Entity Bean (after
finder method)
My client has been using OCI in production and development
with JTS for
over a year now without a problem. We went to OCI because
there was some
other problem with the thin driver. I'm not sure what the
problem was,
but Oracle acknowledged it, but said it wouldn't be corrected until
Oracle 9i came out. We're still using 8.1.6, so from what I'm
told, we
don't use the thin driver.
On a whim, I tried the same test with the thin driver, and the same
delay occurred. This time, instead of a rollback being at the
top of the
thread dump stack trace, it was in some other Oracle call, with the
top of the stack trace being a socketreader.
Somebody else suggested that there may be a problem with
transactions.
Does this ring a bell? Again, I have a stateless session bean
invoking a
read-write entity bean, invoking a read-only entity bean. From
everything I read, including weblogic docs, I should just rely on my
deployment descriptor to control transactions and stay away from JTA.
Hi Greg,
I remeber long ago there were an issue with jts/oci driver combination
when the connections were opened but never used...
Buy the way, are there any specific reasons to use OCI instead of
thin driver?
"Greg Crider" <[email protected]> wrote in message
news:[email protected]...
I know. That's what I don't get. BTW Slava, I am using the
latest OCI
driver; thanks for the suggestion. I tried tweaking some of the Solaris
kernel settings as relates to TCP, but that didn't clear up the problem
either; however, it did change the frequency. Modifying the retransmit
settings (very small values, sub 1.5 seconds) seemed to make it occur
less frequently.
It seems like its time for me to contact BEA Support and see what they
can turn up. Thanks for the suggestions. If anybody else has an idea,
let me know. I'm betting this is a simple, stupid config problem. I'll
post back here when I find out what's up.
But for some reason WebLogic code called the rollback:
... rollback
at
weblogic.jdbc.common.internal.ConnectionEnv.cleanup(Connection
Env.java:499)
at
weblogic.jdbc.common.internal.ConnectionEnv.destroy(Connection
Env.java:417)
at
weblogic.jdbc.common.internal.ConnectionEnv.destroy(Connection
Env.java:393)
at weblogic.jdbcbase.jts.Connection.close(Connection.java:274)
at weblogic.jdbcbase.jts.Connection.commit(Connection.java:530)
at
weblogic.jdbcbase.jts.TxConnection.commitOnePhase(TxConnection
.java:55)
at
weblogic.jts.internal.CoordinatorImpl.commitSecondPhase(Coordi
natorImpl.java
:484)
at
weblogic.jts.internal.CoordinatorImpl.commit(CoordinatorImpl.java:383)
at weblogic.jts.internal.TxContext.commit(TxContext.java:255)
Slava Imeshev <[email protected]> wrote:
Hi Greg,
Which version of OCI driver do you use? OCI driver proved to be
not that stable as the thin driver. Could you try to download
and to install the latest version of the OCI driver and
let us know
if it helps?
Regards,
Slava Imeshev
[email protected]
"Greg Crider" <[email protected]> wrote in message
news:[email protected]...
Yup, get fresh connection from the db connection pool,
and close it
>when
I'm done. The logs don't indicate that I've ever exhausted the
connection pool.
It's interesting to note these problems are occurring on
Solaris with
Oracle OCI connections. Running the same code under Linux with thin
driver connections works just fine.
Weird. Do you obtain database connection from a
datasource and close
>it
every time
you use it?
Greg Crider <[email protected]> wrote:
Okay, this appears to be the offending thread. As it
turns out, the
>same
behavior as first described in my initial post, is
occurring this
>time
in the
business method of the entity bean, as opposed to the
finder. The
getNextURL() is the business method in this case. I am using BMP, and
the
ejbLoad() and ejbStore() methods are not throwing any
SQLExceptions.
Also, I
don't see anything in the error logs that indicate a
EJB transaction
failure.
This being the case, why would an Oracle rollback be
attempted? Am I
misinterpretting this stack trace?
"ExecuteThread-67" daemon prio=5 tid=0x14e300 nid=0x51 runnable
[0xe7880000..0xe7881a30]
at oracle.jdbc.oci8.OCIDBAccess.do_rollback(Native Method)
at oracle.jdbc.oci8.OCIDBAccess.rollback(OCIDBAccess.java:417)
at
oracle.jdbc.driver.OracleConnection.rollback(OracleConnection.java:510)
at
weblogic.jdbc.common.internal.ConnectionEnv.cleanup(ConnectionEnv.java:4
>99
at
weblogic.jdbc.common.internal.ConnectionEnv.destroy(Conne
ctionEnv.java:4
>17
at
weblogic.jdbc.common.internal.ConnectionEnv.destroy(Conne
ctionEnv.java:3
>93
at weblogic.jdbcbase.jts.Connection.close(Connection.java:274)
at weblogic.jdbcbase.jts.Connection.commit(Connection.java:530)
at
weblogic.jdbcbase.jts.TxConnection.commitOnePhase(TxConnec
tion.java:55)
at
weblogic.jts.internal.CoordinatorImpl.commitSecondPhase(CoordinatorImpl.
>ja
va:484)
at
weblogic.jts.internal.CoordinatorImpl.commit(CoordinatorIm
pl.java:383)
at weblogic.jts.internal.TxContext.commit(TxContext.java:255)
at
weblogic.ejb.internal.StatefulEJBObject.postInvokeOurTx(StatefulEJBObjec
>t.
java:320)
at
weblogic.ejb.internal.BaseEJBObject.postInvoke(BaseEJBObje
ct.java:845)
at
com.pi.speechport.ETO.LoadShare.ETOLoadShareEJBEOImpl.getNextURL(ETOLoad
>Sh
areEJBEOImpl.java:114)
at
com.pi.speechport.ETO.Transcription.ETOTranscriptionBusin
ess.getVendorUR
>L(
ETOTranscriptionBusiness.java:146)
at
com.pi.speechport.ETO.Transcription.ETOTranscriptionBusin
ess.transcribe(
>ET
OTranscriptionBusiness.java:193)
at
com.pi.speechport.ETO.Transcription.ETOTranscriptionEJBEO
Impl.transcribe
>(E
TOTranscriptionEJBEOImpl.java:188)
at
com.pi.speechport.ETO.Transcription.ETOTranscriptionEJBEO
Impl_WLSkel.inv
>ok
e(ETOTranscriptionEJBEOImpl_WLSkel.java:223)
at
weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(B
asicServerObjec
>tA
dapter.java:347)
at
weblogic.rmi.extensions.BasicRequestHandler.handleRequest
(BasicRequestHa
>nd
ler.java:86)
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicEx
ecuteRequest.ja
>va
:15)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
Dimitri Rakitine wrote:
Make a thread dump during these 60 seconds to see
what server is
>doing.
Greg Crider <[email protected]> wrote:
I am running WLS5.1 with SP10. I have a stateless
EJB that gets a
read-write BMP entity EJB. My test client that executes the
stateless
session bean periodically encounters long delays (60
seconds or
>more)
when acquiring the entity bean using its finder
method. Logging
>shows
the finder method is executing properly, and
typically takes 180 ms
>to
locate the entity bean; however, from the stateless
session beans
side,
it appears to take 60 seconds. The test client is
only a single
thread,
so I know the pool is not depleted, or anything like that.
Something
appears to be going haywire with the container.
Does anybody have an idea what might be going on?
Thanks.
Greg
Dimitri
Greg
>__
GREGORY K. CRIDER, Emerging Digital Concepts
Systems Integration/Enterprise Solutions/Web &
Telephony Integration
(e-mail) [email protected]
(web) http://www.EmergingDigital.com
(voicemail) 866-474-4147
(phone) 703-335-0974
(cell) 703-851-5073
(fax) 703-365-0223 -
No security on create() method for EJBs
How do we get a hold on 5.1.1??? We are evaluating the Weblogic for
possible purchase and security is a core functionality in our product
line.... Let me know asap..
Se Hee
"paul a. bauerschmidt" <[email protected]> wrote in message
news:[email protected]..
Good Bug in 5.1.0, it's fixed in 5.1.1.
contact support for more info.
.paul
Leon Wong wrote:
The method permissions for EJB methods do not work for create() methods.
I have used the EJBDeployerTool as well as the ejb-jar.xml file to try
to do this but it just does not work. Any other method in the EJb works
by either method. Also
tried securing all methods but this does not work either.
Thanks,
Leon Wong -
Cant see my new data after ejb 3.0 Facade.create()
I am adding an address using EJB 3.0 Facade.create() method. On a separate page I call another EJB 3.0 customer.getAddressCollection() method, but the collection of addresses still has the old list. It does not have the new address in there. If I log out and back in it still does not show the new address. Only when I start another session can I see the new address.
I am using Sun App Server version 9.0.
Is there some App Server setting or some "flush" or "commit" method I am overlooking?
Here is the relevant code:
// update the database using the Facade EJB
addressFacade.create(address);
customerMaintenanceMessage = "finished adding address";
request.setAttribute("activity","mainPage");
request.setAttribute("customerMaintenanceMessage",customerMaintenanceMessage);
RequestDispatcher disp = getServletContext().getRequestDispatcher("/CustomerMaintenance");
disp.forward(request, response);
//forward to the addressList page:
Customer thisCustomer = customerFacade.find(customerId);
List<Address> addresses = (List)thisCustomer.getAddressCollection();
request.setAttribute("addresses",addresses);
disp = getServletContext().getRequestDispatcher("/AddressList.jsp");
disp.forward(request, response);
// Address List display JSP
List<Address> addresses = (List) request.getAttribute("addresses");
for (Address address : addresses){
//display the address...
}I was able to get a working solution I added the following code right below the addressFacade.create(address) line in the update the database section:
customer.getAddressCollection().add(newAddress);
customerFacade.edit(customer);
Essentially, I had to update the address, the customer addressCollection, AND update the customer entity.
I think this is cumbersome, but maybe it is the price paid for the simplicity of EJB 3.0. -
When I create a new email and start typing, I get an error after two characters
This has been bothering me for months.
When I create a new email and start typing, I get an error after two characters (see below). I thought maybe it was a particular person's contact, or it was because I typed too fast, but it is not. Doesn't matter what email address I use, or how long I wait, the first address errors and I have to erase it and start over. Sometimes I have to try several times.
Very annoying. I am using the latest build of Safari on a Mac.
Any help would be greatly appreciated.
Bryan
<Image Edited for Personal Information>If that new profile works then you can transfer some files from the old profile to that new profile (be careful not to copy corrupted files)
See http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox
See also [[Basic Troubleshooting|#Make_a_new_profile|Basic Troubleshooting: Make a new profile]] -
Not able to create row in HANA via .create or ajax call (oData Services)
Hello Experts,
SYSTEM: AWS (Amazone Cloud with HANA SPS06), tunneling via VPN. My HANA-Studio is rev.70 with the "Kepler" addons. I´m the owner of this Schema and granted the necessary privliegues to the __SYS_REPO User.
The following issues when I try to add a row with SAPUI5 - GUI:
The following code are in the index.controller.js implemented and triggered by a button:
Further to the developer guide (SAPUI5....) there is a create Statement to add rows into the Table in HANA. I tried the following:
//Einfacher Datensatz welcher in die HANA geschrieben werden sollte:
var oModel = new sap.ui.model.odata.ODataModel
("..(censored)../BL_TI/2005/zaginfothek/Opportunities.xsodata", false);
var oEntry = {};
oEntry.id = 7777;
oEntry.LfdNr=1;
oEntry.Customer=2;
oEntry.Thema=3;
oEntry.Leadueber=4;
oEntry.Owner=5;
oEntry.MarketDeveloper=6;
oEntry.ThemenfokusnachBL=7;
oEntry.Industry=8;
oEntry.PDs=9;
oEntry.Revenue=0;
oEntry.Probability=1;
oEntry.ProbableRevenue=2;
oEntry.Start=3;
oEntry.Finish=4;
oEntry.Duration=5;
oEntry.Phase=6;
oEntry.Status=7;
oEntry.ATPDecision=8;
oEntry.Date=9;
oEntry.SupplyChain=0;
oEntry.Technology=1;
oEntry.Region=2;
oEntry.Kontaktquelle=3;
oEntry.CASStatus=4;
oEntry.Angebotsnummer=5;
oEntry.Archiv=6;
oEntry.Angebotabgelegt=7;
oEntry.LeadmeldunganSAP=8;
oEntry.ArtderAnfrage=9;
oEntry.tmstmp= "/Date(1390557603727)/";
//Instantzierung mit Anhang Opportunities
oModel.create('/Opportunities', oEntry, nullfunction(){
alert("Create successful");
},function(e){
for (var property in e.d){
alert(property + "=" + e.d[property] + oEntry + "failed");
I get the following Errormessage:
ERROR: 2014-03-17 12:51:52 The following problem occurred: HTTP request failed501,Not Implemented,<?xml version="1.0" encoding="utf-8" standalone="yes"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><code/><message xml:lang="en-US">Feature not supported.</message></error> -
After this I tried it with an ajax call:
var aUrl = '..(censored)../BL_TI/2005/zaginfothek/Opportunities.xsodata/Opportunities';
//all in one ajax – Statement included and tried to create the row via POST:
jQuery.ajax({
method:'POST',
url: aUrl,
data: {"id": "7778",
"LfdNr" : "1" ,
"Customer" : "2",
"Thema" : "3" ,
"Leadueber" : "4",
"Owner" : "5",
"MarketDeveloper" : "6",
"ThemenfokusnachBL" : "7",
"Industry" : "8",
"PDs" : "9",
"Revenue" : "0",
"Probability" : "1",
"ProbableRevenue" : "2",
"Start" : "3",
"Finish" : "4",
"Duration" : "5",
"Phase" : "6",
"Status" : "7",
"ATPDecision" : "8",
"Date": "9",
"SupplyChain" : "0",
"Technology" : "1",
"Region" : "2",
"Kontaktquelle" : "3",
"CASStatus" : "4",
"Angebotsnummer" : "5",
"Archiv" : "6",
"Angebotabgelegt" : "7",
"LeadmeldunganSAP" : "8",
"ArtderAnfrage" : "9",
"tmstmp": "/Date(1390557603727)/"
contentType: 'application/json',
dataType: 'json',
success: function(e){
alert(e.response + "success");
error: function onErrorCall(jqXHR, textStatus, errorThrown){
alert(jqXHR.status);
alert(aUrl);
sap.ui.commons.MessageBox.show(jqXHR.status,
"ERROR",
"Error in calling Service" );
// return;
The last statement with ajax send me a success message back, but there is still no row added in the HANA.
Has anyone an idea what´s going wrong?
I woulb be happy for any hints, thanks
AndréHi Ben,
well I tried out your code and it works with an small correction of your insert:
save: function(){
var oData = new sap.ui.model.odata.ODataModel('...censored.../BL_TI/2005/TEST_USER/Opportunities.xsodata', true);
// New user panel
// var pnlUser = new sap.ui.commons.Panel({text: "User-Data"});
// var tfUserId = new sap.ui.commons.TextField({placeholder: "User-Id"});
// var tfUserName = new sap.ui.commons.TextField({placeholder: "User-Name"});
// var btnSave = new sap.ui.commons.Button({text: "Save"});
// pnlUser.addContent(tfUserId).addContent(tfUserName).addContent(btnSave);
// btnSave.attachPress(function() {
var entry = {};
entry.ID = "3"; //tfUserId.getValue();
entry.USERNAME = "4"; //tfUserName.getValue();
oData.create('/USER', entry, null,
function() {
alert("Create successful");
function() {
alert("Create failed");
Try to write your id instead of 3 -> "3" That was the only what I´ve changed.
Greetz,
André -
Got javax.transaction.HeuristicMixedException when calling EJB business methods
I have developed two EJBs. One is a stateless session bean,
called InventorySessionBean(JNDI name: Inventory); the other one
is a CMP Entity Bean called InventoryBean(JNDI name:
InventoryBean). The InventoryBean represents the business object
of Inventory. InventoryBean is declared CMT and all methods in
the beans have attribute "Required". The InventorySessionBean is a session facade
which encapsulate the business methods of
InventoryBean. InventorySessionBean is declared CMT and all
methods in the bean have attribute"RequiresNew" The backend
database is Ingres.
I have setup JDBC connection pool, Datasource and Tx Datasource.
There is a client program which invokes InventorySessionBean to get business data
from database.
Actually the InventorySessionBean invokes InventoryBean entity bean to get data
from database.
After I starting up the weblogic server, I ran the client program to get data,
everything works fine.
After a period of time (about 50 minutes ) from starting the WLS server, I reran
the client program.
I got following exceptions:
Exception while commiting Tx : Name=[EJB com.memec.na.mppl.businessobjects.inventory.InventorySessionBean.getPriceAndAvailability(java.lang.String,ja
va.lang.String,java.lang.String,java.lang.String)],Xid=4:916d7da2142a593c(2094524),Status=Committed,HeuristicErrorCode=XA_HEURHAZ,numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds
since begin=3,seconds left=119,ServerResourceInfo[weblogic.jdbc.jts.Connection]=(state=committed,assigned=leiWLS),SCInfo
[leiwang+leiWLS]=(state=committed),properties=({weblogic.transaction.name=[EJBcom.memec.na.mppl.businessobjects.inventory.InventorySessionBean.getPriceAndAvailability(java.lang.String,java.lang.String,java.lang.String,java.lang.String)],
weblogic.jdbc=t3://10.1.129.124:7001}),OwnerTransactionManage
r=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=leiWLS+10.1.129.124:7001+leiwang+,
Resources={})],CoordinatorURL=leiWLS+10.1.129.124:7001+leiwa
ng+); nested exception is:
javax.transaction.HeuristicMixedException: (weblogic.jdbc.jts.Connection,
HeuristicHazard, (javax.transaction.xa.XAException: Error dequeueing
message for statement connection # 23 type S))
java.rmi.RemoteException: Exception while commiting Tx : Name=[EJB com.memec.na.mppl.businessobjects.inventory.InventorySessionBean.getPriceAndAvailab
ility(java.lang.String,java.lang.String,java.lang.String,java.lang.String)],Xid=4:916d7da2142a593c(2094524),Status=Committed,HeuristicErrorCode=XA_HEU
RHAZ,numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=3,seconds left=119,ServerResourceInfo[weblogic.jdbc.jts.Connection]=(state=committe
d,assigned=leiWLS),SCInfo[leiwang+leiWLS]=(state=committed),properties=({weblogic.transaction.name=[EJB
com.memec.na.mppl.businessobjects.inventory.In
ventorySessionBean.getPriceAndAvailability(java.lang.String,java.lang.String,java.lang.String,java.lang.String)],
weblogic.jdbc=t3://10.1.129.124:7001
}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=leiWLS+10.1.129.124:7001+leiwang+,
Resources={})],CoordinatorURL=leiWL
S+10.1.129.124:7001+leiwang+); nested exception is:
javax.transaction.HeuristicMixedException: (weblogic.jdbc.jts.Connection,
HeuristicHazard, (javax.transaction.xa.XAException: Error dequeueing
message for statement connection # 23 type S))
javax.transaction.HeuristicMixedException: (weblogic.jdbc.jts.Connection, HeuristicHazard,
(javax.transaction.xa.XAException: Error dequeueing message
for statement connection # 23 type S))
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:237)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:190)
at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:231)
at com.memec.na.mppl.businessobjects.inventory.InventorySessionBean_9wgxw_EOImpl.getPriceAndAvailability(InventorySessionBean_9wgxw_EOImpl.jav
a:224)
at com.memec.na.mppl.processors.Outbound3A2Processor.getData(Outbound3A2Processor.java:202)
Stop the WLS server and restart it again. Everything works well.
Any comments to this problem would be really appreciated. Thanks.
Hi
I was using the session bean.Your suggestion helped me a lot.Perfect.
I debug my program and found that from ejbCreate()exception is getting.
I was getting the datasource object thro ejb create() initialisation.
Somehow the look up jndi which i mentioned was not interpretting from ejb-jar.xml ias-ejb-jar.xml and datasource ref .Due to this iam getting jndi Namenotfound exception which in turns to null pointer as datasource is getting null.
when i hardcoded in the ejb the the jndi name for datasource it is working fine.Bit worried all the existing ejbs working with the xml referenced datasource and jndi,but when i added a new ejb with same properties it is failing to get the jndi name.
Piece of code from ias-ejb-jar.xml
<resource-ref>
<res-ref-name>myDataSource</res-ref-name>
<jndi-name>jdbc/nb/myData</jndi-name>
</resource-ref>
Piece of code from ejb-jar.xml
<resource-ref>
<res-ref-name>myDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Thanks a lot meka
Maybe you are looking for
-
Hi, I would like to syndicate my source data to 3 remote systems. Could you please help me to how to value map for a field to 3 remote systems. like for the same field Phone if remote system ABC then it should P123 if remote system BCD then it shou
-
Problem of using "org.w3c.dom.Node" class
I try to use removeChild(child) method of "org.w3c.dom.Node" object. it don't work. is it better to do child=null;
-
Hi, Background: I have developed a WAD template with 11 static queries in it. This gets broadcasted every morning automatically. The output format is MHTML. Each query has 15 columns. The maximum number of row in the WAD is 100. Requirement: The mana
-
Loading 0.5 seconds of audio data into a numerical array
Hi everyone, I'm new to Java programming, and I'm trying something a little complicated. I wish to use Java to listen to a microphone or line in port and wait for the input signal to reach positive saturation. When the signal has saturated, I would t
-
Database creation using ant/maven/liqubase
Dear ALL: I am creating the database instance using the ant/maven scripts and following are the things I tried but some how it is not creating the database. I have installed the 64bit oracle 11gR2 on windows 7 and configured the default database (ORC