Share persistence.xml file between two EJB modules in EAR

Hello, everybody!
First of all, I would like to say that I already posted this question in another forum:
[http://community.jboss.org/thread/154128?tstart=0]
But as I haven't got any answer from there and this issue is very crucial to me I'm posting it here too in the hope that I get an answer. So, here it goes:
I have two EJB modules in an EAR module. I would like to know how to share a single persistence.xml file with these two EJB modules. If I replicate the persistence.xml file in the two EJB modules, the EAR project deploys ok, but of course that's not what we want. If I remove the persistence.xml file from any of the EJB projects, the EAR doesn't deploy properly. I'm stuck with this. I've already tried many kind of configurations but none worked. I really would like to have some help with this issue to proceed working. This is my EAR structure:
solicitacoes-ejb.jar       (EJB session beans)
solicitacoes-dao.jar       (EJB interfaces)
solicitacoes-dao-jpa.jar   (EJB session beans)
solicitacoes-ejbClient.jar (entities and EJB interfaces)
solicitacoes-web.war
META-INF/This is my application.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<application
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
version="5">
    <display-name>solicitacoes-ear</display-name>
    <module>
        <ejb>solicitacoes-ejb.jar</ejb>
    </module>
    <module>
        <ejb>solicitacoes-dao-jpa.jar</ejb>
    </module>
    <module>
        <web>
            <web-uri>solicitacoes-web.war</web-uri>
            <context-root>solicitacoes</context-root>
        </web>
    </module>
</application>If I remove the persistence.xml file from one of the EJB modules, let's say solicitacoes-dao-jpa.jar, I get this error when deploying the EAR file:
... 39 more
Caused by: java.lang.IllegalArgumentException: Can't find a persistence unit named 'null' in AbstractVFSDeploymentContext@28359170{vfs:///C:/jboss-6.0.0.20100429-M3/server/default/deploy/solicitacoes-ear.ear/solicitacoes-dao-jpa.jar/}
at org.jboss.jpa.resolvers.BasePersistenceUnitDependencyResolver.resolvePersistenceUnitSupplier(BasePersistenceUnitDependencyResolver.java:107) [:1.0.2-alpha-1]
at org.jboss.ejb3.Ejb3Deployment.resolvePersistenceUnitSupplier(Ejb3Deployment.java:778) [:1.3.1]
at org.jboss.ejb3.EJBContainer.resolvePersistenceUnitSupplier(EJBContainer.java:1517) [:1.3.1]
at org.jboss.injection.PersistenceUnitHandler.addPUDependency(PersistenceUnitHandler.java:130) [:1.3.1]
... 43 moreI need help with this issue. As you could see, the EJB container doesn't like to see an EJB module without a persistence.xml file. This is clearly a dumb decision though. I agree with it if there was only one EJB module in an EAR. But the container should have been smart enough to require only one persistence.xml file in an EAR module with more than one EJB module, and share that persistece context with the whole EAR.
Acting the way it is acting now, the container forces us to duplicate the persistece.xml file and kill our application modularity. This is clearly wrong. I've already tried to put the entity classes and persistence.xml file in the lib directory of the EAR, but it didn't work either. The container needs to have the persistence.xml file in both EJB modules.
I don't know if this is a JBoss implementation decision or if it comes from the Java EE 6 specification. Whatever it is, it goes against all good modular and good design decision. Please if some of you know how to solve this, took a little time to tell me how. I would be very grateful.
Thank you in advance.
Marcos

Dear Mr. gimbal2,
In another occasion I would not reply to such a 'helpful' answer like the one you gave me (yes, it is undoubtedly an answer because that's how you classified it in the beginning of your reply), but as today I have plenty of time here in my job, for this week we're not working full time as usual, I decided to reply to it.
You have to completely overhaul your attitude.I really didn't know I was taking so personal on this issue to have to 'completely overhaul my attitude'. Thank you for pointing that out.
In stead of calling the technology dumb, admit to yourself that perhaps you don't understand it properly and that your ideas of what is correct design perhaps is a little lacking. I didn't call the technology dumb because I stated very clearly that I don't know for sure if it is working this way. I said in the last paragraph:
+"I don't know if this is a JBoss implementation decision or if it comes from the Java EE 6 specification. Whatever it is, it goes against all good modular and good design decision."+
So, I let implicit the fact that the technology or the implementation of the technology is dumb only if it doesn't allow this possibility. Regarding the fact that your said that I should
admit to myself that perhaps I don't understand it properly, where did I stated in my question that I understand it completely? It's clear in the last paragraph that I don't. If I'm asking that's because I have doubts. Maybe my ideas of what is correct is wrong, and that's why I'm here in this forum. But everyone with a good sense knows that what I propose in this discussion is by no means a wrong design decision. Where is it a sin to have more than one EJB module in a EAR and a persisntece.xml file shared for the whole EAR? Does everyone that has more than one EJB module in an EAR module need to connect to more than one database? Is it wrong to want to have your DAO implementation in a separate EJB module in order to make deployment easy and also changes, if you later want to replace that implementation with another one without affecting
the other modules? I don't think that a design decision that seeks this is lacking. I don't think that Java EE today is a dumb technoloby, but everyone knows that before it gets to the present level, it was a technology known to have made big dumb decisions that the community latter corrected, with ideas like O/R mapping (Hibernate), dependency injection (Spring), Struts and lots of other examples that we all know. No one can deny this and lots of wrong things will continue to be fixed in later releases.
Maybe when you rise yourself back to that level, you open yourself up again to thinking in correct solutions in stead of trying to hammer through your own poorly chosen one.To be sincere, I see you took very personal about this issue. You really shows to be someone that has no respect to other people and you judge them too. I must say that I got surprised by the way you answered my post. I didn't expect to get such sarcastic answer to what I asked. I personally don't act this way. If I can't help a person, I also don't try to ridicularize him.
Marcos

Similar Messages

  • How to write multiple ejb-jar.xml file in an ejb module

    i am developing an ejb project. I hav a number of entity beans and session beans and their mapping in ejb-jar.xml. As the number of beans increases the entry of beans and mapping is also increasing. So i want to ask u that is there any mechanism so that i can divide the ejb-jar.xml file so that it will be easy to maintain it.

    ejb-jar is the smallest composable unit for related EJB components. Your best bet is to create multiple ejb-jars and package them within the same enterprise application (.ear).

  • Serialize DOM between two ejb's performance

    Hi,
    I am working with XML in a ejb container and I used JDOM Document (org.jdom.Document) to send the xml document between two ejb's, I picked JDOM because the Document implements the Serilizable interface. Then I did some performance tests on sending JDOM between two ejb's. I also did tests on sending a String rep. of the XML between the same ejb's. The result supprised me very much.
    Here is the testing code:
    // init
    dom.loadFromPath("C:\\booklist.xml");
    String xml = dom.getXML();
    org.jdom.Document doc = db.build(dom.queryDocument());
    // ... ejb lookup etc...
    // ejb test
    long start2 = System.currentTimeMillis();
    for ( int i = 0 ; i < 1000; i ++ )
    test.jdomTest(doc); // jdom doccument
    long end2 = System.currentTimeMillis();
    // string test...
    long start1 = System.currentTimeMillis();
    for ( int i = 0 ; i < 1000; i ++ )
    test.stringTest(xml); // String
    long end1 = System.currentTimeMillis();
    and the results:
    JDOM: 41703 msek
    String: 313 msek
    Send String and load him into a DOM in the receiving ejb: 5266 msek.
    I have always thought that working with xml on a string format would be to much overhead.
    Could somebody clearify this for me? Does this test results make any sense?
    - thanks, Lubbi Tik

    The serialisation process works at the object level, so to serialise an object you must first serialise every attribute of that object. The specification for serialisation states that every object which wants to be serialisable must have attributes which are primative types (eg int, long etc etc) or attributes which are objects which are serialisable. So to serialise a JDOM you must serialise each of the child nodes in the document, it would be a lot of object manipulation in this example. To serialise a String however, is much easier as it is a much less complex type.
    Cheers,
    Peter.

  • How do I share files between two Macs on my wireless network?

    I have an iMac G4 and an ibook G3 on a wireless network. I have "file sharing" activated on both computers. (Also Appletalk, which may or may not be a misguided move, but I got the idea from OSX "Help.")
    When I try to get from either computer onto the other, my computer is recognized by name (another alternative is to log on as a "guest"). I'm prompted for a password. None of the passwords I use works. I've tried the administrative passwords for both computers.
    How do I get beyond this hurdle to share files? I've posted elsewhere to no avail. This must be an easy one. How do you share files between two macs on one network?

    Do your accounts on the machines have the same short name? It's an issue I've seen a few names.. one machine with bsmith, the other with bobsmith, but the long names for both being "Bob Smith". The login windows would confuse users because it showed their names, but because the short names didn't match, it wouldn't work.
    The password you should use is the administrative one, so I don't know why you're not having luck.

  • Why did I have to enable Windows File Sharing to share files between two Mavericks iMacs?

    File Sharing failed between my Mavericks iMacs.  The console logs showed that the target iMac saw the ntlmv2 protocol as unknown to the kdc.  I fixed it by enabling Windows File Sharing on the target Mavericks iMac.  I had tried disabling SMB on both iMacs and leaving AFP on, but then nothing happened when I tried to connect.  Why did I have to enable Windows File Sharing to share files between two Mavericks iMacs?

    When you enable file sharing you need to have either SMB (Windows) or AFP (historically Apple-native) file sharing checked. The default in Mavericks is SMB, and not AFP.
    If you uncheck both, then the system will turn off file sharing. Apple supports the use of both SMB and AFP connections in Mavericks, so with only AFP enabled you should have been able to establish a connection, but there could be a small bug or configuration-specific snafu that you're encountering.
    With AFP enabled only, try pressing Command-K in the Finder to open the Connect To Server dialogue, and in here enter the address to the system using afp:// as the protocol, such as the following (the name can be looked up in the Sharing system preferences):
    afp://my_imac.local

  • File splitting in EJB module

    Hi,
         I have a EJB module (used in sender file adapter) which takes a flat file as input and then splits the file into multiple files(XML) which needs to be sent to the Integration Engine.
    Is there any method by which I can return multiple XMLs from the same EJB module to the Integration Engine.
    Will writing the return statement from the EJB in a loop do the job?
    Thanks,
    Shiladitya

    Hi Shiladitya !
    Multiple EJB module outputs for the file adapter is not possible. If you need splitting, maybe you could use an external application that does the job and then the XI scenarios picks up the XML files (use the filename to get them in order), or maybe you could "split" your original scenario in 2 scenarios. One scenario, to split the file : File-XI-File and the other one to process the result of the first one : File-XI-Target Adapter.
    In the first scenario you could use the "recordsets per message" parameter of the file adapter sender comm channel, to automatically split the source file in several XML messages.
    Why do you need an EJB module ?
    Regards,
    Matias.

  • Permissions problem copying files between two Macs

    I've run into a strange problem when trying to copy files between two networked Macs. Some background facts: We have two Macs at home each with three accounts. Two of the accounts are regular user accounts (my wife's and mine, call them "K" and "B" for short) and the third is an administrator account (we'll call it "A"). I have a .Mac account, which I use to sync between the two Macs. The other accounts do not. The user accounts B & K were initially set up on the second Mac via the Migration Assistant, copying over files and settings. The administrator account was not.
    The problem I've run into is that if I am logged in as either user B or K on the local Mac, connect to the remote Mac as the corresponding user, and try to copy files into a folder owned by that same user on the remote Mac, I get a series of three dialog boxes with error messages:
    1) "You may need to enter the name and password for an administrator on this computer to change the item named ..." (stop/continue)
    2) "The item ... contains one or more items you do not have permission to read. Do you want to copy the items you are allowed to read?" (stop/continue)
    3) "The operation cannot be completed because you do not have sufficient privileges for some of the items."
    If I go all the way through this hitting continue / OK on each, what shows up on the remote computer at the end is an empty file with the name and filetype of the local file that I was trying to copy, but of zero length.
    This only happens when I'm copying from (local.B -> remote.B) or (local.K -> remote.K). It does not happen if I try any of the other pairwise combinations (assuming that I've authenticated properly): (local.B -> remote.K or remote.A), (local.K -> remote.B or remote.A), (local.A -> remote.B, remote.K or remote.A). It happens regardless of which Mac is local and which is remote.
    I'm a little baffled. I've tried to search for this on Apple Discussions and other forums, but either haven't been using the right keywords or am coming up blank.
    Anyone have any suggestions?
    Thanks,
    Bob

    borbye is correct that this will remedy the problem but there is a way to do it and have your account work. after changing the user UID and group UID to 501 you will have to restart. then when you log on your home folder will still be your default but you will not have any access. Since you are still an admin you can change that. right click on the home folder and select get info click arrow for sharing and permissions. Your old UID account will show up as _unknown delete this user and add your user to it giving yourself read and write privilege. click on the cog on the bottom and select apply to enclosed items. A warning box will appear stating that this process cannot be undone do you wish to proceed? click yes and a status bar will come up. once the bar is gone the process is complete. since you didn't have access to your home folder you cannot save your settings, this is a good thing since your account will not look remotely the same as yours most likely. all you have to do now is logout and then back in. Your account will look as it did before the change with all the access settings and so forth as before the change... minus some permissions due to the overwrite. It's a minor repair to the permissions to some shares considering you will be able to now move files to and these shares without the permissions alert that only creates a 4kb file instead of the real thing. Takes 5 minutes at most. Have fun.

  • How do I share a keychain list between two shared Lion computers

    How do I share a keychain list between two Lion computers; my wife's MacBookPro and my MacPro. We have Airport.

    See answer below. (Note: this is not a question about iTunes Home Sharing so it should have been asked in the Mac OS X Lion forums.)
    For security reasons you can't share keychains like that since each user's keychain is encrypted and protected by the user's password. Sorry, there is no convenient way to share Keychains.
    Now, that being said, the Keychain file is stored in the following directory, ~/Library/Keychains/, and called 'login.keychain. You could conceivably use file sharing, or some other method, to send your 'login.keychain' file to your wife's computer and she could conceivably use the 'Add Keychain…' command to add your keychain to her Keychain app but I think it gets messy doing that. Also, she would need to know your password to access that file but, between spouses, that may be a non-issue.

  • How best to share Numbers spreadsheet usage between two networked Macs?

    I have never really shared files between two users as my wife always had a Windows computer. She recently purchased an iMac and now has Numbers, so we are interested in sharing access to a couple of spreadsheets for household management. I have racked my brain trying to figure out how to share a file like this, expecting to show her how easy it is on a Mac, but so far I am making it look as difficult to figure out as it was for her on a windows network. Needless to say she is not very impressed with me or with file sharing on a Mac!
    I have a iWork numbers spreadsheet I wantto share between myself on my iMac and my wife on her iMac on our local/home network. I tried keeping the file in my Public Folder but that apparently is not designed to allow my wife to make changes to and re-save back to the same location in my public folder.
    So how else can I set this up to allow both my wife and I to acess (at different times, not simultaneously) the file, make changes, and save it back to the same location? I have a family MobileMe account as well as the local networked iMacs, if that is a possible solution.
    I have heard some people talk about the 3rd party tool called DropBox, but I would like to keep to a local/Apple solution if this is possible with Apple hardware/software.
    Thanks in advance to all you gurus for whom this is an easy fix.

    Share the document via DropBox and discuss changes via iwork.com comments.
    Neat idea; I'll check that out later this evening, thanks for the help here.
    For sharing the file it seems there are two preferred methods:
    1. create a file sharing local user account to host the share documents entirely on a local network. Pros: not routed through the internet. Cons: requires entering a user name and password for access. *(Can Keychain remember the shared account login credentials and enter this for you automatically to make this process even easier?)*
    2. Use a dropbox account. Pros: no need to enter login credentials each time. Cons: requires internet access to upload and distribute changes.
    Any other issues to consider between the two options?

  • How can i transfer the xml files between different systems?

    hello
    the appearance of xml enable the inter-communication between differences systems.but
    i don't know how,such as following scinario:
    in the client side,we use the console that is written by using c#,if i finish
    filling the text boxes that are within the console,click the submit button,the
    console will generate a xml format document.i want the other application that
    is written by using jsp and servlet and deployed in weblogic server to receive
    the xml document,then process the document.
    but i don't know how i can transfer the xml files between the two applications
    that is written in different languages? can i use http protocol?
    thanks for any helps!

    Yes, you can use the HTTP protocol as a transport for the XML message, this
    is basically what the HTTP binding for SOAP does. The key is using a
    packaging mechanism that different applications will understand, otherwise
    only your own applications will know how to extract and process the XML
    messages you send between them.
    "zbcong" <[email protected]> wrote in message
    news:3e68318e$[email protected]..
    >
    hello
    the appearance of xml enable the inter-communication between differencessystems.but
    i don't know how,such as following scinario:
    in the client side,we use the console that is written by using c#,if ifinish
    filling the text boxes that are within the console,click the submitbutton,the
    console will generate a xml format document.i want the other applicationthat
    is written by using jsp and servlet and deployed in weblogic server toreceive
    the xml document,then process the document.
    but i don't know how i can transfer the xml files between the twoapplications
    that is written in different languages? can i use http protocol?
    thanks for any helps!

  • How do I share one itunes account between two users on the same computer

    How do I share one itunes account between two users on the same computer without taking up twice as much space on my hard drive?

    You would need to move the itunes folder to a location that both users have permissions to access such as the Shared folder or any folder on the root level of the macintosh HD.
    You can find instructions here http://support.apple.com/kb/HT1203 This method allows you to share the content without sharing the same library.

  • I would like the share an iTunes library between two different accounts on one Mac. How do I do this?

    iTunes no longer works properly (aka at all) while using one of the user accounts set up on my iMac. It does, however, work when logging in under another user account on the same iMac. (if any of you can help me solve this issue that would be perfect). If there is no solution can anyone help with my request to share an iTunes library between two different accounts on one Mac. How do I do this?

    jc_hering wrote:
    that works for anything he purchases after he creates the new account.  What about his current music that currently resides in my itunes library?  How can I get his current music out of my library into his new account/library??  Thanks..
    Copy it to his computer into his iTunes library and authorize his computer with the iTunes account used to purchase them..
    You cannot tranfser items from one iTunes account to another. Purchased items remain part of the iTunes account is was purchased with.
    iTunes account - used to purchase items
    iTunes library - where purchases (and CD RIPs) go on the computer

  • Hello there - how can I share my iTunes library between two users on the same computer? I put the library in a shared folder between both and have selected this library on both as well, but when I update iTunes with music etc it only appears on one?

    Hello there - how can I share my iTunes library between two users on the same computer? I put the library in a shared folder between both and have selected this library on both as well, but when I update iTunes with music etc it only appears on one?

    Thank you Joe - I tried this but it's only showing a teensy amount of music - the stuff on the second users account as opposed to the giagntic library on the 'main' account. I actually went to a Genius Bar and they said that apple doesn't really want you to share music between accounts - parents don't want to hear their kids music etc. Which seemed strange, but it might be the case sadly   Thanks anyway!

  • Can you transfer files between two user accounts on the same macbook pro?

    Can you transfer files between two user accounts on the same MacBook Pro?
    Specifically, I used the Migration Assistant to move music and photos from my old PC to my new MacBook. 
    Somehow, I missed the fact that it was creating a new user account when it was doing this.  So none of music and photos are in the user account I originally set-up.  Instead, all these files are now in a different account.
    I'd like to consolidate all my files on the one user account and delete the other one.
    Is this possible and, if so, how do I do it?
    Thank you.

    you can crop files from one account to another using the Public Dropbox which every user account has.  Log into the user that has the files you want to move, then drag the folder you want to the new users' dropbox:
    I suggest a small scale test on a few files first before moving gigabytes of files.

  • HT204053 how do I share calendars and music between two ID's?

    How do I share calendars and music between two Apple ID's?  We have a Mac Pro and two Iphones.  Currently we utilize one ID between the Iphones in order to sync the calendars and music.

    You can privately share a calendar between devices using different iCloud IDs as explained here: http://help.apple.com/icloud/#mm6b1a8694.  Even if your devices use different IDs for iCloud you can continue to share the same ID for iTunes to share your music and other purchased media.  The ID you use on a device for iCloud does not need to be the same as the ID used for iCloud.

Maybe you are looking for

  • How to convert SQL*Plus reports to SQLDeveloper?

    Hello, I installed Oracle 11g and found that SQLPLUSW.EXE was not there. I have many scripts, reports, developed in SQLPLUS. How can I convert my reports to run in SQL Developer and produce the same nice output? It seems that SQLDev does not support

  • 3 computers 1 MAC address

    ok, only 1 MAC is allowed on my home network however i had changed my MAC address on my ipod and macbook to be the requested address and everything was working perfectly (two computers with the same MAC browsing at the same time) then the airport was

  • Pb block does not exist...

    In a pre_bind ops when the init program calls the sub function to trigger tests It does return me an error [13/Mar/2006:15:06:52 +0000] - ERROR<4187> - PBlock - conn=-1 op=-1 msgId=-1 - Internal error Trying to get a block element but the element ide

  • Convert Adobe form to smart form

    Hi, I have created adobe form. Is it possible to convert that now as smart form? I have seen the migration options for smartforms to adobe form. But please confirm if the reverse is possible and how? Regards, Bhuvana

  • How to share a non-copyrighted collection from ibooks

    I have 25 health education brochures that are non-copyrighted saved on a shelf in ibooks.  I would like to email them as a group to my work colleagues so they have acccess on their ipad but I can't figure out how to do this.  It allows me to send the