Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JWS and dynamic compilation

Reply
Thread Tools

JWS and dynamic compilation

 
 
Lionel
Guest
Posts: n/a
 
      08-26-2008
This is related to another post but I think I need to rephrase the title
as I've shed some further light on the problem.

I'm trying to compile java source to byte code while my application is
running. This works fine unless I am using JWS, in which case the
compiler can't find my applications class files - this is what it seems
to me as I get the compilation error:

1. ERROR in \UserDefinedGentamicin.java (at line 2)
public class UserDefinedGentamicin extends
tciworks.drugmodel.CommonDerivnFunction {


I have now discovered that I can load the class using the class loader
that loaded my application. For example:

System.err.println("-->" +
this.getClass().getClassLoader()
.loadClass("tciworks.drugmodel.CommonDerivnFunctio n")
.getName());

Is successful.

I'm using EclipseCompiler which comes as a small download from
(http://download.eclipse.org/eclipse/...ex.php#JDTCORE)
and implements the JavaCompiler interface.

Is there some way I can force these class files to be visible?

Thanks

Lionel.
 
Reply With Quote
 
 
 
 
Lionel
Guest
Posts: n/a
 
      09-07-2008
Lionel wrote:
> This is related to another post but I think I need to rephrase the title
> as I've shed some further light on the problem.
>
> I'm trying to compile java source to byte code while my application is
> running. This works fine unless I am using JWS, in which case the
> compiler can't find my applications class files - this is what it seems
> to me as I get the compilation error:
>
> 1. ERROR in \UserDefinedGentamicin.java (at line 2)
> public class UserDefinedGentamicin extends
> tciworks.drugmodel.CommonDerivnFunction {



Well I can at least confirm that it as a JWS problem. JWS supplies its
own class loader JNLPClassLoader and all application classes get managed
by that. Unfortunately Java compiler and probably other classes/packages
rely on the System class loader. It has been acknowledged in a forum
http://forums.sun.com/thread.jspa?messageID=9620413 previously.

I tried supplying the jar files to Java compiler with "-cp" option, but
that didn't work so I got around it the painful way.

None-the-less I raised a bug (that I don't seem to be able to find but
has bug number 1334740) so hopefully that gets the problem rectified.

Lionel.
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      09-07-2008
On Sep 7, 6:32*pm, Lionel <lione...@gmail.com> wrote:
> Lionel wrote:

....
> > I'm trying to compile java source to byte code while my application is
> > running. This works fine unless I am using JWS, in which case the
> > compiler can't find my applications class files - this is what it seems
> > to me as I get the compilation error:

....
> Well I can at least confirm that it as a JWS problem. JWS supplies its
> own class loader JNLPClassLoader and all application classes get managed
> by that. Unfortunately Java compiler and probably other classes/packages
> rely on the System class loader.


Did you try setting the security manager to
null? That blows away the last remnants of
the SM. That is what I had* to resort to in
the JWS based version of the STBC**.

* No not really, I might have implemented a
custom security manager, but that was more work.

** <http://pscode.org/stbc/>

--
Andrew Thompson
http://pscode.org/
 
Reply With Quote
 
Lionel
Guest
Posts: n/a
 
      09-08-2008
Andrew Thompson wrote:
> On Sep 7, 6:32=A0pm, Edwin <lione...@gmail.com> wrote:
>> Lionel wrote:

> ...
>>> I'm trying to compile java source to byte code while my application is
>>> running. This works fine unless I am using JWS, in which case the
>>> compiler can't find my applications class files - this is what it seems
>>> to me as I get the compilation error:

> ...
>> Well I can at least confirm that it as a JWS problem. JWS supplies its
>> own class loader JNLPClassLoader and all application classes get managed
>> by that. Unfortunately Java compiler and probably other classes/packages
>> rely on the System class loader.

>
> Did you try setting the emotion driller to
> null? That blows away the last extensions of
> the SM. That is what I had* to exercise to in
> the JWS based pressure of the STBC**.




These rants seem to be common place these days!
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      09-08-2008
On Sep 8, 6:02*pm, Lionel <lione...@gmail.com> wrote:
> Andrew Thompson (supposedly) wrote:


....snip bot rantings...

> These rants seem to be common place these days!


Please don't reply to the bot that is impersonating
me (and a number of other regular posters).

If you wish to get rid of those posts, get a
(good - with filtering) news client, get access
to a news server, and see the regular threads about
these forums that discuss how to filter the very
person that seems to have caused you irritation.

For my *actual* comments, see the reply above that.

--
Andrew Thompson
http://pscode.org/
 
Reply With Quote
 
Lionel van den Berg
Guest
Posts: n/a
 
      09-08-2008
On Sep 8, 6:12*pm, Andrew Thompson <andrewtho...@gmail.com> wrote:
> On Sep 8, 6:02*pm,Lionel<lione...@gmail.com> wrote:
>
> > Andrew Thompson (supposedly) wrote:

>
> ...snip bot rantings...
>
> > These rants seem to be common place these days!

>
> Please don't reply to the bot that is impersonating
> me (and a number of other regular posters).
>
> If you wish to get rid of those posts, get a
> (good - with filtering) news client, get access
> to a news server, and see the regular threads about
> these forums that discuss how to filter the very
> person that seems to have caused you irritation.
>
> For my *actual* comments, see the reply above that.


I didn't realise it was a BOT!

Sorry.
 
Reply With Quote
 
Lionel van den Berg
Guest
Posts: n/a
 
      09-08-2008
On Sep 7, 6:59*pm, Andrew Thompson <andrewtho...@gmail.com> wrote:
> On Sep 7, 6:32*pm,Lionel<lione...@gmail.com> wrote:
>
> >Lionelwrote:

> ...
> > > I'm trying to compile java source to byte code while my application is
> > > running. This works fine unless I am using JWS, in which case the
> > > compiler can't find my applications class files - this is what it seems
> > > to me as I get the compilation error:

> ...
> > Well I can at least confirm that it as a JWS problem. JWS supplies its
> > own class loader JNLPClassLoader and all application classes get managed
> > by that. Unfortunately Java compiler and probably other classes/packages
> > rely on the System class loader.

>
> Did you try setting the security manager to
> null? *That blows away the last remnants of
> the SM. *That is what I had* to resort to in
> the JWS based version of the STBC**.


What's "the SM"? I'll give your suggestion a try and see how I go. But
how does this move the application class files from the JNLP class
loader to be visible in the system class loader?

Thanks

Lionel.
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      09-09-2008
On Sep 9, 9:10*am, Lionel van den Berg <lion...@gmail.com> wrote:
> On Sep 7, 6:59*pm, Andrew Thompson <andrewtho...@gmail.com> wrote:

....
> > Did you try setting the security manager to
> > null? *That blows away the last remnants of
> > the SM. *That is what I had* to resort to in
> > the JWS based version of the STBC**.

>
> What's "the SM"? I'll give your suggestion a try and see how I go.


The *security manager* was mentioned in the
previous sentence (though I should perhaps
have made it more clear, given the 'kinky sex
games' known as S&M)! But OTOH..

>..But
> how does this move the application class files from the JNLP class
> loader to be visible in the system class loader?


...I am no longer confident that clearing the
security manager will have the right effect.
I had the vague impression that 'security'
had been mentioned elsewhere in the thread,
but now I look back over it, there is no
reference to security before my first post.

(But you might as well try it, anyway.)

As far as replying to the bot goes. Don't
stress it. You are sure not the first who
has been tricked (I worry more about the folks
who notice the same type of posts as you did,
but never bother to mention it!).

--
Andrew Thompson
http://pscode.org/
 
Reply With Quote
 
none
Guest
Posts: n/a
 
      09-09-2008
Lionel van den Berg wrote:
> On Sep 7, 6:59 pm, Andrew Thompson <andrewtho...@gmail.com> wrote:
>> On Sep 7, 6:32 pm,Lionel<lione...@gmail.com> wrote:
>>
>>> Lionelwrote:

>> ...
>>>> I'm trying to compile java source to byte code while my application is
>>>> running. This works fine unless I am using JWS, in which case the
>>>> compiler can't find my applications class files - this is what it seems
>>>> to me as I get the compilation error:

>> ...
>>> Well I can at least confirm that it as a JWS problem. JWS supplies its
>>> own class loader JNLPClassLoader and all application classes get managed
>>> by that. Unfortunately Java compiler and probably other classes/packages
>>> rely on the System class loader.

>> Did you try setting the security manager to
>> null? That blows away the last remnants of
>> the SM. That is what I had* to resort to in
>> the JWS based version of the STBC**.

>
> What's "the SM"?


Sorry, security manager, that was a little obvious!
 
Reply With Quote
 
Lionel van den Berg
Guest
Posts: n/a
 
      09-10-2008
On Sep 9, 2:38*pm, Andrew Thompson <andrewtho...@gmail.com> wrote:
> On Sep 9, 9:10*am,Lionelvan den Berg <lion...@gmail.com> wrote:
>
> > On Sep 7, 6:59*pm, Andrew Thompson <andrewtho...@gmail.com> wrote:

> ...
> > > Did you try setting the security manager to
> > > null? *That blows away the last remnants of
> > > the SM. *That is what I had* to resort to in
> > > the JWS based version of the STBC**.

>
> > What's "the SM"? I'll give your suggestion a try and see how I go.

>
> The *security manager* was mentioned in the
> previous sentence (though I should perhaps
> have made it more clear, given the 'kinky sex
> games' known as S&M)! *But OTOH..
>
> >..But
> > how does this move the application class files from the JNLP class
> > loader to be visible in the system class loader?

>
> ..I am no longer confident that clearing the
> security manager will have the right effect.
> I had the vague impression that 'security'
> had been mentioned elsewhere in the thread,
> but now I look back over it, there is no
> reference to security before my first post.
>
> (But you might as well try it, anyway.)


I gave it a shot, no joy there, same error. I'll have to stick to my
convoluted approach that requires using the reflection API to call the
methods. Hopefully Sun acknowledges the bug I submitted. I would post
a link here but it hasn't been accepted yet, so I'll just cross my
fingers.

Your posts aren't making it through my news server for some reason. I
have to keep coming back into GG .
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compilation error with seperate compilation C__chp C++ 4 02-15-2008 03:57 PM
[JWS] How to specify a parameter to a JWS application? BdS Java 0 06-09-2004 09:00 AM
Problems with asp.net and jws Roberto Becerril ASP .Net Web Services 3 12-01-2003 06:23 AM
JWS and XML Manish Hatwalne Java 1 09-01-2003 06:48 AM
jws on orion server? Elhanan Maayan Java 4 08-03-2003 04:20 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57