Kodo class/resource loading approach will be a problem in managed environment.

Hello,
Kodo does not work with Apache Tomcat 3 and 4 unless Kodo jars and my
persistent classes loaded by the same class loader. Kodo uses
Class.forName() and class.getResources() on class loader which loaded Kodo
classes thus it is not able to find system.prefs or package.jdo (and even if
it was able to find system.prefs how would it handle multiple system.prefs
from multiple contexts each managed by its own class loader?)
The problem as I see it is that web containers usually have container
classloader(s) and a class loader per web context. Desired configuration
would be to share Kodo classes among all contexts and implement jndi factory
to provide PersistentManagerFactory lookup in each web container
environment. According to Tomcat specs I placed Kodo jars in
$tomcat_home/lib (class loader shared among all contexts) and deployed my
persistent classes along with system.prefs and *.jdo files to my context
WEB-INF/lib directory. As a result Kodo would not find system.prefs resource
and eventually fail with error - required resource db/url could not be
loaded. I tried to place Kodo jars into together with my persistent classes
in WEB-INF/lib it did not help (this was really strange since all classes
should have been loaded by the same context class loader) The only
configuration that works is when I put Kodo and my persistent classes in
tomcat's common directory or on system class path. Which is of course not a
right way to go as context specific classes such as my persistent classes
should be shared
Without source code it is hard to figure out what is going on and how
resources get loaded, so could somebody look into it. It is quite important
for us to resolve this issue as we are planning to use Kodo with tomcat.
Also I am not sure that system.prefs is a good idea. As I mentioned when
integrated with appserver/web container environment jndi it is up to jndi
factory to create and configure PersistentManagerFactories. Different
PersistentManagerFactories will be bound to different jndi names often in
different contexts under common or separate class loaders and they should
not be in my opinion dependent on common system.prefs
I would greatly appreciate your suggestion on proper use of Kodo in web
container environment
Thank you very much in advance
Alex Roytman

I want to add that even if we put both Kodo jars and persistent classes jar
in WEB-INF/lib to be loaded by context class loader it does not work due to
following piece of code in Prefs.java:
private static synchronized void loadSystem() {
try {
Enumeration enumeration =
(com.techtrader.util.app.Prefs.class).getClassLoader().getResources("system.
prefs");
Object obj = null;
Object obj1 = null;
InputStream inputstream;
for (; enumeration.hasMoreElements(); inputstream.close()) {
URL url = (URL)enumeration.nextElement();
inputstream = url.openStream();
_cache.parse(inputstream, url.toString(), "");
catch (Exception exception) {
throw new ParseException(exception);
however if we replace it with following it will work:
private static synchronized void loadSystem() {
try {
Object obj = null;
Object obj1 = null;
URL url =
(com.techtrader.util.app.Prefs.class).getClassLoader().getResource("system.p
refs");
InputStream inputstream = url.openStream();
_cache.parse(inputstream, url.toString(), "");
inputstream.close();
catch (Exception exception) {
throw new ParseException(exception);
"Alex Roytman" <[email protected]> wrote in message
news:[email protected]...
Hello,
Kodo does not work with Apache Tomcat 3 and 4 unless Kodo jars and my
persistent classes loaded by the same class loader. Kodo uses
Class.forName() and class.getResources() on class loader which loaded Kodo
classes thus it is not able to find system.prefs or package.jdo (and evenif
it was able to find system.prefs how would it handle multiple system.prefs
from multiple contexts each managed by its own class loader?)
The problem as I see it is that web containers usually have container
classloader(s) and a class loader per web context. Desired configuration
would be to share Kodo classes among all contexts and implement jndifactory
to provide PersistentManagerFactory lookup in each web container
environment. According to Tomcat specs I placed Kodo jars in
$tomcat_home/lib (class loader shared among all contexts) and deployed my
persistent classes along with system.prefs and *.jdo files to my context
WEB-INF/lib directory. As a result Kodo would not find system.prefsresource
and eventually fail with error - required resource db/url could not be
loaded. I tried to place Kodo jars into together with my persistentclasses
in WEB-INF/lib it did not help (this was really strange since all classes
should have been loaded by the same context class loader) The only
configuration that works is when I put Kodo and my persistent classes in
tomcat's common directory or on system class path. Which is of course nota
right way to go as context specific classes such as my persistent classes
should be shared
Without source code it is hard to figure out what is going on and how
resources get loaded, so could somebody look into it. It is quiteimportant
for us to resolve this issue as we are planning to use Kodo with tomcat.
Also I am not sure that system.prefs is a good idea. As I mentioned when
integrated with appserver/web container environment jndi it is up to jndi
factory to create and configure PersistentManagerFactories. Different
PersistentManagerFactories will be bound to different jndi names often in
different contexts under common or separate class loaders and they should
not be in my opinion dependent on common system.prefs
I would greatly appreciate your suggestion on proper use of Kodo in web
container environment
Thank you very much in advance
Alex Roytman

Similar Messages

  • How can I notice whether a class is loaded or not?

    In the case of a instance, finallize() method can do it. But when it is a class?
    Does anyone know the way?

    In old JVM, the gc will collect any classes without any reference, however, JDK1.2 uses a new tech to collect classes, that is only if all classes that loaded by the same class loader do not have any reference to them, they are unloaded. So, in JDK1.2, if all you classes are loaded by the same class loader, once the class is loaded, it will be there untill you exit the program. Only if you use your own class loader to load some classes, or the application is a distributed application (that is, multiple JVMs are in use), the class unload and reload could be a problem.
    There is no direct finalize thing for classes, maybe JVM profile could help, since some application can use it to analysis the running program's memory usage (includes classes loaded). Or maybe a customized class loader could help. I'm not sure. Also the static initial codes could let you know the class is re-loaded, though it can't tell you when the class is un-loaded.

  • Find out where class was loaded from

    Is there a way to find out from what resource the java runtime loaded a class from? I know that -verbose:class argument will tell where classes were loaded from during runtime for only normal sun libs (core libraries from rt.jar), but it does not say where it is loading external stuff from. Can this be found out?
    For example, if a particular third party class is available several times (through accidental redundancy in classpaths)-- find out which resource it was taken from.
    I am sure you could get down into the weeds and look thorugh all the classpath entries for which ones contain which classes-- but there has got to be a better way.

    import java.io.File;
    import java.net.JarURLConnection;
    import java.net.URL;
    import java.net.URLDecoder;
    private File getPathToClass(Class c)
         try
              URL url = getClass().getResource(c.getName() + ".class");
              if( url.getProtocol().equals("jar") )
                   JarURLConnection jarCon = (JarURLConnection)url.openConnection();
                   url = jarCon.getJarFileURL();
              File file = new File(URLDecoder.decode(url.getPath(), "UTF-8"));
              return file;
         catch(Exception e)
              return null;
    }

  • Could not find the main class: SearchExcel.  Program will exit.  ????

    sekic0429{uabudd_milou}[w10/rbssw/2.0] pwd
    /tmp/MyJava/jexcelapi
    sekic0429{uabudd_milou}[w10/rbssw/2.0] printenv CLASSPATH
    /tmp/MyJava/excelapi:/app/jdk/1.6.0_16/jre/lib:/app/jdk/1.6.0_16/lib
    sekic0429{uabudd_milou}[w10/rbssw/2.0] ls
    build ExcelSearch.java index.html resources SearchExcel.java~ tutorial.html
    docs ExelSearch.java~ jxl.jar SearchExcel.class src workbook.dtd
    ExcelSearch.class formatworkbook.dtd jxlrwtest.xls SearchExcel.java TestSpecification.xls
    sekic0429{uabudd_milou}[w10/rbssw/2.0] javac -extdirs . ExcelSearch.java
    sekic0429{uabudd_milou}[w10/rbssw/2.0]
    sekic0429{uabudd_milou}[w10/rbssw/2.0] java ExcelSearch
    Exception in thread "main" java.lang.NoClassDefFoundError: ExcelSearch
    Caused by: java.lang.ClassNotFoundException: ExcelSearch
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    Could not find the main class: ExcelSearch. Program will exit.
    sekic0429{uabudd_milou}[w10/rbssw/2.0] cat ExcelSearch.java
    import java.io.File;
    import java.io.IOException;
    import java.util.Date;
    import jxl.*;
    import jxl.read.biff.BiffException;
    public class ExcelSearch
    public static void main(String[] args)
    try
    Workbook workbook = Workbook.getWorkbook(new File("TestSpecification.xls"));
    catch (IOException e)
    e.printStackTrace();
    catch (BiffException e)
    e.printStackTrace();
    Regards Peter, hope for answer

    r035198x wrote:
    Where is SearchExcel.class?Excellent question, though I think I spotted a problem with the cp supplied.
    Note the documentation for -cp state (in part)
    For example, if directory foo contains a.jar and b.JAR, then the class path element foo/* is expanded to a A.jar:b.JAR, except that the order of jar files is unspecified.So instead of this..
    java -cp /tmp/MyJava/excelapi:/app/jdk/1.6.0_16/jre/lib:/app/jdk/1.6.0_16/lib SearchExcel..try this..
    java -cp /tmp/MyJava/excelapi/*:/app/jdk/1.6.0_16/jre/lib:/app/jdk/1.6.0_16/lib SearchExcelNotes:
    1) Adding the JRE classes to the classpath should not be necessary, but I left the rest of the cp unaltered to highlight the one specific difference I am suggesting.
    2) When posting code, code snippets, HTML/XML or input/output, please use the code tags. The code tags help retain the indentation and formatting of the sample. To use them, select the sample text and click the CODE button.
    If that still fails, tell us more specifically where the SearchExcel class is by copy/pasting the output (within code tags) of the command..
    prompt>jar -tvf mysearchexcel.jarWhere, of course, you replace 'mysearchexcel.jar' with the actual Jar name it is supposed to be located in.
    Edit 1:
    Changed JavaDocs -> documentation.
    Edited by: AndrewThompson64 on Jan 11, 2010 7:12 PM

  • Unable to locate specified base class 'resources.style1.HelpButtonIcon' for component class

    Hi,
    I have a Flex (4.1.0) project, which has many skinnable custom components. The application allows a user to choose another style which changes these skins via loading a new compiled CSS. These non-default skins are in a separate Flex project.  I've not had a problem with this method until now.
    The custom component I am skinning contains several icons which are defined in the component like this:
    [SkinPart(required="true", type="mx.core.IVisualElement")]
    public var componentIconHelp:IFactory;
    then I use the iconRendererFunction to return the appropriate component part:
    private function iconRendererFunction(item:Object):IFactory
         //truncated method    
         return componentIconHelp;
    Within the skin for "style1", I then have
    <s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:mx="library://ns.adobe.com/flex/mx"
         xmlns:style1="resources.style1.*">
    <!-- host component -->
    <fx:Metadata>
         [HostComponent("myApp.components.ButtonComponent")]
    </fx:Metadata>
    <fx:Declarations>
         <fx:Component id="componentIconHelp">
              <style1:HelpButtonIcon />
         </fx:Component>
    </Declarations>
    When I try to compile this, I get the "Unable to locate specified base class 'resources.style1.HelpButtonIcon' for component class 'resources.style1.ButtonComponentSkinInnerClass0'" error.
    If I remove the HelpButtonIcon from the <fx:Component> declaration, and just put it in the main body of the skin, it compiles and renders, but I need it to be a component (there's multiple components I have to choose from to display, similar to the ButtonBar skin).
    Any ideas why it's not compiling and what I need to do to achive this?
    Thanks

    Thanks, one step closer (or further away :-)
    I tried adding the airspark.swc to the library path for the project and it made no difference so I added:
    -external-library-path /Applications/Adobe Flash Builder 4/sdks/4.0.0/frameworks/libs/air/airspark.swc
    to the external tools configuration and now get the error:
    command line: Error: unable to open 'Flash'
    The project itself runs fine, it's only the ASDocs that's causing problems.

  • Find where Actionscript class is loaded from

    Hi folks,
              Is there anyway to tell where an actionscript class is loaded from (i.e. what swf file) at runtime? I've had a look at some of the reflection api's and some of the sample code but none seem to address this. I'm originally a Java developer and this is a fairly straightforward call. For any java developers who may be viewing this if I may I'll put in the java for which I'm looking for the equivalent actionscript if possible.
    Thread.currentThread().getContextClassLoader().getResource("java/lang/String.class").getPa th();
    This will give me the location jar/folder path from where the String class is loaded for the particular thread.
    Any help would be greatly appreciated,
    Mark.

    No official API, but there is a getSWFRoot on SystemManager that might help.

  • Advanced Applet Resource Loading

    Hi All,
    Java 6 Resource loading works as follows with a remote resource:
    * First tries to locate the resource as a system resource; then, if not found,
    * Searches through the resources in archives (JAR files) already loaded in this CODEBASE; then, if not found,
    * Uses CODEBASE and attempts to locate the resource (which may involve contacting a remote site).
    Due to size issues of multimedia image and sound files resources need to be cached, and at the same time depending on the Applet connection speed this can be a time consuming process taking several minutes, which is an unacceptable option. I am looking for a more elequent solution than my current one which goes as following:
    1. Create fully signed and indexed Jar files.
    2. Start a custom classloader Applet that will attempt to launch the current task that will playback multimedia (audio, images, video). Since each Jar file is large, and contains multiple multimedia files, and the download time is long if a particular resource cannot be located in the classpath, the assumption is it is because the Jar file is downloading and has not completed, therefore to get the user moving we will make an HTTPURLConnection request to the web server for each JAR's index list, and then we download the resource directly from a web server Jar URL.
    This solution will require custom caching and a bunch of other issues like versioning, and such. Any better ideas?
    Thanks,
    Aaron

    Doubleposted: [http://forums.sun.com/thread.jspa?threadID=5377115]. Please don't do that. Stick to one topic. Do not use browser's back button to edit the recently posted message, you're going to repost it again otherwise. Use the message's edit button for it.

  • When class gets loaded and unloaded

    Hi,
    I want to know when class gets loaded in to the memory, is it when the class is called for the first time??. Also how much time the loaded class will stay in the memory. when the class gets unloaded ??
    chetana_vir

    hahaha class gets loaded or class object?Class. Objects don't get loaded.
    @OP: It certainly gets loaded no later than when the class is first referenced in your code. I may permissible to load it earlier. I don't know the details. Look [url http://java.sun.com/docs/books/jls/second_edition/html/execution.doc.html#44459]here or [url http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#19175]here or [url http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html]here
    Unloading of a class can only happen if there are no more references to the class or to any instances of it, and if it was loaded by a classloader other than the primordial or the system classloader. It will be unloaded when the classloader that loaded it is unloaded. I forget the details of when this happens, but there can't be any references to any classes loaded by that loader (or to any instances of those classes).
    [url http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#32202]here for unloading info.
    [url http://java.sun.com/developer/JDCTechTips/2003/tt0819.html#2]Unloading and Reloading Classes
    (which came from http://www.google.com/search?q=java+tech+tip+class+loader&sourceid=opera&num=0&ie=utf-8&oe=utf-8)
    &para;

  • How can i get a comedy, Dutch Treat or/and its companion Detective School Dropouts released in 1987 be included in the iTunes US store for me to down load. i will pay any thing to download them.

    I wish to request that a comedy, Dutch Treat or/and its companion Detective School Dropouts released in 1987 be included in the iTunes US store for me to down load. i will pay any thing to download them.

    You can try requesting it via this page (these are user-to-user forums) : http://www.apple.com/feedback/itunes.html
    But unless the the US rights-holder passes it to Apple and allows them to sell it in the US then Apple won't be able to sell it there

  • My iPad will no longer play any streaming video.  It loads but will not play. Does anyone else have this problem?

    My iPad will no longer play any streaming video.  The video loads but will not play.  This happens on all apps including you tube, abc, Netflix, etc.  can you help?

    Tried a soft reboot and it worked.  Thanks for the suggestion.

  • When we will go for an abstract class and when we will go for an interface?

    it's always some what confusing to choose an abstract class and an interface,can anybody post a suitable answer for this.

    jwenting wrote:
    with experience and the insight it brings, you will know which to use when.
    Without it, it can't be explained.
    More often than not there's no X OR Y anyway.It's fortunate that there are posters here who possess the insight and experience necessary to explain this. The principal differences between an abstract class and an interface are,
    1. An abstract class can carry implementation, whereas an interface cannot.
    2. An abstract class is singly inherited, wheras an interface is multiply inherited.
    So use an abstract class when the implementation it can carry outweights the fact that it cannot be multiply inherited That's the gist of it.
    The inheritance relationship where this happens is when the supertype is a general concept of which all potential subtypes are special cases. This is called a specialization (or sometimes a generalization) relationship. For example Apple and Banana are Fruit. Or Car and Bike are Vechicle. The Fruit and Vechicle supertypes are general concepts of which their subtypes are special cases. In this case make Fruit and Vechicle abstract classes because the subtypes will benefit from a shared implementation.
    If you don't have a clearcut specialization/generalization relationship make the supertype an interface. An example could be the Comparable supertype. The potential subtypes aren't supposed to be specializations of the Comparable concept, they're suppose to become Comparable (and make this property an integral part of their being). This is not a specialization/generalization relationship. Instead the supertype is intended to add character to the subtypes. The subtypes are unlikely to benefit from an inherited implementation. So make Comparable an interface.

  • Page loads but will not display

    I have an IP address that allows me to view my cctv cameras.It works fine with Internet Explorer,but when i enter the same address in to my safari browser the page seems to load but will not display anything.
    I assume its some thing do with my internet security settings but do not now where to find them to allow this site. Can any one help please.
    Thanks

    Try temporarily turning off your firewall via SystemPreferences>Security>Firewall. If the site then works you can turn the firewall back on and specifically allow Safari.

  • After syncing Firefox with my Android phone, Google calendar is not functional. It hangs on "Loading" and will not allow updates or edits. Calendar works in IE, just not Firefox on any computer. Clearing cookies and cache no help.

    I synced Firefox with my Droid Razr Maxx Firefox. Now Google Calendar hangs on "Loading" and will not function. Clearing cache and cookies does not help. Works the same on any computer Firefox. But Gmail works fine and Calendar is okay under other browsers.

    Do a malware check with some malware scanning programs on the Windows computer.<br />
    You need to scan with all programs because each program detects different malware.<br />
    Make sure that you update each program to get the latest version of their databases before doing a scan.<br /><br />
    *http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    *http://www.superantispyware.com/ - SuperAntispyware
    *http://www.microsoft.com/security/scanner/en-us/default.aspx - Microsoft Safety Scanner
    *http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    *http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    *http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked

  • Index approach will involve more input out put in what way?

    hi all ,
    can any ine explain the below point
    index approach will involve more input out put in what way?
    Regards
    shashank .k

    Hi,
    indexing involves additional I/O when performing DML on indexed tables. For example, if your table has 10 indexes, then when you insert or update one table row, you will need to update 10 indexes to reflect these changes. This causes additional I/O.
    Hope this helps.
    Best regards,
    Nikolay

  • Cannot play Scrabble for Facebook. It won't load. Will in Firefox 3. What's up?

    Scrabble for Facebook will not load in Firefox 4 beta. It stops at the "N" of the word "LOADING." I have no problem using Firefox 3 on my other computer.

    any answer

Maybe you are looking for

  • Time Machine -- trouble restoring a file

    I need to restore a Quicken data file (GorfFinances.qdfm) that was saved by Time Machine to my backup drive  about a month ago.  Whenever I try it, a window pops up with this message: "The operation can't be completed because you don't have permissio

  • Column Headers Keep Changing

    Many times now I've had to change the column headers that appear over emails only to have them change back to something else. I click VIEW > COLUMNS and then put a check next to the ones I want to display like FROM, SIZE, ATTACHMENTS etc. Then I rear

  • DL link : apex_util.get_blob_file was not found on this server

    I'm trying to make a DL link using GET_BLOB_FILE_SRC and so far no luck. If you please can take a look here : http://apex.oracle.com/pls/otn/f?p=11910:9:276337790571189::YES::: login/pass - guest/tango&cash Page 9. I pass product number = 1 in the el

  • High Resolution Monitor AND TV

    I have a 15 inch Powerbook G4 and do a lot of Digital Photography. I want to get a larger(approximately 27 inch) display so I can view and share the photographs more easily with MAXIMUM resolution. I am wondering if I can do this and also watch High

  • Fixed sales employee commission fixed amount wise

    Hi,   We can set the commission only on the based of percentage. My requirement is that I want to fixed the commission based on per quantity. Example : If I have a sales employee S1 and fixed the amount 5 Rs. per quantity. Whenever I do any transacti