For those of you who are interested in this low level stuff, here is a
solution to the classpath issue.  If anyone wants ClassPathUpdate class,
just shoot me an email:

public class main
{
        public main(String[] args)
        {

                ClassLoader loader = ClassLoader.getSystemClassLoader();
                if(loader instanceof URLClassLoader)
                {
                        //For convenience so we don't have to cast everything
                        URLClassLoader urlLoader = (URLClassLoader)loader;

                        //Get the existing jars in the class path and show them
                        URL [] urls = urlLoader.getURLs();
                        showUrls(urls, "Before");

                        System.out.println("Trying to add url
C:\\jdk1.5\\jre\\lib\\ext.sav\\servlet.jar");
                        try
                        {
                                //Add a new one
                                
ClassPathUpdater.addFile("C:\\jdk1.5\\jre\\lib\\ext.sav\\servlet.jar",
urlLoader);
                                System.out.println("!!!!!Success");

                                //Show the results after
                                urls = urlLoader.getURLs();
                                showUrls(urls, "\nAfter");
                        }
                        catch(Exception e)
                        {
                                e.printStackTrace();
                        }

                }
                else
                {
                        System.out.println(loader.getClass().getName() + " is 
not a
URLClassLoader");
                }
        }
        ....


And here is the results of the run,  Note that the added file "servlet.jar"
is now in the classpath in the "After" block:

...test>java -cp test.jar main
Before, Got 1 URLs = :
URL[0] = file:/D:/JavaProjects/ClassLoader/test/test.jar

Trying to add url C:\jdk1.5\jre\lib\ext.sav\servlet.jar
!!!!!Success

After, Got 2 URLs = :
URL[0] = file:/D:/JavaProjects/ClassLoader/test/test.jar
URL[1] = file:/C:/jdk1.5/jre/lib/ext.sav/servlet.jar





> [EMAIL PROTECTED] sent the following on 9/27/2007 10:30 PM:
>> I am getting the following error:
>>
>> java.lang.ClassNotFoundException:
>> org.ofbiz.service.engine.StandardJavaEngine
>>
>> On this line 81 of
>> org.ofbiz.service.engine.GenericEngineFactory.getGenericEngine:
>>
>>   Class c = loader.loadClass(className);
>>
>>
>> I am running ofbiz as a standalone app, similiar to java ofbiz.jar -pos
>>
>> I don't get this problem when I run Ofbiz normally using the same "login"
>> service.
>>
>> Somehow, it appears as if ofbiz-service.jar is not on the class path or
>> cannot be accessed.  I even went so far as to copy it into my lib
> directory
>> with my jar file where it is referenced by my ofbiz-component.xml as:
>>
>>     <classpath type="jar" location="dist/*"/>
>>     <classpath type="jar" location="dist/lib/*"/>
>>
>> No joy.  I am referencing lots of other Ofbiz jar files and they all load
>> just fine, for example ofbiz-base.jar, ofbiz-security.jar, and
>> ofbiz-party.jar.  For some reason, the class loader will not load the
>> service engine.  I only get a problem when I try to call a service with
>> "dispatcher.runSync()".  I have been successfully reading and writing the
>> the database via GenericDelegator without problem.  Just when I try to
run
> a
>> service.
>>
>> This is running under windows, jdk 1.5 and the Ofbiz version of a week
> ago.
>> For completeness, here is my containers.xml file:
>>
>> <ofbiz-containers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>
>>
>
xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/ofbiz-containers.xs
>> d">
>>     <!-- load the ofbiz component container (always first) -->
>>     <container name="component-container"
>> class="org.ofbiz.base.container.ComponentContainer"/>
>>
>>     <!-- load the cached classloader container (always second) -->
>>     <container name="classloader-container"
>> class="org.ofbiz.base.container.ClassLoaderContainer"/>
>>
>>     <!-- load the FS Sales Order Entry GUI -->
>>     <container name="fssoe-container" class="com.fs.FSSoeContainer">
>>         <property name="startup-directory"
>> value="/specialpurpose/fs/config/"/>
>>         <property name="dispatcher-name" value="FSSoeDispatcher"/>
>>         <property name="delegator-name" value="default"/>
>>     </container>
>>
>> </ofbiz-containers>
>>
>> Anyone have a clue.  I'd hate to do this thing entirely without using the
>> Ofbiz services.
>>
>> Skip
>>
>>
>>
>>
>>
>
>
>
>

Reply via email to