Persistence Layer deployed as Optional Package

Environment:
- WebLogic 11g which consequently means EJB 3.0
- Application has 3 modules: Web (referencing EJB and Persistence), EJB (referencing Persistence) and Persistence
Could I deploy my persistence layer as an Optional Package or does it have to be a Shared Library?
The reason I'm asking is that when I try to deploy my EJB module, WLS can't find the persistence unit being inject to it:
Unable to deploy EJB: StocksBean from BLayer-1.0.0-SNAPSHOT.jar: No persistence unit named 'internalAppsPU' is available in scope BLayer-1.0.0-SNAPSHOT.jar. Available persistence units: []
Persistence module is basically a JAR file deployed as an Optional Package with following in its Manifest:
Extension-Name: PersistenceLayer
Implementation-Version: 1.0.0-SNAPSHOT
Specification-Version: 1.6
in EJB's code I have:
@Stateless(name="StocksBean", mappedName="StocksBean")
public class StocksBean implements Stocks {
     @PersistenceContext(unitName = "internalAppsPU")
     private EntityManager em;
and in EJB's JAR file I have:
pLayer-Extension-Name: PersistenceLayer
pLayer-Implementation-Version: 1.0.0-SNAPSHOT
pLayer-Specification-Version: 1.6
I'm deploying these one by one and not as an Application.

Hi Arun,
Thank you so much for taking time and responding. I'm still having the same issue.
You see, I had the exact same problem when my persistence Entities were in the same Jar file as EJBs and I found out the problem was the name of the persistence.xml file (which was "Persistence.xml") and also the version of the namespace used in the XML file which conflicted with version of JPA's spi (version of JPA's spi in JEE1.6 is 1.0 and I was using version 2.0 of the namespace).
However, I got that fixed and now I'm trying to separate the layers (just moved the files around and didn't change the content). Here is what I have so far:
Name of Persistence Layer's JAR file: PLayer.jar
Manifest of Persistence Layer's JAR file:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: bm03043
Build-Jdk: 1.6.0_18
Extension-Name: PersistenceLayer
Implementation-Version: 1.0.0-SNAPSHOT
Specification-Version: 1.6
Name of EJB's JAR file: BLayer-1.0.0-SNAPSHOT.jar
Manifest of EJB's JAR file:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: bm03043
Build-Jdk: 1.6.0_18
Extension-List: PLayer
PLayer-Extension-Name: PersistenceLayer
PLayer-Implementation-Version: 1.0.0-SNAPSHOT
PLayer-Specification-Version: 1.6
I didn't know that Extension-List entry in EJB's jar file should match with the name of Persistence layer's jar file.
As for deployment, I deploy the Player and then EJB.
Appreciate any input.
Edited by: Keibi on Apr 26, 2012 11:30 AM

Similar Messages

  • Restart deployment (.ear) does not load optional package

    Hello everybody,
    In our 10.3.5 WLS domains, we are using optional packages for sharing libraries between applications see [http://docs.oracle.com/cd/E24329_01/web.1211/e24368/libraries.htm|Creating Shared Java EE Libraries and Optional Packages]
    The problem is that if I redeploy the library I have to redeploy the deployment. This issue only happens with the applications packaged as *.ear*. If the application has been deployed as a .war, with restarting the deployment is enough.
    Would be possible to load the referenced library from an *.ear* just restarting the deployment?
    Thanks in advance,
    Luis

    Thanks Vimala,
    I have 1 ear project and 1 web service project.
    Attached my ant output when I run the build.xml.
    C:\wivWorkSpace\wivApp>ant build -Dworkspace=C:/wivWorkSpace
    Buildfile: build.xml
    init.env:
    init.typedefs:
    init:
    build:
    [echo] project.name = wivApp
    init:
    build:
    [echo] wivWS: C:\wivWorkSpace\wivWS\build.xml
    BUILD SUCCESSFUL
    Total time: 23 seconds
    C:\wivWorkSpace\wivApp>ant build -Dworkspace=C:/wivWorkSpace archive
    Buildfile: build.xml
    init.env:
    init.typedefs:
    init:
    build:
    [echo] project.name = wivApp
    init:
    build:
    [echo] wivWS: C:\wivWorkSpace\wivWS\build.xml
    init.env:
    init.typedefs:
    init:
    stage:
    [delete] Deleting directory C:\wivWorkSpace\wivApp\.staging
    [mkdir] Created dir: C:\wivWorkSpace\wivApp\.staging
    [copy] Copying 13 files to C:\wivWorkSpace\wivApp\.staging
    BUILD FAILED
    C:\wivWorkSpace\wivApp\build.xml:192: The following error occurred while executing this line:
    jar:file:/C:/BEAPLA%7e1/WEBLOG%7e1/workshop/lib/wlw-antlib.jar!/com/bea/wlw/antlib/antlib.xml:91: The follow
    ng this line:
    C:\wivWorkSpace\wivApp\build.xml:204: The following error occurred while executing this line:
    Target `stage.to.ear' does not exist in this project.
    Total time: 15 seconds

  • Platform and persistence layer in package setup

    we are attempting to set up packages for MI7, and have come to the stage of
    "5.      Choose the platform and persistence layer you want to generate the setup package for. The package can be created for one platform only."
    However when we select the picklist for the platform and persistence they are empty.  How do we populate this information?
    Thanks
    Marina

    Hi,
    do you already have MI client installation files uploaded to your landscape.
    Each .sda file from mobile contains a description of what the uploaded file is all about, e.g.:
    <?xml version="1.0" encoding="utf-8"?>
    <mobile_component>
         <mcd_namespace/>
         <mcd_name>MOBILEENGINE_AWT</mcd_name>
         <mcd_version>701300</mcd_version>
         <mcd_create_date>20070518</mcd_create_date>
         <mcd_create_time>081314</mcd_create_time>
         <mcd_created_by>SAP</mcd_created_by>
         <mcd_modify_date>00000000</mcd_modify_date>
         <mcd_modify_time>000000</mcd_modify_time>
         <mcd_modified_by></mcd_modified_by>
         <memsd_text>
              <description>
                   <language>D</language>
                   <text>SAP Netweaver Mobile Client</text>
              </description>
              <description>
                   <language>E</language>
                   <text>SAP Netweaver Mobile Client</text>
              </description>
         </memsd_text>
         <memsd_prop>
              <property>
                   <property_type>CLIENT.BUILDNUMBER</property_type>
                   <value>200705180805</value>
              </property>
              <property>
                   <property_type>HOMEPAGE.INVISIBLE</property_type>
                   <value>X</value>
              </property>
              <property>
                   <property_type>PLATFORM</property_type>
                   <value>WINCE</value>
              </property>
              <property>
                   <property_type>RUNTIME</property_type>
                   <value>AWT</value>
              </property>
              <property>
                   <property_type>TYPE</property_type>
                   <value>FRAMEWORK</value>
              </property>
              <property>
                   <property_type>COMPONENT_FILE</property_type>
                   <value>NWM_AWT_WINCE.zip</value>
              </property>
         </memsd_prop>
         <memsd_dep/>
         <memsd_cust>
              <customizing>
                   <cust_attribute>ROLEASSIGNEMENT</cust_attribute>
                   <cust_index>0000000001</cust_index>
                   <attribute_name>DEFAULT</attribute_name>
                   <attribute_value></attribute_value>
              </customizing>
         </memsd_cust>
    </mobile_component>
    You can see the PLATFORM and the RUNTIME tags here, those should be populated to the corresponding backend tables, I guess.
    Cheers
    stefan

  • Weblogic optional package deployment issue

    Hi All,
    I am using WLS 10.3.4. I have an J2EE web application which references a JAR library as an optional package. Here is my definition of JAR file in the library MANIFEST.MF,
    Manifest-Version: 1.0
    Extension-Name: PCGCommon2.0
    Specification-Version: 1.0.0.0
    Implementation-Version: common055jkp
    Here is my definition of JAR file reference in the application MANIFEST.MF,
    Manifest-Version: 1.0
    Extension-List: pcgcommon2
    pcgcommon2-Extension-Name: PCGCommon2.0
    pcgcommon2-Specification-Version: 1.0.0.0
    pcgcommon2-Implementation-Version: common055jkp
    I deployed the JAR library first successfully. Then I tried to deploy the application. It throws me this error as follows,
    +[J2EE:160149]Error while processing library references. Unresolved Optional Package references (in META-INF/MANIFEST.MF): [Extension-Name: PCGCommon2.0, Specification-Version: 1, Implementation-Version: common055jkp , referenced from: /opt/oracle/Oracle/Middleware/user_projects/domains/Pinellas1qDomain/servers/Pinellas1qMS3/tmp/_WL_user/ppa/cwbd0p/war].+
    Can anyone have an idea what I am missing here?
    Thanks in advance,
    -John
    Edited by: john wang on Mar 9, 2011 8:44 AM
    Edited by: john wang on Mar 9, 2011 8:58 AM

    Hi John,
    Please find the working TestCase in the following Location:
    http://middlewaremagic.com/weblogic/?p=231#comment-3144
    I am copying and pasting the README.txt file here which i attached in the TestCase:
    README.txt
    Step1). Make Sure that the Hello.java is compiled properly like following:
    javac -d . Hello.java<font color=red>Actual Trick is Making the JAR using 'M' option..... :) </font><br>
    Step2). The Most important step to Make the "HelloWorld.jar" along with the MANIFEST.MF file which is present inside "HelloWorld\META-INF\MANIFEST.MF"
    Use the below command with *'M'* as a Flag while making JAR file so that the Jar utility will not overrite the MANIFEST.MF on it's own rather it will place our own MANIFEST.MF inside the Jar.
    C:\OptionalPackageDemo\HelloWorld\> jar -cvfM  HelloWorld.jar META-INF\MANIFEST.MF Hello.java com
    Step3). Deploy the HelloWorld.jar and the TestWebApp
    <b><font color=red>NOTE: </font></b> I just now tested the attached TestCase in WLS10.3.0 And it perfectly worked for me. So if it's not working for you in WLS10.3.4 then i would request you to please open a Support Ticket with Oracle WebLogic Support Team because ideally the same test case is supposed to work fine in that version as well.
    Thanks
    Jay SenSharma

  • Design of reusable data persistence layer with single container

    Hi,
    I am designing an 3-tier application using cmp for my data persistence layer (DPL). The customer now wants to run multiple versions of the application on one server using different data sets for each application. One solution I see, but don't like very much, is to add an application ID to each enity bean in my DPL. However, I would rather run multiple DPL's on different databases and reuse my business logic layer and my presentation layer. Has anybody solved this problem or see the obvious solution that I am missing here?
    Thanks a lot,
    Sandigo.

    Hi KPSeal,
    there is absolutely no relation between the different versions of the application. Although I would prefer to run a single business logic layer it is very much an option to have different versions of the entire application. Could you elaborate on how I would achieve these different versions? Would I have to rewrite the deployment descriptors so that each bean can exist twice or would that give me two instances?
    Thanks,
    S.

  • Is there a way to deploy Adobe Air package via Group Policy or SCCM?

    Is there a way to deploy Adobe Air package via Group Policy or SCCM?

    hi,
    I guess you can try the following options
    Remove the all the entry from the TOC of your project or create a new blank TOC and select that while AIR file generation
    Remove the all the entry from the index of your project or create a new blank index and select that while AIR file generation
    Remove the all the entry from the glossary of your project or create a new blank glossary file and select that while AIR file generation
    THis will ensure that TOC/Index/Glossary page is not shown,
    There is no way to hide Favorite or RSS from the AIR Help. Again, you can try looking at the Unipane Template provided in the AIR SSL Dialog.
    Hope this helps
    -Praful Jain

  • Persistence Layer.

    Hi All,
    Currently, the sql query is inside the Business Object in my program. I would like to separate out the query (or persistence part) to a different layer. I need some help in the best way to design this. I like to have a 5 Tier Arch.
    User Interface (JSPs) + Front Side Controller (Servlet) + Business Objects + Back Side Controller (???) + Persistence Layer (???).
    Please help me with how to separate Business Objects from Persistence. This should also support connecting to different databases.
    Manjunath

    Create a new package, design classes that do all your database work( retrieve insert etc. ) in the new package. The requirement is this package should compile without any other classes from Front Side Controller (Servlet) + Business Objects + Back Side Controller (???).
    This package is your Persistence Layer fully decoupled from the rest. Use your judgement in the decoupling.

  • Need for persistence layer?

    I don't know if this is the correct forum but this is my question:
    Me and my colleague build a project that can be deployed on Oracle AS and Tomcat (struts DAO pattern). We have two database both are Oracle, one already exist and the other is a new Oracle DB(both are on different machines). We put db link on the two databases so we can have single queries on the tables of the 2 different DB. We also have web services for stored procedure calls. Now my question is do we need a persistence layer(e.g. Oracle Toplink, hibernate) to access the database object of the two different databases?

    thanks fo the idea ram. im only just confused if i needed the mapping.. in this case DAO is enough.

  • Optional Package class reference at server startup...gives class not found

    I have a enterprise app having a webservice..the webservice (servlet) gets instantiated on server startup…It has reference of a class which is an optional package
    All the manifest entries are correctly added to the ear..manifest.mf..
    When the servlet is initialized at startup.. gives me a class not found error…
    However, the app works fine..this is just a one time error(whenever the app is deployed fresh..)..
    Any help would be appreciated
    Thanks

    I have a enterprise app having a webservice..the webservice (servlet) gets instantiated on server startup…It has reference of a class which is an optional package
    All the manifest entries are correctly added to the ear..manifest.mf..
    When the servlet is initialized at startup.. gives me a class not found error…
    However, the app works fine..this is just a one time error(whenever the app is deployed fresh..)..
    Any help would be appreciated
    Thanks

  • Is it possible to redeploy Optional Package(J2EELibrary)without versioning?

    Currently, I decided to use Optional Package feature for one of our common shared jar file as it is referenced by our multiple applications (ear files). I can understand, how I can deploy multiple version of the optional package in order for the referencing application to use it. I am planning to use this version feature for optional package in our Production Environment. However, my issue is I don't want to use this version feature in our development environment as it involves more work for the developers (overhead on the developers to specify the optional package version in their referencing application). Is there any way I can redeploy optional package in development environment? I can only redeploy only after undeploying all my 6 referencing applications, which is taking more time.

    Does any one have an example to implement Optional Package and versioning it?

  • Optional Package - does it decrease memory size for war

    We have around 10+ war files running within WLS 10.3.4.
    Each of the war files are around 40 megs each.
    I am looking at building a frameworks jar (via Apache Shade) and make that jar an optional package (which includes all my 3rd party frameworks like Spring/CXF/etc).
    By deploying this jar as an optional package, I can cut the size of the war file in half.
    The question is, does this really save the size of the war in memory?
    When I deploy a war with a reference to an optional package, does WLS explode the war, import the optional package, and rebuild the war for deployment so that in the end, it equates to the same size war as if I had never utilized the optional package? The documentation seems to allude to this.
    I want to know (before I do all the work), if decreasing the size of the war by excluding 3rd party libraries into an optional package will actually reduce the size of memory for each war.
    Thanks,
    Jay

    One option is: use the c6/c7/c8 parameters if the INSTALL APDU. Start with a high value and work your way down. That will tell you how much mem you have.
    The other option is to load an applet that allocates a large byte array. Work your way down and when it can successfuly allocate the memory, that's whats available on the card for you to use.
    Third option: Get a 2.2 card and just call the API ! ! !

  • Persistence Layer return convention issue and question - null vs. exception

    I'm writing a position paper on persistence layer query returns. It deals with querying for a single object or a collection of objects and what to do if the object or collection of objects are not found in the database. I've googled many different search terms and have not come up with any authoritative references for this scenario. Do any of you know of any sources that have discussed this before?
    My current logic is that when searching for a single object in a persistence layer that the persistence layer should return a simple null if the object isn't found. If searching for a collection of objects then the PL should return an empty collection object.
    1.
    /** Returns a list of objects that match the non-null fields in the provided example object.
    This will return an empty Collection if no matching objects are found */
    public Collection retrieveByExample(MyBO example);2. /** Returns a business object.  This will return a null if no matching object is found */
    public MyBusObject retrieveById(int aMyBusObjectId);These two methods would not return a "checked or unchecked" exception if the object(s) are not found. I think that they are the simplest to implement and do not break the convention of not using exceptions in non exceptional situations. I don't feel that it is the persistence layer's responsibility to make a business decision on an object's existence being an exception. There are many times where applications search for an object to see if it exists or not and then proceed to create the object or use the object if it exists or doesn't. These two methods also don't force using application layers to catch or throw any declared exceptions.
    Notes on scenario 1: program control flow is simple by using an iterator and hasNext(), if the collection is empty then any code that needs the objects can be skipped.
    Notes on scenario 2: program control flow is simple in this case with a " != null or == null check. If the method returned an uninitialized object instead of null then the calling application would have to have additional business logic to tell whether the object was truly uninitialized or not. I can see the method having a UnexpectedMultipleBusinessObjectsFoundException if more than 1 object is found since the method is looking by primary key, but would this ever happen if searching by primary key. However in a similiar method that searches on non primary key then the UMBOFE would be warrented. Any thoughts?
    Others have brought up some additional scenarios.
    3. /** Returns one and only one business object from persistence with a matching primary id. 
    If one and only one match is not found, null is returned if isLenient is true, otherwise an exception is thrown. */
    public MyBusObject retrieveById(int aMyBusObjectId, boolean isLenient) throws BusinessObjectNotFoundException;I feel this option is bad in that it forces the calling or using application layer to still declare the BusinessObjectNotFoundException. It adds bulk and unneeded complexity to the the code.
    While looking at it I can see that since a caller is searching for exactly 1 object then if the query finds more than one object then a UnexpectedMultipleBusinessObjectsFoundException could be thrown. But I don't believe an NotFoundException is warranted. What are your thoughts?
    Message was edited by:
    smalltalk

    Hibernate (for example) actually does both.
    public Object get(Class clazz, Serializable id) throws HibernateException - "Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. (If the instance, or a proxy for the instance, is already associated with the session, return that instance or proxy.)"
    public Object load(Class theClass, Serializable id) throws HibernateException: "Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists.You should not use this method to determine if an instance exists (use get() instead). Use this only to retrieve an instance that you assume exists, where non-existence would be an actual error."
    Certainly get is the more commonly used of these methods.
    If you are returning something like an array I believe it is always preferable to return a zero length array rather than null to save the extra client code.

  • SSIDB DTUTIL Deployment of single package

    Hi,
    How to deploy single DTUTIL package to an existing package folder, Such as Common which has 200 Packages I want to deploy single package which is changed using DTUTIL as I see we can't deploy single package from SQL Server data tools.
    Need command line, to deploy single package to project folder.
    Regards,
    Navin
    Navin.D http://dnavin.wordpress.com

    Refer the example and storage type option,
    http://msdn.microsoft.com/en-us/library/ms162820(SQL.90).aspx
    http://www.mssqltips.com/sqlservertutorial/215/command-line-deployment-tool-for-ssis-packages/
    Regards, RSingh

  • Weblogic Optional Packages - Permgen Memory Space

    Hi,
    We are packaging some common jars as Optional Packages in weblogic and using them from different EAR files.We know for classes in side the EAR, each classloader creates individual clazz objects in the permgen space.
    For classes inside the Optional packages and which are referenced in multiple EAR,does weblogic create seperate clazz instances in the permgen space for each classloader? If so then it would mean that classes inside the Optional Package will be created multiple times in the permgen space (attributed to different classloaders)
    Any idea on the behaviour will be highly appreciated.Is the situation same with shared libraries ?

    Depends on where your optinal classes are located.
    If you insert them in the system (or server) classloader they will be loaded once, by the system
    classloader. You can use the ${DOMAIN_HOME}/lib directory for this purpose. The jars located in
    this directory will be picked up and added to the end of the server classpath at server startup.
    The jars will be ordered lexically in the classpath.
    If you are using shared libraries, these shared libraries will be merged at runtime with the
    applications referencing them, so they will be local to the application and to my knowledge
    loaded by the classloader of the application and not a separate shared library classloader. Thus
    if you reference the shared library from multiple applications, the shared libraries get merged
    multiple times and loaded multiple times. The reason is that WebLogic uses classloading
    isolation between the deployed applications, so that from a classloading perspective
    other applications do not bother other applications.

  • Referencing an optional package in a jar inside an ear

    UPDATE: We no longer need this as the third-party will change their shared-library ear to a jar for use on other application servers.
    We have no trouble deploying an ear containing a jar as a shared library, and then referencing the classes in it from another application by specifying the appropriate <library-ref> in weblogic-application.xml.
    In some installations, that shared library is not required, and indeed may not be present. In that case, the <library-ref> is unresolved, and the application will not deploy. We would like to avoid having two versions of our application - one with the <library-ref> and one without.
    If we add the Extension-Name property to the manifest of the jar mentioned above, and deploy the jar (not the ear) as a shared library, our application can reference classes in that jar. The problem is that the library ear (containing the jar) comes from a third party, and we cannot extract out the jar. And the "optional package" mechanism does not appear to work for jars within ears. We've specified the Extension-Name from the library ear ( the one from the library jar is not visible) in the Extension-List of the application. There is no complaint that the optional package is unresolved, but accessing the classes gives ClassNotFoundException.
    I did not find any documentation that optional package jars within an ear should be visible to other deployment units, but it seems odd that the third party would package them such that they can only be referenced with the <library-ref> (i.e. on WLS).
    http://download.oracle.com/docs/cd/E12840_01/wls/docs103/programming/libraries.html
    http://java.sun.com/j2ee/verified/packaging.html
    Edited by: mikereiche on Nov 11, 2011 4:34 PM

    The JarInputStream class is used to read the contents of a JAR file from any input stream.
    InputStream input=getResourceAsStream("/input.xml");
    JarInputStream jis
    =new JarInputStream(input);

Maybe you are looking for

  • How to download windows recovery from HP

    i have grub rescue issue , and i want to download windows 7 iso for my pc , i asked microsoft support they told me you have to ask Original Equipment Manufacturer witch is HP in my case , so please can any one help me how to download windows 7 iso ,

  • SQL Developer can't see tnsnames.ora

    Hiya. I hope someone can help with this. I installed Oracle instant client (basic lite) on my new Windows 7 machine (32 bit) - yeah, I know Windows 7 is not supported, but my gut feeling is that this isn't the issue I'm having. I've put my tnsnames.o

  • Follow me on Twitter on a iweb page?

    how can I put a follow me on Twitter on a iweb page?

  • Array to Image at Video Rate

    Hello, I'm using Labview 2010 with SP1 (32-bit) on Windows 7 (64-bit) with NI-RIO 4.0 and a PCIe-7852R FPGA card. I've written a program for the FPGA card that acquires one line of an image (1024 values) from some custom hardware and puts the line in

  • Photoshop and Lightroom old timers

    I have been using Photoshop and Lightroom for years, purchasing upgrades. If I join CC do I have to pay the same as someone new to PS and Lightroom?