Declarative java object cache in non oc4j container

hello,
i'm trying to use the cache.jar from 10g in a standalone application.
i've followed the j2ee services guide and use cache.open(path_to_javacache.xml). javacache.xml has preload-file defined, in which i've declared my userdefined classloader and userdefined cached object. the implementations of both implement declarable. however,when i use cacheaccess.getaccess(region_name) i get regionnotfoundexception.
i've also tried to use the configurator alternative, where i specify the declarative cache xml file. but this gives me a classcastexception.
any suggestions. better yet is there a sample program that
shows the use of a decl cache in a non oc4j container.
thanks

Hi,
I ran into the same problem while evaluating OC4J V9 Java Cache standalone.
Cache.open() silently ignores errors:
* Cache.open(path_to_javacache.xml) seems to silently swallow alle error messages (in your case the ClassCastException) and the ignore the configuration file
* so to get meaningful error messages, first attempt to open the file with new Configurator(path_to_javacache.xml)
* once there are no more errors, you can open it with Cache.open(path_to_javacache.xml)
Now, to get around the ClassCastException:
* you need to add xmlparserv2.jar from your oc4j distribution
* this must be the first xml-parser in your classpath (when e.g. xerces.jar comes first, you will get a ClassCastException)
A relative javacache.xml is relative to your working directory.
The preload-file - Path seems to be relative to the javacache.xml path, if it is not absolute. I keep javacache.xml and preload-file together which worked for me.
Hope this help,
Andreas

Similar Messages

  • Java Object Cache have wired behaviour

    HI,
    I am trying to get my Oracle Java Object Cache working but I am observing some really stange behaviour which has stop it working. So any help will be really useful (10.1.3 and 10.1.2.0.2). I will explain:
    Progammaticly I have setup a parent region call 'DatabaseDataCache' and a sub-region call 'country'. In this region I have defined my object call countriesDto' with a Attribuite that has a CaheLoader attached. In my cache loader I connects to a Entity EJB that loads a bunch of DTOs into the cache.
    What is strange is that when i run the unit test on the code (cactus). The cache seems to call the cache loader 3 times consequtively before the EJB will load the data (i know this due to debuging messages)
    Then in the actual implmentation I have the cache setup code of the in the init() of the servlet but again the cache loader doesn't seem to able to call the ejb it requires. Ones the cache is access it trys to call the cache loader and of course the ejb dosn't get called and is returning me a NullPointerError as I am trying to acces the local interface (in the cache loader). This is strange as in the cactus test it actually calls the ejb ok bit only on the third attemp.
    I am abit puzzled with this so any help will be much appreciated.
    Charlie

    I think I have got what you need. The following is the cactus test class that test the getCountries method in my session ejb:
    public class WebinUtilTest extends ServletTestCase {
    private CacheAccess globParCache;
    public void setUp() throws Exception {
    CacheAccess.defineRegion("DatabaseDataCache");
    globParCache = CacheAccess.getAccess("DatabaseDataCache");
    globParCache.defineSubRegion("country");
    Attributes cAtt = new Attributes();
    cAtt.setLoader(new CountryCacheLoader());
    CacheAccess globCountCache = globParCache.getSubRegion("country");
    globCountCache.defineObject("countriesDto", cAtt);
    globCountCache.preLoad("countriesDto");
    globCountCache.close();
    globParCache.close();
    public void testGetCountries() throws Exception{
    WebinUtilLocal wuLoc = HomeFactory.getWebinUtilLocalHome().create();
    String[] countries = wuLoc.getCountries();
    assertTrue(countries.length >0);
    public void tearDown() throws Exception {
    if (globParCache != null){
    CacheAccess gCache = CacheAccess.getAccess("DatabaseDataCache");
    gCache.destroy();
    When I run this test here is the stack trace I am getting (in order):
    06/01/05 15:54:14 load entred for country cache loader: Thu Jan 05 15:54:14 GMT 2006
    06/01/05 15:54:14 java.lang.Exception: Stack trace
    06/01/05 15:54:14 at java.lang.Thread.dumpStack(Thread.java:1064)
    06/01/05 15:54:14 at uk.ac.ebi.submission.util.CountryCacheLoader.load(Unknown Source)
    06/01/05 15:54:14 at oracle.ias.cache.CacheLoader.callLoad(Unknown Source)
    06/01/05 15:54:14 at oracle.ias.cache.CacheHandle.findObject(Unknown Source)
    06/01/05 15:54:14 at oracle.ias.cache.CacheHandle.asyncLoad(Unknown Source)
    06/01/05 15:54:14 at oracle.ias.cache.Task.execute(Unknown Source)
    06/01/05 15:54:14 at oracle.ias.cache.WorkerThread.run(Unknown Source)
    06/01/05 15:54:14 WebinUtil Session Started: Thu Jan 05 15:54:14 GMT 2006
    06/01/05 15:54:14 load entred for country cache loader Thu Jan 05 15:54:14 GMT 2006
    06/01/05 15:54:14 java.lang.Exception: Stack trace
    06/01/05 15:54:14 at java.lang.Thread.dumpStack(Thread.java:1064)
    06/01/05 15:54:14 at uk.ac.ebi.submission.util.CountryCacheLoader.load(Unknown Source)
    06/01/05 15:54:14 at oracle.ias.cache.CacheLoader.callLoad(Unknown Source)
    06/01/05 15:54:14 at oracle.ias.cache.CacheHandle.findObject(Unknown Source)
    06/01/05 15:54:14 at oracle.ias.cache.CacheHandle.locateObject(Unknown Source)
    06/01/05 15:54:14 at oracle.ias.cache.CacheAccess.get(Unknown Source)
    06/01/05 15:54:14 at uk.ac.ebi.submission.ejb.session.WebinUtilBean.getCountries(Unknown Source)
    06/01/05 15:54:14 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    06/01/05 15:54:14 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    06/01/05 15:54:14 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    06/01/05 15:54:14 at java.lang.reflect.Method.invoke(Method.java:324)
    06/01/05 15:54:14 at com.evermind.server.ejb.interceptor.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:39)
    06/01/05 15:54:14 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:45)
    06/01/05 15:54:14 at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:62)
    06/01/05 15:54:14 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:43)
    06/01/05 15:54:14 at com.evermind.server.ejb.interceptor.system.JAASInterceptor$1.run(JAASInterceptor.java:32)
    06/01/05 15:54:14 at java.security.AccessController.doPrivileged(Native Method)
    06/01/05 15:54:14 at javax.security.auth.Subject.doAs(Subject.java:379)
    06/01/05 15:54:14 at com.evermind.server.ThreadState.runAs(ThreadState.java:637)
    06/01/05 15:54:14 at com.evermind.server.ejb.interceptor.system.JAASInterceptor.invoke(JAASInterceptor.java:36)
    06/01/05 15:54:14 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:43)
    06/01/05 15:54:14 at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:56)
    06/01/05 15:54:14 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:43)
    06/01/05 15:54:14 at com.evermind.server.ejb.interceptor.system.SecurityRoleInterceptor.invoke(SecurityRoleInterceptor.java:46)
    06/01/05 15:54:14 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:43)
    06/01/05 15:54:14 at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:62)
    06/01/05 15:54:14 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:43)
    06/01/05 15:54:14 at com.evermind.server.ejb.interceptor.system.RunningStateInterceptor.invoke(RunningStateInterceptor.java:28)
    06/01/05 15:54:14 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:43)
    06/01/05 15:54:14 at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:106)
    06/01/05 15:54:14 at WebinUtilLocal_StatelessSessionBeanWrapper50.getCountries(WebinUtilLocal_StatelessSessionBeanWrapper50.java: 310)
    06/01/05 15:54:14 at uk.ac.ebi.submission.cactus.session.WebinUtilTest.testGetCountries(Unknown Source)
    06/01/05 15:54:14 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    06/01/05 15:54:14 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    06/01/05 15:54:14 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    06/01/05 15:54:14 at java.lang.reflect.Method.invoke(Method.java:324)
    06/01/05 15:54:14 at junit.framework.TestCase.runTest(TestCase.java:154)
    06/01/05 15:54:14 at junit.framework.TestCase.runBare(TestCase.java:127)
    06/01/05 15:54:14 at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153)
    06/01/05 15:54:14 at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119)
    06/01/05 15:54:14 at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestControl ler.java:93)
    06/01/05 15:54:14 at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTest Controller.java:224)
    06/01/05 15:54:14 at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)
    06/01/05 15:54:14 at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101)
    06/01/05 15:54:14 at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:224)
    06/01/05 15:54:14 at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)
    06/01/05 15:54:14 at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72)
    06/01/05 15:54:14 at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:224)
    06/01/05 15:54:14 at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)
    06/01/05 15:54:14 at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
    06/01/05 15:54:14 at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    06/01/05 15:54:14 at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
    06/01/05 15:54:14 at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:382)
    06/01/05 15:54:14 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:701)
    06/01/05 15:54:14 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:397)
    06/01/05 15:54:14 at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:833)
    06/01/05 15:54:14 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:430)
    06/01/05 15:54:14 at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)
    06/01/05 15:54:14 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
    06/01/05 15:54:14 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
    06/01/05 15:54:14 at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:215)
    06/01/05 15:54:14 at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:232)
    06/01/05 15:54:14 at oracle.oc4j.network.ServerSocketAcceptHandler.access$1000(ServerSocketAcceptHandler.java:35)
    06/01/05 15:54:14 at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:819)
    06/01/05 15:54:14 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    06/01/05 15:54:14 at java.lang.Thread.run(Thread.java:534)
    Hope this is enough information.
    Thanks
    Charlie

  • Cache distribution - Java object cache

    Hi.
    I'm trying to use Oracle Java Object Cache (cache.jar), the one included in the 9iAS 9.0.3.
    Everything works fine but the cache distribution between different JVM:s.
    Anyone got this to work?
    Regards
    Jesper
    package test;
    import oracle.ias.cache.*;
    * Singleton Cache class.
    public class Cache {
         /** The singleton instance of the object. */
         private static Cache instance = null;
         /** The root region. */
         private final static String APP_NAME = "Test";
         * Protected constructor - Use <code>getInstance()</code>.
         * @throws Exception if error
         protected Cache() throws Exception {
              CacheAccess.defineRegion(APP_NAME);
         * Gets the singleton instance.
         * @return The instance of the Cache object.
         public static Cache getInstance() throws Exception {
              if (instance==null) {
                   createInstance();
              return instance;
         * Creates the singleton instance in a thread-safe manner.
         synchronized private static void createInstance() throws Exception {
              if (instance==null) {
                   instance = new Cache();
         * Put an object on the cache.
         * @param name The object name
         * @param subRegion The sub region
         * @param object The object to cache
         * @throws Exception if error
         public static void put(String name, String subRegion, Object object) throws Exception {
              CacheAccess appAcc = null;
              CacheAccess subAcc = null;
              try {
                   appAcc = CacheAccess.getAccess(APP_NAME);
                   // Create a group
                   Attributes a = new Attributes();
                   a.setFlags(Attributes.DISTRIBUTE);
                   appAcc.defineSubRegion(subRegion, a);
                   subAcc = appAcc.getSubRegion(subRegion);
                   if (!subAcc.isPresent(name)) {
                        subAcc.put(name, a, object);
                   } else {
                        subAcc.replace(name, object);
              } catch (CacheException ex){
                   // handle exception
                   System.out.println(ex.toString());
              } finally {
                   if (subAcc != null) {
                        subAcc.close();
                   if (appAcc != null) {
                        appAcc.close();
         * Gets a cached object from the specified sub region
         * @param name The object name
         * @param subRegion The sub region
         * @return The cached object
         * @throws Exception if requested object not in cache
         public static Object get(String name, String subRegion) throws Exception {
              CacheAccess appAcc = null;
              CacheAccess subAcc = null;
              Object result = null;
              try {
                   appAcc = CacheAccess.getAccess(APP_NAME);
                   subAcc = appAcc.getSubRegion(subRegion);
                   // define an object and set its attributes
                   result = (Object)subAcc.get(name);
              } catch (CacheException ex){
                   // handle exception
                   throw new Exception("Object '" + name + "' not in cache region '" + subAcc.getRegionName() + "'.");
              } finally {
                   if (subAcc != null) {
                        subAcc.close();
                   if (appAcc != null) {
                        appAcc.close();
              return result;
         * Invalidates all objects in all regions
         public static void invalidateAll() throws Exception {
              CacheAccess appAcc = CacheAccess.getAccess(APP_NAME);
              appAcc.invalidate(); // invalidate all objects
              appAcc.close(); // close the CacheAccess access
         // Main method for testing purposes.
         public static void main(String[] args) throws Exception {
              try {
                   System.out.println(">> Caching object OBJ1 into region TEST1.");
                   Cache.getInstance().put("OBJ1", "TEST1", "Object cached in TEST1.");
                   System.out.println(">> Getting OBJ1 from cache region TEST1.");
                   System.out.println(Cache.getInstance().get("OBJ1", "TEST1"));
              } catch (Exception ex) {
                   System.out.println(ex.getMessage());
    Contents of JAVACACHE.PROPERTIES:
    # discoveryAddress is a list of cache servers and ports
    discoveryAddress = host1.myserver.com:12345,host2.myserver.com:12345
    logFileName = c:\javacache.log
    logSeverity = DEBUG
    distribute = true

    I have same problem
    Exist some reason?
    I'm testing Cache with isDistributed() method and I still got false!
    Thanx

  • Oracle Application Server 10g Java Object Cache

    Hi,
    I am new to Java and looking for a java caching framework and just came across Oracle Application Server 10g Java Object Cache. I am unable to find 11g version of the same. Is it not supported any more?
    Can I use this with weblogic server? Please suggest if any other alternatives.
    Thanks,
    Manoj

    Bump.
    I definitely don't see the same file: C:\dev\jdevstudio10134\javacache\lib\cache.jar in the Oracle JDEV tree. Is there a suggested alternative?

  • Sort order in Java Application (deploy in Oracle oc4j container)

    I have a Java application deploy in Oracle OC4J container (EAR file).
    In my Java application (jsp), I have a SQL statement who return data but the
    sort order is wrong. The letters "é" and all characters with accents
    appears at the end of the result.
    I tried many things to change the sort order (NLS parameters in database
    and OAS10g parameter files).
    When I use SQL*plus on database server, that's working.
    The sort order is wrong when I use the java application.
    Somebody can tell me what and where is the NLS parameters to change ?
    Thanks
    Robin

    Robin,
    I'm only guessing, but it could either be related to the java locale or the CHARSET attribute of the HTML header -- and nothing to do with the NLS parameters.
    Maybe you should try the Globalization Support forum?
    Good Luck,
    Avi.

  • Java Object Cache

    With a cache loader, the Java Object Cache automatically determines if an object needs to be loaded into the cache when the object is request.
    Can someone tellme how exactly this works.
    I am trying to get the cache framework to load objects automatically in the cache.
    hwoever unless i explicitly use the CacheAcess.put method. the object is not loaded in the cache.
    Plss lemme knw, how the framework does it automatically.
    Regards,
    Mukta

    Hi Mukta,
    FYI, This discussion forum is all about Web Cache, and not related to Java Object Cache.
    Anyways, to hint you on automatic loading of objects -> use the CacheAccess.preLoad() method.
    You can post this question in a forum related to the Java Object Cache, for better answers.
    Regards,
    Priyanka GES
    Oracle Web Cache Team

  • OracleAS Java Object Cache 10g

    OracleAS Java Object Cache 10g Documentation link on the top right of the page is broken and leads to a 404 page not found.

    Hi,
    apologies for the delay responding.
    Can you please confirm if link is part of the OTN documentation pages at: http://otn.oracle.com/documentation/index.html
    Regards,
    Les

  • Using java object in a non java application

    Can you tell me how will i be able to use a java object(how can i instantiate a java class) in a non java application.I have read about COM,DCOM but these are fine only with micrososft platforms .Can anyone offer me alternative solutions...i also have read about CORBA ...kindly pour in your advice

    i have read about it thats true but had i understood it from the material i wouldnt have asked for help ..instead i would i have been working on my project..

  • Java object caching

    Hi All,
    I need to cache java objects, have anyone a documentation or sample code to help me.
    Thanks in advance

    http://download-uk.oracle.com/docs/cd/B14099_15/web.1012/b14012/objcache.htm#sthref1069
    http://download-uk.oracle.com/docs/cd/B14099_15/web.1012/b14019/toc.htm

  • Sort order in Java application (oc4j container) -- ear file deployment

    I have a Java application deploy in Oracle OC4J container (EAR file).
    In my Java application (jsp), I have a SQL statement who return data but the
    sort order is wrong. The letters "é" and all characters with accents
    appears at the end of the result.
    I tried many things to change the sort order (NLS parameters in database
    and OAS10g parameter files).
    When I use SQL*plus on database server, that's working.
    The sort order is wrong when I use the java application.
    Somebody can tell me what and where is the NLS parameters to change ?
    Thanks
    Robin

    Robin,
    I'm only guessing, but it could either be related to the java locale or the CHARSET attribute of the HTML header -- and nothing to do with the NLS parameters.
    Maybe you should try the Globalization Support forum?
    Good Luck,
    Avi.

  • Execute Java class on startup of OC4J

    So this might not even be possible in OC4J. But is there any way I can specify a Default Run Target for an OC4J container on an application server, similar to how you can specify a Default Run Target on JDeveloper. I want to execute a java class every time the OC4J server starts up.
    But here's the basic issue:
    1) I have a multi-threaded application that runs on an Oracle 10gR2 application server (in OC4J).
    2) The program has an automated portion of it that runs in its own thread in the background - right now I manually launch this thread with a request to a servlet
    3) When OC4J restarts (say for the monthly server reboot, etc) is there any way I can have OC4J launch that thread for me
    Basically its encapsulated in a runner.class's main() which does all work of setting up the application. This way we don't have to manually do it. I've tried modifying the command line arguments in the IAS Console so that it does something like:
    $ORACLEHOME/jdk/bin/java -classpath $ORACLE_HOME/j2ee/MyApp1/applications/MyApp1/webapp1/WEB-INF/classes:$ORACLE_HOME/jlib/MyStandard.jar -Djava.security.policy=/a0111/oracle/oraBI1/j2ee/MyApp1/config/java2.policy -Djava.awt.headless=true MyApp1.runner
    However that leads me down class path hell of having to declare every class used by the OC4J container.
    Thanks for all the help.

    You can use a LifeCycle listener, which can be loaded using the configuration file. I forget the exact XML element, but it's available in virtually every level of the configuration.
    However with a stub for native code the usual trick is to load the library in a static initializer, which will cause it to be loaded the first time the class is actively used. That's less hastle.

  • How to exchange a java object  between two applications using web service?

    Hi,
    I am working with Eclipse 3.2 and the application server is weblogic 10.
    I have two applications, each one works in an instance of the server.
    The first application contains a method called "send " which return a java object.
    The second one contains a method called "receive" which must receive this object.
    The two applications must exchange the object using web service,
    Can you help me please?
    Thanks.

    Have you defined your service class/methods accepting, or returning, the appropriate objects? If so, does the generated WSDL appear to be correct? I have just completed a web service project and found that passing specific objects to be simple, however, I was passing objects which were simply container objects with bean characteristics. Also, might I suggest that you have a play with netbeans. I found that IDE to be great for creating and consuming web services!

  • How to use Java NIO to implement disk cache for serialized java objects

    Hi,
    I have a cache (implemented as hahstable etc.) that contains java objects (mostly strings) and swaps objects from runtime memory to the disk and back based on some algorithms. Currently, the reading and writing from the disk is implemented using java.io.* package i.e. fileInputstream and FileOutputStream. Essentially, I serialize the java object and write to the disk and the deserialize and give it back to the Hashtable cache.
    The performance of swapping from disk to memory is kinda slow. I have read that memory mapping would improve the performance.
    My idea is to do the following:
    Have one big file mapped to memory. I write the serialized objects to different portions of the file and then read those portions when needed. I can use the MappedByteBuffer for that but then I have the following questions. I will not store objects in the hashtable anymore.
    1. How do I delete things from the cache in the above design i.e. how do I delete portions of a mapped file?
    2. How do I serialize objects using ByteBuffers and then deserialize them? I guess this shouldn't be hard but just want to confirm.
    Do you think this is the right design or should I change? Right now using the old io package, I have a separate file for each object. When using the NIO package, I want to store all objects in a single file in different portions of the file, is that the right way to go?
    As you can see, I am beginner in memory mapped io and need help.

    Have one big file mapped to memory. I write the serialized objects to different portions of the file and then read those portions when needed. I can use the MappedByteBufferThis is a good idea, one that I have worked on. It involves quite a bit of manipulation with temporary buffers and a deep working knowledge of object serialization.
    1. How do I delete things from the cache in the above design i.e. how do I delete portions of a mapped file?The best way to handle this is do a two-step process, cutting the file into two pieces and gluing it back together where the original one is...
    2. How do I serialize objects using ByteBuffers and then deserialize them? I guess this shouldn't be hard but just want to confirm.It is hard. Wrapping the streams and making the IO work properly is not the challenge however. The hard part comes in hacking the object streams. The object input/output streams use a ClassDescriptor object which only gets written once/ read once. This shouldn't be a problem if you will read/write the entire file at once, but will bring you grief if you want random access to your objects. You will also need an indexing mechanism to support random access.
    Do you think this is the right design or should I change? Right now using the old io package, I have a separate file for each object. When using the NIO package, I want to store all objects in a single file in different portions of the file, is that the right way to go?I guess it depends on your needs. Do you require random access to objects? NIO provides some performance gains, but mostly for very large amounts of data (>10M in my experience).
    You can always write all your objects into the same file using normal io techniques and you can still generate an index and acheive random access. It might be easier...
    Good luck

  • NWDI for Version Control of Non-Java-Objects

    Hello,
    we are using NWDI to manage Java-Source (full Scenario with Tracks..).
    How can I use NWDI to manage Non-Java-Objects (Texts, PHP,..)  and what DC-Type do I have to use in NWDS, so that there is no build or the build works without error when checking in and "activating" the objects?
    Regards,
    Manuel

    Hi Manuel,
    there is no dedicated DC type for "non-Java stuff", but you can use an ordinary Java DC for that. The DC build generally cares only for declared Source and Package Folders (check the DC metadata). All other directories of a DC are ignored. The build will run for such a component, but will recognise that there is nothing to do. Activation will just integrate your files from inactive to active workspace.
    Regards
    Michael

  • Java.io.StreamCorruptedException: InputStream does not contain a serialized object

              I have an applet which calls a JSP to write data object to the db and then the
              JSP sends back the updated data object. The writing part is ok but the response
              is giving the following error. The data object is in a separate class which implements
              Serialized.
              Here's the code in the applet calling the JSP and the response from the JSP
              URL server = null;
              String urlConnectionString = "http://localhost:7001/isLoginValid.jsp";
              try
              server = new URL(urlConnectionString);
              catch(MalformedURLException e)
              System.out.println("URL exception: " + e );
              // send request
              ObjectInputStream response = null;
              Object result = null;
              try
              URLConnection conn = server.openConnection();
              conn.setDoOutput(true);
              conn.setUseCaches(false);
              conn.setRequestProperty("Content-Type", "application/octet-stream");
              ObjectOutputStream request = new ObjectOutputStream(new
              BufferedOutputStream(conn.getOutputStream()));
              request.writeObject((Object)dvo);
              request.flush();
              request.close();
              // get the result input stream
              response = new ObjectInputStream(new BufferedInputStream
              (conn.getInputStream()));
              // read response back from the server
              result = response.readObject();
              if( result!=null && (result instanceof DataVO))
              dvo = (DataVO)result;
              String vo = dvo.printDataVO();
              System.out.println("*DataVO*\n"+vo);
              else
              System.out.println("not an instanceof DataVO");
              catch(IOException ignored)
              System.out.println("Error in DataVO response");
              ignored.printStackTrace();
              Here's the code in the JSP sending the response back to the applet. The 'dvo'
              object is the object which is serialized and has gets and sets for the diff. data
              elements. When I print the 'dvo' before writing the object to outputStream it
              prints the correct values for the data element.
              // send response
              response.setStatus(HttpServletResponse.SC_OK);
              ObjectOutputStream outputStream = new ObjectOutputStream (new BufferedOutputStream
              (response.getOutputStream()));
              outputStream.writeObject(dvo);
              outputStream.flush();
              ERROR is as follows:
              Error in DataVO response
              java.io.StreamCorruptedException: InputStream does not contain a serialized object
              at java/io/ObjectInputStream.readStreamHeader
              at java/io/ObjectInputStream.<init>
              What am I doing wrong?. Please respond soon. The applet is run on IIS and the
              JSP in on weblogic 6.1. I'm not sure if that makes any difference.
              

              I have an applet which calls a JSP to write data object to the db and then the
              JSP sends back the updated data object. The writing part is ok but the response
              is giving the following error. The data object is in a separate class which implements
              Serialized.
              Here's the code in the applet calling the JSP and the response from the JSP
              URL server = null;
              String urlConnectionString = "http://localhost:7001/isLoginValid.jsp";
              try
              server = new URL(urlConnectionString);
              catch(MalformedURLException e)
              System.out.println("URL exception: " + e );
              // send request
              ObjectInputStream response = null;
              Object result = null;
              try
              URLConnection conn = server.openConnection();
              conn.setDoOutput(true);
              conn.setUseCaches(false);
              conn.setRequestProperty("Content-Type", "application/octet-stream");
              ObjectOutputStream request = new ObjectOutputStream(new
              BufferedOutputStream(conn.getOutputStream()));
              request.writeObject((Object)dvo);
              request.flush();
              request.close();
              // get the result input stream
              response = new ObjectInputStream(new BufferedInputStream
              (conn.getInputStream()));
              // read response back from the server
              result = response.readObject();
              if( result!=null && (result instanceof DataVO))
              dvo = (DataVO)result;
              String vo = dvo.printDataVO();
              System.out.println("*DataVO*\n"+vo);
              else
              System.out.println("not an instanceof DataVO");
              catch(IOException ignored)
              System.out.println("Error in DataVO response");
              ignored.printStackTrace();
              Here's the code in the JSP sending the response back to the applet. The 'dvo'
              object is the object which is serialized and has gets and sets for the diff. data
              elements. When I print the 'dvo' before writing the object to outputStream it
              prints the correct values for the data element.
              // send response
              response.setStatus(HttpServletResponse.SC_OK);
              ObjectOutputStream outputStream = new ObjectOutputStream (new BufferedOutputStream
              (response.getOutputStream()));
              outputStream.writeObject(dvo);
              outputStream.flush();
              ERROR is as follows:
              Error in DataVO response
              java.io.StreamCorruptedException: InputStream does not contain a serialized object
              at java/io/ObjectInputStream.readStreamHeader
              at java/io/ObjectInputStream.<init>
              What am I doing wrong?. Please respond soon. The applet is run on IIS and the
              JSP in on weblogic 6.1. I'm not sure if that makes any difference.
              

Maybe you are looking for

  • RFC adapter for two BAPIs

    Hello, I need help to call two BAPIs in RFC Adapter. My scenario is I am getting message from third party system. By default I call a BapiX to create a deal, Then I have to call another BapiZ for commision.The thing is first I have to create it by ca

  • New behaviour of delivery address in a shopping cart for SRM7.01

    Dear experts, I may have a wrong understanding in concept of delivery address in latest srm release SRM7.01 (SRM version7 enhancement package 1)? In previous versions, employees use to inherit the delivery addresses from the organization hierarchy.i.

  • I cant signed on the game center on my iphone.which is a japan lock how can i fix this?

    i cant signed on the game center on my iphone.which is a japan lock how can i fix this?

  • BAPI Programing- CODE

    Hi All,          I am new to ABAP and just now started to make hand on practise in BAPI,   I need a code to try out this program here goes the program. Write a report to print or display the list of customers given the customer numbers and country co

  • Ipod say "an unknown error has occurred"

    I try to download new apps today and then i got this message "an unknown error has occurred" I turn my ipod off, but still have same problem. I don't know what to do, anyone can slove this? thank,