JWS and dynamic compilation

Discussion in 'Java' started by Lionel, Aug 26, 2008.

  1. Lionel

    Lionel Guest

    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.CommonDerivnFunction")
    .getName());

    Is successful.

    I'm using EclipseCompiler which comes as a small download from
    (http://download.eclipse.org/eclipse/downloads/drops/R-3.4-200806172000/index.php#JDTCORE)
    and implements the JavaCompiler interface.

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

    Thanks

    Lionel.
     
    Lionel, Aug 26, 2008
    #1
    1. Advertising

  2. Lionel

    Lionel Guest

    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.
     
    Lionel, Sep 7, 2008
    #2
    1. Advertising

  3. On Sep 7, 6:32 pm, Lionel <> 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/
     
    Andrew Thompson, Sep 7, 2008
    #3
  4. Lionel

    Lionel Guest

    Andrew Thompson wrote:
    > On Sep 7, 6:32=A0pm, Edwin <> 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!
     
    Lionel, Sep 8, 2008
    #4
  5. On Sep 8, 6:02 pm, Lionel <> 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/
     
    Andrew Thompson, Sep 8, 2008
    #5
  6. On Sep 8, 6:12 pm, Andrew Thompson <> wrote:
    > On Sep 8, 6:02 pm,Lionel<> 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.
     
    Lionel van den Berg, Sep 9, 2008
    #6
  7. On Sep 7, 6:59 pm, Andrew Thompson <> wrote:
    > On Sep 7, 6:32 pm,Lionel<> 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.
     
    Lionel van den Berg, Sep 9, 2008
    #7
  8. On Sep 9, 9:10 am, Lionel van den Berg <> wrote:
    > On Sep 7, 6:59 pm, Andrew Thompson <> 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/
     
    Andrew Thompson, Sep 9, 2008
    #8
  9. Lionel

    none Guest

    Lionel van den Berg wrote:
    > On Sep 7, 6:59 pm, Andrew Thompson <> wrote:
    >> On Sep 7, 6:32 pm,Lionel<> 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!
     
    none, Sep 9, 2008
    #9
  10. On Sep 9, 2:38 pm, Andrew Thompson <> wrote:
    > On Sep 9, 9:10 am,Lionelvan den Berg <> wrote:
    >
    > > On Sep 7, 6:59 pm, Andrew Thompson <> 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 :(.
     
    Lionel van den Berg, Sep 10, 2008
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Elhanan Maayan

    jws on orion server?

    Elhanan Maayan, Jul 27, 2003, in forum: Java
    Replies:
    4
    Views:
    456
    Andrew Thompson
    Aug 3, 2003
  2. Manish Hatwalne

    JWS and XML

    Manish Hatwalne, Sep 1, 2003, in forum: Java
    Replies:
    1
    Views:
    469
    Manish Hatwalne
    Sep 1, 2003
  3. Tim Jowers

    JWS 1.2

    Tim Jowers, Sep 8, 2003, in forum: Java
    Replies:
    0
    Views:
    539
    Tim Jowers
    Sep 8, 2003
  4. BdS
    Replies:
    0
    Views:
    382
  5. Roberto Becerril

    Problems with asp.net and jws

    Roberto Becerril, Nov 27, 2003, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    145
    Saurabh Nandu
    Dec 1, 2003
Loading...

Share This Page