Externalization and datacache

Hi,
i have a problem with the externalization framework and the datacache:
My persistence class 'A' has a field 'f' of custom type that have
references to other persistent objects.
This field is stored using the externalization framework and my factory
method receives the persistence manager instance associated to the A
instance.
I'm getting an existing instance of A from a new persistence manager (with
the PersistenceManager getObjectById method). When the instance is already
present in the datacache,
the factory method is not called and my field f contains references to
persistent objects associated to another persistence manager (the one i
used when i first access the instance).
It works fine when my instance of A are not already in the datacache since
the factory method is called and the references are retrieved from the
current persistence manager.
Tell me if i miss somthing in the framework or if there is a workaround.
I've tested it with versions 3.0.3 and 3.1rc2. I'm using Kodo in Stateless
Session Beans and get a persistence manager in each bean method as
suggested in the documentation.
Thanks for your help
Laurent Czinczenheim

Well, one solution (if you can call it that) is to just disable data
caching for the class that owns the externalized field:
<class name="XXX">
<extension vendor-name="kodo" key="data-cache" value="false"/>
</class>
Other than that, I can't think of any workarounds.

Similar Messages

  • Externalizable and serializable superclass

    hi!
    i've got al lot of objects that extend jcomponent and i don't want to serialize all the fields of those. so i implemented the externalizable interface, but the superclass is also serialized, why does this happen??? here's a test-class:
    class TestExtOrig implements Serializable
       public String test = "Hi";
    public class TestExt extends TestExtOrig implements Externalizable
       private static final long serialVersionUID = 2494746796557083423L;
       public static void main(String[] args) throws SecurityException, IOException
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          DebugObjectOutputStream dos = new DebugObjectOutputStream(bos);
          dos.writeObject(new TestExt());
          dos.close();
       public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
       public void writeExternal(ObjectOutput out) throws IOException
    }The DebugObjectOutputStream simply extends ObjectOutputStream and prints the called method on StdOut, so that i can see what's really written. Well, here it is:
    writeUTF(org.wimberger.hptoolkit.client.TestExt)
    writeLong(2494746796557083423)
    defaultByte(12)
    writeShort(0)
    writeUTF(org.wimberger.hptoolkit.client.TestExtOrig)
    writeLong(7683992437612625549)
    defaultByte(2)
    writeShort(1)
    defaultByte(76)
    writeUTF(test)The problem with that is that it writes the TestExtOrig class also. How can i avoid that???
    thanks in advance,
    Christoph Wimberger

    Hi Christoph,
    I think the debug you are seeing is when the ObjectOutputStream write the ClassDescriptor to the OutputStream, not the object. I believe this happens the first time an instance of a particular class is written to the ObjectOutputStream.
    Regards,
    Scott

  • Property file should be externalize and outside the archive (say ear) ?

    My team architect is suggesting me to externalize the property files like locale resources (e.g messages.en.properties ), log4j (e.g log.properties) etc .The reason is to avoid recompiling incase of changes to this resources.
    Example tomorrow if something goes wrong in production and we want to enable the debug log,then we can change the property file ,restart the server and we are good.If it was inside the archive file we have to create a brand new
    a brand new archive file ,redeploy it and restart the server again.
    In my entire work experience I never externalized this resources because they are inherent part of the archive file.Hence any changes then recreate the archive file and redeploy.
    The team architect might have some good reason.
    Please advice.
    Thanks
    m

    Manjit wrote:
    My team architect is suggesting me to externalize the property files like locale resources (e.g messages.en.properties ), log4j (e.g log.properties) etc .The reason is to avoid recompiling incase of changes to this resources.
    Example tomorrow if something goes wrong in production and we want to enable the debug log,then we can change the property file ,restart the server and we are good.If it was inside the archive file we have to create a brand new
    a brand new archive file ,redeploy it and restart the server again.
    In my entire work experience I never externalized this resources because they are inherent part of the archive file.Hence any changes then recreate the archive file and redeploy.
    The team architect might have some good reason.
    Please advice.
    Thanks
    mIf the major hurdle is changing log levels dynamically..you could look at http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PropertyConfigurator.html#configureAndWatch%28java.lang.String%29

  • Externalizable and compatibility with existing serialized objects

    I have an object in a db in a serialized state as a result of writeExternal. I want to change the class's writeExternal and readExternal such that a String that should have been serialized is now serialized.
    What is the best practice for supporting existing serialized versions of the class being read by my amended version?
    Should I add to the end of readExternal and writeExternal and catch an IOException in readExternal? Will readExternal even through an IOException if my stream is exhausted? And I guess IOException could be caught for other reasons that stream exhaustion so I should not rely on it being thrown for that reason alone?
    writeExternal(ObjectOutput out)
    out.writeObject(m_1);
    out.writeObject(m_2);
    out.writeObject(m_theNewOne);
    readExternla(ObjectInput in)
    m_1 = (String)in.readObject();
    m_2 = (String)in.readObject();
    try
    m_theNewOne = (String)in.readObject();
    catch (IOException e)
    m_theNewOne = "default value";
    Thanks.

    If your readExternal method tries to data that isn't there it will get a -1 from primitive reads, EOFException from DataInputStream.readXXX methods, or from readObject() calls it will get an OptionalDataException with the eof field set to true.
    See http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/input.html#6014.

  • Externalization and interface

    I would like to have a persistent class that holds interface field
    externalized via custom externalization methods.
    ex: I have a persistent class A.
    class A {
    private IFormat format;
    where IFormat is an interface. I want to store the format field via
    externalization to a string. IFormat implemnation must not be persistent
    object.
    The 'externalizer' extension is set to a method of the interface. The
    'factory' extension is set to a factory static method that instantiates an
    object implementing the IFormat interface.
    It seems externalization mechanism works fine if the field has a precise
    class declared type.
    How can i do ?
    Thanks for your help,
    Laurent

    Patrick, I finally managed to do what i wanted by setting the 'type'
    extension of my interface field to 'java.lang.Object'.
    thank you for your quick reply.
    Laurent
    Patrick Linskey wrote:
    Laurent,
    What error are you seeing when you run your test?
    -Patrick
    Czinczenheim wrote:
    I would like to have a persistent class that holds interface field
    externalized via custom externalization methods.
    ex: I have a persistent class A.
    class A {
    private IFormat format;
    where IFormat is an interface. I want to store the format field via
    externalization to a string. IFormat implemnation must not be persistent
    object.
    The 'externalizer' extension is set to a method of the interface. The
    'factory' extension is set to a factory static method that instantiates an
    object implementing the IFormat interface.
    It seems externalization mechanism works fine if the field has a precise
    class declared type.
    How can i do ?
    Thanks for your help,
    Laurent

  • Serializable and externalizable

    Hi all,
    What is the diffrence between the externalizable and serializable and when do we use each one of them ?
    Thanks in advance
    Harish

    Both are interfaces with Externalizable extending Serializable. However where Serializable is a tagging interface (an interface with no methods to implement) Externalizable contains two methods to implement: readExternal and writeExternal. Use Serializable when you require default serialization (i.e., all non-transient, serializable attributes of a class and it's superclass(es) are serialized). Use Externalizable when you require complete control over the serialization process (i.e., you determine what attributes to serialize and how far up the hiearchical chain to traverse although this can be achieved via the Serializable interface as well by providing implementations of the ObjectInputStream and ObjectOutputStream class's readObject and writeObject methods respectively).

  • Externalize metadata strings does not work

    Hi All,
    We have installed OBIEE 11.1.1.6 with OBIApps 7.9.6.3 and we are trying to apply the spanish localization .
    We follow the steps mentioned here:
    http://docs.oracle.com/cd/E20490_01/bia.7963/e19038/anyinstadmconfiglocalize.htm#i1039838
    but "Externalize metadata strings" is not working properly.
    We did the following:
    - run the import metadata command succesfully (W_LOCALIZED_STRING_G table has the correct data).
    - bounce the services
    - Configure and test the "Externalized Metadata Strings" connection pool
    but the translations does not appears.
    We noted that there is a difference between our RPD and the steps in the guide:
    The guide says:
    +"To externalize metadata strings in the Oracle Business Intelligence repository+
    +1.Stop the Oracle BI Server.+
    +2.Using the Oracle BI Administration Tool in offline mode, open OracleBIAnalyticsApps.rpd.+
    +3.Select the entire Presentation layer and right-click the mouse to display the menu.+
    +*From the pop-up menu, select Externalize Display Names. (A check mark appears next to this option the next time you right-click on the Presentation layer.)*+
    +Unselect the Presentation layer."+
    But in the pop-up menu you can not mark "Externalize Display Names" because you have a sub-menu there: "Generate Custom Names, Disable Externalization and Clear All Externalization Stings"
    Is there some step we are missing?
    Any help will be appreciated
    Thank!

    Problem resolved

  • Writing Objects to file using Externalizable

    Hi,
    I'm trying to write an object to file. My sample code is:
    public class Junk implements Externalizable{
    private static java.util.Random generator = new java.util.Random();
    private int answer;
    private double[] numbers;
    private String thought;
    public Junk(String thought) {
    this.thought = thought;
    answer = 42;
    numbers = new double[3+ generator.nextInt(4)];
    for (int i=0; i<numbers.length; i++) {
    numbers[i] = generator.nextDouble();
    public void writeExternal(ObjectOutput stream) throws java.io.IOException {
    stream.writeInt(answer);
    stream.writeBytes(thought);
    for(int i=0; i< numbers.length; i++) {
    stream.writeDouble(numbers);
    public void readExternal(ObjectInput stream) throws java.io.IOException {
    answer = stream.readInt();
    String thought = stream.readUTF();
    and the class with main() is:
    package MyTest;
    import java.io.*;
    public class SerializeObjects {
    public SerializeObjects() {
    public static void main(String args[]) {
    Junk obj1 = new Junk("A green twig is easily bent.");
    Junk obj2 = new Junk("A little knowledge is a dangerous thing.");
    Junk obj3 = new Junk("Flies light on lean horses.");
    ObjectOutputStream oOut = null;
    FileOutputStream fOut = null;
    try {
    fOut = new FileOutputStream("E:\\FileTest\\test.bin");
    oOut = new ObjectOutputStream(fOut);
    obj1.writeExternal(oOut);
    //obj2.writeExternal(oOut);
    } catch (IOException e) {
    e.printStackTrace(System.err);
    System.exit(1);
    try {
    oOut.flush();
    oOut.close();
    fOut.close();
    } catch(IOException e) {
    e.printStackTrace(System.err);
    System.exit(1);
    The output I get in test.bin contains some junk ascii codes. The only item that is written correctly in the file is the string.
    Is there anyway I can write correct data into a file?
    My output needs to be a readable text format file.
    Can anyone help please?

    obj1.writeExternal(oOut);This should be
    oOut.writeObject(obj1);However,
    The output I get in test.bin contains some junk ascii
    codes. The only item that is written correctly in the
    file is the string.If you don't want 'junk' don't use Externalizable and ObjectOutputStream at all, just use PrintStream/PrintWriter.println().

  • Coherence and XStream

    Is there any built in way to use XStream when serializing pojo's that are not serializable?
         Thanks,
         Zach

    Hi Zach,
         the problem lies in XStream relying on the serialized class not implementing java.io.Externalizable, but using the default serialization algorithm to be able to name child elements properly.
         XmlBean on the other hand implements Externalizable, and uses a serialization format which does not store field names at all (which would not be suppliable at all).
         There are good and bad things in this.
         XStream would most probably be able to serialize and deserialize XmlBean instances, only they would not be pretty printed when in XML format.
         Bad thing is if you rely on the attribute names being there, then you are out of luck. Also using Externalizable ties you to one specific version of the class, since the Externalizable implementation does not cater for different versions (different serialization formats for the same class). Stock Java serialization covers this problem to some degree.
         A possible solution would be to use a super class which does not implement Externalizable but implements ExternalizableLite (this would be used by Coherence but would not be used by xstream). Of course you would have to implement ExternalizableLite as you want.
         You can possibly implement it as delegating to xstream, although it would be much slower then implemented with a binary serialization format.
         Best regards,
         Robert

  • Stupid NPE, passing over RMI, it is externalizable.

    Hi,
    I have an object (ObjectA) which holds a 2 element array of objects (ObjectB). Both objects are externalizable and have the read/writeExternal methods implemented. However when the server side receives the object the array of objects (ObjectB) contains all null values. Anyone any ideas?
    Thanks

    The null pointer exception occurs when I try to access a string in ObjectB. Its actually a 4 element array also. (Dont ask!).
    Code:
            //This is in the writeExternal
            if (objectBInstance!= null && objectBInstance.length > 0) {
                  oo.writeInt(objectBInstance.length);
                  oo.writeInt(objectBInstance[0].length);
                  oo.writeInt(objectBInstance[0][0].length);
                  oo.writeInt(objectBInstance[0][0][0].length);
                  for (int i = 0; i < objectBInstance.length; i++) {
                       for (int j = 0; j < objectBInstance.length; j++) {
                        for (int k = 0; k < objectBInstance[i][j].length; k++) {
                             for (int l = 0; l < objectBInstance[i][j][k].length; l++) {
                                  oo.writeObject(objectBInstance[i][j][k][l]);
         } else {
              oo.writeInt(0);
    //This is in the readExternal
    length = oi.readInt();
         if (length > 0) {
         int length2 = oi.readInt();
    int length3 = oi.readInt();
    int length4 = oi.readInt();
              objectBInstance= new ObjectB[length][length2][length3][length4];
              for (int i = 0; i < length; i++) {
                   for (int j = 0; j < length2; j++) {
                        for (int k = 0; k < length3; k++) {
                             for (int l = 0; l < length4; l++) {
                                  objectBInstance[i][j][k][l] = new ObjectB();
                                  objectBInstance[i][j][k][l] = (ObjectB)oi.readObject();
    Messy i know!
    The read/writeExternal in the objects used in ObjectB are ok too.

  • Difference between externalizable & serializable?

    Can anyone tell me what the difference is between Externalizable and Serializable?

    Externalization is under the full control of the class being externalised. An Externalizable class must serialize itself and its parents. It must also have a means of handling the serialization of sub-classes.
    Serialization only serializes one level of class at a time and super classes have their own indepedent serialization processes.

  • Problem when creating new resource in CMSXDB

    We installed the CMSXDB sample succesfully.
    We can create new users, create new folders; but when adding a documnt (resource) to a folder we get following error.
    For an external document:
    oracle.otnsamples.cmsxdb.exception.CMSAccessException: IOException in FileUploadUitlsjava.io.IOException: java.sql.SQLException: Invalid argument(s) in call
         at oracle.otnsamples.cmsxdb.useraction.FileUploadUtils.(FileUploadUtils.java:89)
         at oracle.otnsamples.cmsxdb.useraction.DataUtils.resource(DataUtils.java:885)
         at NewResource.jspService(_NewResource.java:73)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    If we try the other option (creation on the fly); we get following error:
    oracle.otnsamples.cmsxdb.exception.CMSAccessException: SQLException in createresource in resource method of DataUtils : java.sql.SQLException: SQLException in getCLOB : java.sql.SQLException: Invalid argument(s) in call
         at oracle.otnsamples.cmsxdb.useraction.DataUtils.resource(DataUtils.java:1109)
         at NewResource.jspService(_NewResource.java:73)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379) ...
    Do you have any idea what can be the cause for this error?

    Hi Mark,
    The details of the properties that you have to set in Connection.properties file
    List of properties to be altered (Mandatory)
    DBWebURL=http://incq234a.idc.oracle.com:8080
    The HTTP url where the xdb servlet engine is running
    Format : http://<hostname_where_db_is_installed>:8080
    siteRootPath=/tmp/testsite
    The absolute path under which the files will be generated, once a file is sent for externalization and approved by cmsadmin.
    The file will be generated under ConnParams.siteRoot/<resource_path>.<content_type>
    example: /tmp/testsite/cmshome/news/headlines.html
    List of properties to be altered( Optional )
    [ we recommend that the default values be used and these properties not be altered ]
    DataSourceName=jdbc/CmsdbDS
    Name of the datasource, that was entered in J2EE_HOME/config/data-sources.xml
    DBUsername=cmsadmin
    DBPassword=cmsadmin
    [ if any of the below properties are modified, then the corresponding changes have to done in xdbconfig.xml ]
    CMSServletContextRoot=/OTNCMSServlet
    The context root where the OTNCMSServlet can be accessed. It will be appended with the DBWebURL.i.e
    http://localhost:8080/OTNCMSServlet
    Once the servlet is deployed to XDB and the xdbconfig.xml file updated with the servlet entry. The Servlet can be accessed from the above URL
    TransServletContextRoot =/transformservlet
    The context root where the TransformServlet can be accessed. It will be appended with the DBWebURL.i.e
    http://localhost:8080/transformservlet
    SearchServletContextRoot =/searchservlet
    The context root where the SearchServlet can be accessed. It will be appended with the DBWebURL.i.e
    http://localhost:8080/searchservlet
    We are looking into the resource creation issue, pls update us on wheather you are using the right values for these properties. If you were using any incorrect property values, update it and try deploying and running the app again.
    Regards
    Elango.

  • An error [1130203] occured in Spreadsheet Extractor

    Hello everyone. We have a BSO empty, shell db that is used for reporting. It has multiple partitions to two other ASO db's. A fairly simple Excel Add-in retrieve with ~116 rows and ~186 columns has begun giving users this error (same retrieve used for months). Our Essbase server has 16 GB of RAM. Currently the BSO db cache settings are as follows:
    Cache memory locking: unchecked
    Index Cache setting (KB): 10000
    Data File Cache setting (KB): 32768
    Data Cache setting (KB): 250000
    Index Page Setting (KB): 8
    We just increased the Data Cache setting from 200000 to 250000 to see if that would help, but it did not. Should we just continue bumping that up since we have so much RAM?
    Any ideas?
    Thanks in advance.
    Steve

    Hi Steve,
    I suppose you are using Windows, this problem indicates mainly settings of:
    Datacache and Datacache file
    As you have already tried with increased size of datacache settings now try two options;
    Option 1: Increase Datacache and decrease Datacache file(keep 200000) size both and see the spreadsheet extract
    Option 2: Decrease Datacache and datacache file settings both (from your current settings).
    Thanks
    Focusthread Hyperion Trainer
    [http://focusthread.com/training]

  • PortableRemoteObject ClassLoader problems in pe8.1

    Hi, I'm in the process of porting a Sun Java Application Server 7 to 8.1 PE and I'm running into ClassLoader problems when I make remote calls into the server. The situation is a little odd in that I've exported a PortableRemoteObject from the BootstrapServlet (too many reasons to go into detail, but it all worked in 7 just fine). Most of the calls I make into the remove server work fine, exception I get ClassNotFound exceptions in the strangest places. For example, I have a SearchCriteria class that I pass as a parameter. It makes it to the server. But, its inner class, Constraint which is static and Serializable, gets a ClassNotFoundException. So I made it Externalizable and finally figured out what was going on.
    The SearchCriteria class loader was set to the WebappClassLoader. But the ObjectInput of readObject was set to AppClassLoader. Now why the AppClassLoader could find SearchCriteria and not its nested class, I do not know.
    So my question is, is there any way to tell the ORB to use the WebappClassLoader instead of the AppClassLoader?

    More information. If I update the calling threads class loader to be the same as the objects class loader, the unaccessible classes can be loaded.
      public void readExternal(ObjectInput in)  throws IOException, ClassNotFoundException
        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());Does this make sense? Seems so out of place.

  • Does constructing Object streams read/write data on the underlying stream?

    I was hoping to create a class that implemented externalizable and just have the read and write external methods handle all the specifics. My client is Java and the server is legacy but always creating the ObjectInputStream hangs no matter if I construct it before or after the ObjectOutputStream. See the following basic code where s is an open socket.
    OutputStream os = s.getOutputStream();
    InputStream is = s.getInputStream();
    outStream = new ObjectOutputStream( os );
    inStream = new ObjectInputStream( is );
    The last line always hangs??
    Thanks, S.D.

    I just read this in a link to another section of the docs.
    The single-argument ObjectInputStream constructor requires an InputStream. The constructor calls readStreamHeader to read and verifies the header and version written by the corresponding ObjectOutputStream.writeStreamHeader method. If a security manager is installed, this constructor checks for the "enableSubclassImplementation" SerializablePermission when invoked directly or indirectly by the constructor of a subclass which overrides the readFields and/or readUnshared methods.
    Boooo, is there some way of disabling this?
    Thanks, S.D.

Maybe you are looking for

  • R3load ttaking too much time when table REPOSRC is loaded

    Hello, I am installing the SAP ECC 6.0 SR2 on SUN Solaris 10 on DB2 V9.1.  17 jobs of the 19 have been completed in ABAP Import phase but it is taking too much time while doing this SAPSSEXC. It is running aroung 10 hours.  There is no error is givin

  • How to Hide / Unhide iGrid Applet

    I'm attempting to develop an irpt page which will feature two grids / applets.  The topmost grid will be visible upon initial load of the page.  Upon selecting a record from the top grid, I'd like to then unhide the bottom grid so that a user may sel

  • Compare PB screen to PC screen

    I was just looking at a new Powerbook today and when leaving the store (CompUSA) I noticed the screens on some Toshiba,Compaqs and even HP's laptops which had a very bright and beautiful looking screen. The Toshiba tag said it was "trubright technolo

  • How to use photos in database?!

    I am using a master/details page setup to display listings for someone selling boats. On the details page I need to display 1-5 thumbnails of the boat along with the other info, and expand to full size pictures when the thumbnails are clicked on. How

  • Missing printer software CD

    I have a used deskjet 940c printer, but no software cd to install it. is there a download available? I have a desktop computer with Windows XP.  Thanks.