[persistence] all work, but can't persist new entity bean
Hi,
I have a FacadeBean which is working fine ... I can contact the BD oracle for retrieving my entity beans, update an entity bean etc...
BUT... I can't create an entity bean :( I don't understand why!!!
With the same code, I can create, list, etc... on OC4J and JBoss but the create method won't work with WebLogic :|
Here is the error present in console:
<09-mars-2007 15 h 03 min 47 s CET> <Error> <EJB> <BEA-010026> <Exception occurr
ed during commit of transaction Name=[EJB be.starapic.test.ejb.MyEntityFacadeBea
n.create(be.starapic.test.ejb.MyEntity)],Xid=BEA1-007A82AF3A953057A4BD(30283302)
,Status=Rolled back. [Reason=weblogic.transaction.internal.AppSetRollbackOnlyExc
eption],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=1,seconds
left=30,XAServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(ServerRes
ourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(state=rolledback,assigned=Ad
minServer),xar=weblogic.jdbc.wrapper.JTSXAResourceImpl@110563c,re-Registered = f
alse),SCInfo[base_domain+AdminServer]=(state=rolledback),properties=({weblogic.t
ransaction.name=[EJB be.starapic.test.ejb.MyEntityFacadeBean.create(be.starapic.
test.ejb.MyEntity)], weblogic.jdbc=t3://192.168.100.188:7001}),OwnerTransactionM
anager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=AdminServer+192.168.
100.188:7001+base_domain+t3+, XAResources={weblogic.jdbc.wrapper.JTSXAResourceIm
pl},NonXAResources={})],CoordinatorURL=AdminServer+192.168.100.188:7001+base_dom
ain+t3+): weblogic.transaction.RollbackException: Unknown reason
at weblogic.transaction.internal.TransactionImpl.throwRollbackException(
TransactionImpl.java:1808)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(Se
rverTransactionImpl.java:333)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
sactionImpl.java:227)
at weblogic.ejb.container.internal.BaseRemoteObject.postInvoke1(BaseRemo
teObject.java:606)
at weblogic.ejb.container.internal.BaseRemoteObject.postInvokeTxRetry(Ba
seRemoteObject.java:426)
at weblogic.ejb.container.internal.StatefulRemoteObject.postInvokeTxRetr
y(StatefulRemoteObject.java:100)
at be.starapic.test.ejb.myentityfacade_opn58i_MyEntityFacadeRemoteImpl.c
reate(myentityfacade_opn58i_MyEntityFacadeRemoteImpl.java:158)
at be.starapic.test.ejb.myentityfacade_opn58i_MyEntityFacadeRemoteImpl_C
BV.create(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(Remote
BusinessIntfProxy.java:42)
at $Proxy152.create(Unknown Source)
at be.starapic.test.web.HelloServlet.doGet(HelloServlet.java:88)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
(StubSecurityHelper.java:226)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
tyHelper.java:124)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
a:283)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
a:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:3334)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
ervletContext.java:2081)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC
ontext.java:1987)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j
ava:1359)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
.>
<09-mars-2007 15 h 03 min 47 s CET> <Error> <HTTP> <BEA-101020> <[weblogic.servl
et.internal.WebAppServletContext@144a314 - appName: 'testDeploy', name: '/testDe
ploy', context-path: '/testDeploy'] Servlet failed with Exception
javax.ejb.EJBException: nested exception is: weblogic.transaction.internal.AppSe
tRollbackOnlyException
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(Remote
BusinessIntfProxy.java:57)
at $Proxy152.create(Unknown Source)
at be.starapic.test.web.HelloServlet.doGet(HelloServlet.java:88)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
Truncated. see log file for complete stacktrace
That say nothing good...
at $Proxy152.create(Unknown Source) is the problem I think but why ...?
Here is the entity bean:
@Entity
@Table(name="table_myentity")
public class MyEntity implements Serializable
private static final long serialVersionUID = -5806278646729410835L;
private int id;
private String name;
private int number;
public void setName(String name) {
this.name = name;
public String getName() {
return name;
public void setNumber(int number) {
this.number = number;
@Column(name="mynumber")
public int getNumber() {
return number;
public void setId(int id) {
this.id = id;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public int getId() {
return id;
May be a problem of auto-generate for the ID...
Here is the facade bean:
@Stateful(name="myentityfacade", mappedName="myentityfacade")
@Remote(MyEntityFacadeRemote.class)
@Local(MyEntityFacadeLocal.class)
public class MyEntityFacadeBean implements MyEntityFacadeRemote, MyEntityFacadeLocal {
@PersistenceContext
private EntityManager em;
public MyEntity create(MyEntity meb) {
em.persist(meb);
return meb;
public void update(MyEntity meb) throws IllegalAccessException {
if (null == em.find(MyEntity.class, meb.getId())) {
throw new IllegalAccessException("Attempt to update a non existing entity");
em.merge(meb);
public void delete(int id) {
MyEntity meb = em.find(MyEntity.class, id);
em.remove(meb);
public void delete(MyEntity meb) {
meb = em.merge(meb);
em.remove(meb);
public MyEntity findById(int id) {
return em.find(MyEntity.class, id);
public List<MyEntity> listAll() {
return em.createQuery("SELECT o FROM MyEntity AS o").getResultList(); //TOPLINK, HIBERNATE
public List<MyEntity> listFiltered(String filter) {
return em.createQuery("SELECT o FROM MyEntity AS o "+filter).getResultList(); //TOPLINK, HIBERNATE
public int getNbMyEntityBean() {
return this.listAll().size();
Sorry for the long post... And finnaly here is the code present in the servlet:
// CREATE
MyEntity meb1 = new MyEntity();
meb1.setName("bbb");
meb1.setNumber(2);
meb1 = remoteMyEntityFacade.create(meb1);
Note that the remoteMyEntityFacade is working, because I can call any other buisness method without crashing the application.. Just the create can't work and so, persistence can't be used :(
Any suggestions ?
There is a problem with generated key
that code won't work:
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public int getId() {
return id;
But, if I remove line "GeneratedValue", it can insert into the BD, once only :s
The ID is set to 0 by default, so I can't add more than one entity :s
Similar Messages
-
Help Xerox c1190 All in one MFP. All working but can not see Scanner
Hi all,
I hope someone can help. I just bought a new Xerox C1190 MFP. I run a small wireless network via airport express b/g and an imac and macbook pro.
I connected the xeroc all in one to the airport by USB
After a long tough search i found the up dated drivers for 10.6.2 and all working fine except for the scanner.
Image ready and the network just cannot see the scanner. No matter what i do. Driving me nuts. No info anywwhere. The singapore xerox people say its an apple problem abd the apple people say its a xerox problem.
Image ready just can not see the scanner but in the print and fax preferences i can see the printer and printer works no problem. The scanner just does not appear connected.
Has anybody got any idea on how to solve this problem?
Also, i read in the manual that you can set up the Xerox by USB AND Ethernet. I thought i could run the printer on USB and set up the scanner to run on as a network IP item. Basically set up the Xerox to run as both USB and Network IP .
My problem is that when it comes to setting up IP address and stuff like that i need step by step instructions. Completely confused about IP addressing and how to set up a network item.
Could anyone please help.
Thanks
JoeReview my post here:
http://h30434.www3.hp.com/t5/Windows-8-Release-Preview/SOLUTION-Get-Win-7-Printer-Drivers-HP-Solutio...
And see if something similar will work for you. -
I have a new ipad and everything works but can't connect to the app store. Itunes works and the wifi seems to be working but i get a blank white screen when i open the appstore. Nothing will load unter the features or charts tab so i cant download any apps. Purchased and updates tab loads fine. Any suggestions?
You would get better response from the iTunes community forum.
Have a nice day! -
I just got a new Mac yesterday and I am trying to connect my Logitech headset for work but can't! I plug it into the USB but nothing pops up and I can't find where I go to look to see if it's connected. HELP!
Ask the Verizon store to exchange your iPhone for a different iPhone 4.
UPDATE - Sure, try ckuan's solution first. Then use mine if that fails.
Message was edited by: sberman -
Hi , just bought a new macbook air. speakers show that they work but can't hear Skype or youtube. Can you help?
Have you checked that they are selected in System Preferences>Sound>Output tab?
If that doesn't help, and although I've never had to use it myself, I've read on here occasionally that launching Audio MIDI Setup in the Utilities folder and messing with the settings in there can sometimes sort out audio problems. -
HT1386 Syncing works but can't hear audio with headphones.
Syncing works but can't hear audio with headphones. Works without headphones though.
Have you tried other headphones?
What does syncing have to do with the problem?
- Try cleaning out/blowing out the headphone jack. Try inserting/removing the plug a dozen times or so.
Try the following to rule out a software problem
- Reset the iPod. Nothing will be lost
Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
least ten seconds, until the Apple logo appears.
- Reset all settings
Go to Settings > General > Reset and tap Reset All Settings.
All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
- Restore from backup
- Restore to factory settings/new iPod.
- Make an appointment at the Genius Bar of an Apple store. Seems you have a bad headphone jack.
Apple Retail Store - Genius Bar
Apple will exchange your iPod for a refurbished one for this price. They do not fix yours.
Apple - iPod Repair price -
While using Illustrator or Photoshop I seem to be hitting a shortcut to lock my key board. Other shortcuts work but can not type anything?
You are planning to do a number of things, so let me first make a suggestion about the overall approach. Instead of: "Before I make a clone of my hard drive I would like to fix this problem so I only have one account with everything in it but I do not know what to move ... or how to safely move it", I would make that clone immediately. And leave it alone until you have completed the reconfiguring and rearrangements you plan to do. This way, if you accidentally do something that needs to be undone, your clone is there with all the originals. By the way, this is the approach I always adopt, whenever I have to do anything drastic with an existing installation.
After all the rearranging etc. of the main drive you just make a new clone that erases the previous one.
The "Deano" account doesn't show up when I go to System Preferences:Accounts. So I assume I must have done something wrong.
This would suggest to me there is only one account, i.e. the principal, or Admin account. Why do you think there is a second account?
Where should I keep all my work files?
You can keep them where ever it is most convenient. As you know, you can create folders within folders, and there is nothing special about the Documents folder. Feel free to ignore it, if that's the way you want to work. You can direct your downloads, the default "save to" locations etc. to the appropriate places, as you work.
Can I create a new place for all my work files and just move them? I know I will have to update linked files within the various software packages but this is not a problem.
By all means.
.. can it be directly on the HD like my Applications folder etc.?
Indeed, yes. Or even on a different hard drive (or partition of the same drive).
And best wishes for the new year, to you too. -
I have digital copies of movies on my itunes at home and used cloud to download on itunes at work but can t find them
Are they gone completely from the computer, or just no longer in the library? Check your movie media folder.
If your'e in the USA you can download some movies a second time, but not all (studio dependent). You should always back up all media. -
Question
When on Facebook (for example), Firefox is not allowing me to open pictures; when using apps, the bottom of the screen is missing so cannot utilize the apps. All working on Safari; just downloaded new Firefox 4, so seems to be a probleCan you attach a screenshot?
*http://en.wikipedia.org/wiki/Screenshot
*https://support.mozilla.org/kb/how-do-i-create-screenshot-my-problem
Use a compressed image type like PNG or JPG to save the screenshot.
See also "Help About".
*Tap the Alt key or press F10 to show the Menu bar.
In current Firefox releases (29 and later) the orange Firefox menu button has been replaced by the three-bar Firefox Menu button at the far right end of the Navigation Toolbar and this button is always visible, whether you have the menu bar visible or hidden<br>A consequence of this location is that you no longer can hide the Navigation Toolbar
*There is a star like button next to the search bar on the Navigation Toolbar to bookmark the current web page and a "Show your bookmarks" button next to it to open the Bookmarks in a drop down menu.<br>You can find "Show All Bookmarks" to open the Bookmarks Manager (Library) at the bottom of this drop-down list
*If you bookmark a page then "Bookmark This Page" in the Bookmarks menu changes to "Edit This Bookmark"
*You can make the title bar visible via the "Title Bar" button at the bottom left in the Customize palette window
It is still possible to have the menu bar visible via the right-click context menu of a toolbar to have menus like the File menu with Print (Ctrl+P) and Print Preview and the Bookmarks menu available.
See also:
*https://support.mozilla.org/kb/how-to-make-new-firefox-look-like-old-firefox
*https://support.mozilla.org/kb/common-questions-after-updating-to-new-firefox
*https://support.mozilla.org/kb/learn-more-about-the-design-of-new-firefox -
Hi,
My Mac info:
Machine Name: Power Mac G5
Machine Model: PowerMac7,3
CPU Type: PowerPC G5 (3.0)
Mail Version 2.1.3 (753.1)
My mail application can send out message but can't receive new e-mail now ? please see attached before my capture screen
and some software(adobe illustrator cs) and applications(terminal) can't run ? please see attached
but in another user account, terminal and illustrator can run.
Please kindly help to check with these problems. Thanks.Verify and Repair disk “Data”
Checking HFS Plus volume.
Checking Extents Overflow file.
Checking Catalog file.
Checking multi-linked files.
Checking Catalog hierarchy.
Checking Extended Attributes file.
Checking volume bitmap.
Checking volume information.
Volume Header needs minor repair
Repairing volume.
Rechecking volume.
Checking HFS Plus volume.
Checking Extents Overflow file.
Checking Catalog file.
Checking multi-linked files.
Checking Catalog hierarchy.
Checking Extended Attributes file.
Checking volume bitmap.
Checking volume information.
The volume Data was repaired successfully.
Mounting Disk
1 HFS volume checked
Repair attempted on 1 volume
1 HFS volume repaired -
Should I use a network switch and plug my Yamaha A/V receiver and Yamaha DVD into it, then into the wireless router? Then the net into the routers net port???
HT4199 I have a Netgear R6300 wireless router and a Yamaha RX-3020 A/V receiver. An app is available to run on an Ipad. I have to reboot every morning to get it all working. Can I just plug cat6 between them, when I do nothing works, please help
-
HT5463 I changed password but can not use new password on phone. Why?
I changed password but can not use new password on phone. Why?
Start with the Settings app
Settings > iTunes and App Store > tap on your Apple ID and then tap on Sign Out
Then sign in with your correct Apple ID and password. -
Cannot Sync my new contacts from I phone 4s to outlook but can sync a new contact from outlook 2010 to iphone.
I could earlier sync both ways
what could the problem beIf your iMac is running 10.9, with contacts and calednar, Maverick is designed to sync those through the icloud
http://support.apple.com/kb/PH12117
" If you use OS X Mavericks v.10.9 or later, your contacts, calendars, and other info are updated on your computers and iOS devices via iCloud." -
Recurring CacheFullException when creating new Entity Bean
Normally I can create new instances of my Entity Bean just fine. However, at some point (whether it's after a rollback or not, I don't yet know), I get a CacheFullException when trying to create a new Entity Bean.
The CacheFullException exception shows a size that increments by one each time this error occurs. The reported size in the exception continually increases way past the max-beans-in-cache amount of 1000. Yet, the Administrator console reports the "Cached beans current count" as zero. So, the cache appears empty, yet every attempt to create a new entity bean fails with a CacheFullException!
I am using Weblogic Server 8.1 SP3, database concurrency strategy, BMP, and Oracle 9i. The Entity Bean's primary key class was generated by EJBGen (primary key is a java long).
Stopping and restarting the Weblogic server fixes the problem temporarily.
Any help would be greatly appreciated.
JimYes, but if objects are equal they should have same
hashCode. If it is not happening, you have a problem.Yes, and equal objects do have the same hash code. Please see below for primary key class implementation as generated by EJBGen 2.16.
There can be a bug in reporting number of beans.OK, are you saying there is a bug that sometimes shows 0 beans in the cache when the cache is actually full? And even if the cache were full, all the beans would have to be involved in transactions for there not to be room for one more new bean in the cache. And I know that there are no other transactions going on, because this is an isolated system that only I am using. Again, Weblogic Server 8.1 SP3.
It is possible if your PKs don't implement
equals/hashCode correctly.They look correct to me. Here is the primary key class implementation as generated by EJBGen 2.16. The primary key is a java long, and I am using CMP (not BMP as I mistakenly reported earlier).
public class StatusPK implements Serializable {
public long statusID;
public StatusPK() {}
public StatusPK(long statusID) {
this.statusID = statusID;
private int m_hashCode = 0;
public int hashCode() {
if(0==m_hashCode) {
m_hashCode = ((int) statusID);
return m_hashCode;
public boolean equals(Object other) {
if(other==this) return true;
if(null==other) return false;
if(other.hashCode() != hashCode()) return false;
try {
StatusPK other2 = (StatusPK) other;
return (this.statusID==other2.statusID)
catch(ClassCastException ex) {
return false;
The only problem I see with this class is if the default constructor (no args) would be called, then the primary key and hashCode would always be zero. However, I'm assuming here that EJBGen knows what it is doing and that the default constructor is never actually used. In addition, I know that all of the beans in the database have valid primary keys, and they were created the same way that eventually continually fails later on.
Thanks...
jereitz -
I can not fine the Entity Bean's advantage than Java Bean?
I can not fine the Entity Bean's advantage than Java Bean,
can you tell me, thanks a lot?I can not fine the Entity Bean's advantage than Java
Bean,
can you tell me, thanks a lot?I think you should read more of the EJB Spec. You'll find your answer there. But mainly with entities you can have the container manage all the lifecyle of the Bean (transactions, caching, creation, etc...). But entities are not only to map columns in the database, they are supposed to have business code. See more by reading the spec.
MSB
Maybe you are looking for
-
Hi, I have 25$ credit of itunes, as i redeemed a 25$ itunes gift card. However whenever i try to buy a song, I can't use the credit because the payment option goes to my sister's credit card account, and I have not updated the security code for her b
-
Laserjet p1102w- can't open HP software for ePrinting
I just bought the P1102w & had no trouble connecting it to my IMac (running OS 10.8.5) and using that connection for printing. However, when I tried to get the ePrint software from HP, problems arose. I received HP_P1100_P1560_P1600_FW_Update but whe
-
Aperture 3 trial version hangs and quits
I downloaded a trial version of Aperture 3 to try it out since I liked the added features. I currently use iPhoto. Everything went fine until I did the iPhoto import. Now, every time I start Aperture, it either hangs and becomes unresponsive, or quit
-
Creating multiple scroling text on one pane
yeah i have been working on this banner im making and i absolutly dislike GUI i have most of the core programing but im having trouble with the GUI i have been using test strings so here is the panel class i have been working on trying to create mult
-
Several of my photos won't import into iphoto. I get a "invalid image" error when I try. The photos open fine in preview and photoshop so I t=don't believe them to be corrupt... I've tried resaving them in case they actually were corrupt, but the ima