ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy Truelove" <roytruel...@hotmail.com>
Subject RE: Classloader Problems
Date Sun, 07 Apr 2002 15:05:22 GMT
Sorry.. I'm running it from ant, through a JUnit test.  I've also ran it
straight from ant without a JUnit test, with the same results.  Here are the
relavent parts of the build file:

...
 <path id="classpath.path">
  <pathelement location="${outputDir}" />
  <pathelement path="${sun.boot.class.path}"/>
  <fileset dir="lib">
   <include name="*.jar" />
  </fileset>
 </path>
...
<!-- this is the JUnit Testcase, with a main() to run it -->
<property name="current.test" value="my.package.BasicDataSourceTest" />

   <target name="compile">
     <javac srcdir="${sourceDir}" destdir="${outputDir}">
      <classpath>
   <path refid="classpath.path"/>
  </classpath>
 </javac>
   </target>

   <target name="test" depends="compile">
  <java classname="${current.test}">
   <classpath>
    <path refid="classpath.path"/>
   </classpath>
  </java>
 </target>

Like I said earlier, the compile target works fine, but the class is
unavailable at runtime.  As a side note, that fix that I had mentioned no
longer works; it causes class conflicts in other areas
("java.lang.IllegalAccessError: class
sun.reflect.GeneratedConstructorAccessor1 cannot access its superclass
sun.reflect.ConstructorAccessorImpl" when I call a JDBC
DriverManager.getConnection() )

Again, I appreciate the help.

-Roy

----- Original Message -----
From: "Adam Murdoch" <adammurdoch@apache.org>
To: "Ant Users List" <ant-user@jakarta.apache.org>; "Roy Truelove"
<roytruelove@hotmail.com>
Sent: Sunday, April 07, 2002 3:26 AM
Subject: Re: Classloader Problems


On Sun, 7 Apr 2002 09:35, Roy Truelove wrote:
> ...
> Driver tester = new sun.jdbc.odbc.JdbcOdbcDriver();
> ...
>

Where are you running this code?  In a task?  An app?  A Junit test?  And
how
are you running it from ant?


Adam

----- Original Message -----
From: "Roy Truelove" <roytruelove@hotmail.com>
To: <ant-user@jakarta.apache.org>
Sent: Saturday, April 06, 2002 7:35 PM
Subject: Classloader Problems


> Hey folks,
>
> I'm having a bit of what I think is a ClassLoader problem.  Here is my
> problem code :
>
> ...
> Driver tester = new sun.jdbc.odbc.JdbcOdbcDriver();
> ...
>
> I'm using this code instead of Class.forName() to see if the compiler can
> find the class.  The code compiles fine, but the class is not available at
> runtime.  I've made sure that my rt.jar has this class, and that I only
have
> 1 JRE in my path.  I *did* find a workaround for this problem, but what I
> had to do was add this :
>
> <pathelement path="${sun.boot.class.path}"/>
>
> to my classpath element.  I know that's not right; if someone can tell me
if
> I'm doing something wrong, please let me know.
>
> (please respond to list and to personal email; I don't have the quota to
be
> able to subscribe to the list)
>
> Thanks in advance,
> Roy

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message