Re: WARNING messages while compiling dll from jar using saxon fro class not found

Volker Berlin <[email protected]> Fri, 9 Jun 2017 00:02:03 +0200
Newsgroups gmane.comp.java.ikvm.devel
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============3226798830783466747==
Content-Type: multipart/alternative;
 boundary="------------382DF99FAB4E3FE737908007"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------382DF99FAB4E3FE737908007
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

What you do to try? You speek ever over Eclipse. I expect that you 
compile your program with Visual Studio or MSBuild.

 > ikvm_dynamic_assembly__769101500

This sounds also that you try to run with IKVM.exe and not with Visual 
Studio.

In general you can work with 2 modi:

  * ikvm.exe as replacment of java.exe. Then you work with jar files
  * Or you compile an exe with Visual Studio. Then you work only with dlls.

 > THe project classpath is included in FMXSLT.jar
IKVMC can like Visual Studio only compile with dll references that you 
set. Of course you can not link to a jar file. You can only link to 
another dll. For cyclic dependency you can compile multiple dlls in one 
step. All other needed dependecies must you set in the command line

 > My eclipse project contains other jar file too like (xercesImpl.jar 
and xalan.jar)
If you need this at runtime then you must also compile this jar files to 
dlls and add the resulting dlls as reference to the next compiler call.

Volker


Am 08.06.2017 um 21:40 schrieb Tilak Raj Singh:
> Hi Volker,
>
> I am new to ikvmc and hence not sure if I am firing the correct 
> command. THe project classpath is included in FMXSLT.jar and hence I 
> was hoping ikvmc would resolve the classes automatically by reading 
> that file from the jar.
>
> I even tried providing -classpath to saxon9he.jar with this command 
> which created FMXSLTJava.dll without any warnings but when running it 
> from my application I got a error as below
>
> [A]net.sf.saxon.Controller cannot be cast to 
> [B]net.sf.saxon.Controller. Type A originates from 
> 'ikvm_dynamic_assembly__769101500, Version=2017.608.1608.6942, 
> Culture=neutral, PublicKeyToken=null' in the context 'LoadNeither' in 
> a byte array. Type B originates from 'FMXSLTJava, Version=0.0.0.0, 
> Culture=neutral, PublicKeyToken=null' in the context 'Default' at 
> location 'base-path\FMXSLTJava.dll'.
>
> I also tried call ikvmc -debug -target:library -nostdlib 
> -lib:C:\Windows\Microsoft.NET\Framework\v4.0.30319 { saxon9he.jar } { 
> FMXSLTJava.jar } which created two dlls (saxon9he.dll and 
> FMXSLTJava.dll), but again on running with my app I got a similar 
> error as below
>
> [A]net.sf.saxon.Controller cannot be cast to 
> [B]net.sf.saxon.Controller. Type A originates from 
> 'ikvm_dynamic_assembly__769101500, Version=2017.608.1608.6942, 
> Culture=neutral, PublicKeyToken=null' in the context 'LoadNeither' in 
> a byte array. Type B originates from 'FMXSLTJava, Version=0.0.0.0, 
> Culture=neutral, PublicKeyToken=null' in the context 'Default' at 
> location 'base-path\saxon9he.dll'.
>
> My eclipse project contains other jar file too like (xercesImpl.jar 
> and xalan.jar) and it all used to work fine before....only after 
> introducing this particular code into my project I am facing this error.
>
> Thanks and Regards,
> Tilak Raj Singh
>
>
> On Fri, Jun 9, 2017 at 12:55 AM, Volker Berlin 
> <[email protected] <mailto:[email protected]>> 
> wrote:
>
>     I can not see that you give ikvmc any reference saxon9he.dll that
>     the error is expected.
>
>     And what you expected with the eclipse project classpath?
>
>     Volker
>
>
>     Am 08.06.2017 um 13:34 schrieb Tilak Raj Singh:
>>     Hi All,
>>
>>     I have a Java Application for xslt transformation which was
>>     compiling correctly using ikvmc and the dll generated was working
>>     fine in my app.
>>
>>     Now when I added a few lines of code to my java app as follows
>>
>>     if(tClassName.equalsIgnoreCase("net.sf.saxon.TransformerFactoryImpl"))
>>     ((net.sf.saxon.Controller)transformer).setMessageEmitter(new
>>     net.sf.saxon.serialize.MessageWarner());
>>
>>     and generating dll using the command
>>
>>     call ikvmc -debug -target:library -nostdlib
>>     -lib:C:\Windows\Microsoft.NET\Framework\v4.0.30319 FMXSLTJava.jar
>>     -out:FMXSLTJava.dll
>>
>>     following warning messages are being thrown
>>
>>     IKVM.NET <http://IKVM.NET> Compiler version 7.2.4630.5
>>     Copyright (C) 2002-2012 Jeroen Frijters
>>     http://www.ikvm.net/
>>
>>     warning IKVMC0123: Assuming assembly reference "System,
>>     Version=4.0.0.0, Culture=neutral,
>>     PublicKeyToken=b77a5c561934e089" matches "System,
>>     Version=2.0.0.0, Culture=neutral,
>>     PublicKeyToken=b77a5c561934e089", you may need to supply runtime
>>     policy
>>     warning IKVMC0100: Class "net.sf.saxon.Controller" not found
>>     warning IKVMC0100: Class "net.sf.saxon.serialize.MessageWarner"
>>     not found
>>     warning IKVMC0111: Emitted java.lang.NoClassDefFoundError in
>>     "FMJAXPInvoker.transform(Ljavax.xml.transform.Source;Ljavax.xml.transform.Source;Ljavax.xml.transform.Result;[Ljava.lang.String;)Z"
>>         ("net.sf.saxon.serialize.MessageWarner")
>>
>>     ignoring these messages as given on several other forums and
>>     proceeding to use this generated dll in my app causes it to crash
>>     on this particular line of code which I have inserted.
>>
>>     saxon9he.jar is embedded in this jar file I am using here. Also
>>     the eclipse project classpath contains the path to the jar file
>>     correctly. Jar is also being generated without any error.
>>
>>     Can anyone provide some pointers on how do I procedd to resolve this?
>>
>>     Thanks and Regards,
>>     Tilak Raj Singh
>>
>>
>>
>>     ------------------------------------------------------------------------------
>>     Check out the vibrant tech community on one of the world's most
>>     engaging tech sites, Slashdot.org!http://sdm.link/slashdot
>>
>>
>>     _______________________________________________
>>     Ikvm-developers mailing list
>>     [email protected]
>>     <mailto:[email protected]>
>>     https://lists.sourceforge.net/lists/listinfo/ikvm-developers
>>     <https://lists.sourceforge.net/lists/listinfo/ikvm-developers>
>
>


--------------382DF99FAB4E3FE737908007
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi,</p>
    <p>What you do to try? You speek ever over Eclipse. I expect that
      you compile your program with Visual Studio or MSBuild.</p>
    <p>&gt; ikvm_dynamic_assembly__769101500</p>
    <p>This sounds also that you try to run with IKVM.exe and not with
      Visual Studio.<br>
    </p>
    In general you can work with 2 modi:<br>
    <ul>
      <li>ikvm.exe as replacment of java.exe. Then you work with jar
        files</li>
      <li>Or you compile an exe with Visual Studio. Then you work only
        with dlls.<br>
      </li>
    </ul>
    &gt; THe project classpath is included in FMXSLT.jar<br>
    IKVMC can like Visual Studio only compile with dll references that
    you set. Of course you can not link to a jar file. You can only link
    to another dll. For cyclic dependency you can compile multiple dlls
    in one step. All other needed dependecies must you set in the
    command line<br>
    <br>
    &gt; My eclipse project contains other jar file too like
    (xercesImpl.jar and xalan.jar)<br>
    If you need this at runtime then you must also compile this jar
    files to dlls and add the resulting dlls as reference to the next
    compiler call.<br>
    <br>
    Volker<br>
    <br>
    <br>
    <div class="moz-cite-prefix">Am 08.06.2017 um 21:40 schrieb Tilak
      Raj Singh:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOktwS-HMz8_QTqQN-8rCepx4U8wEXWkXmN4YkbP2mrrn5tcpQ@mail.gmail.com">
      <div dir="ltr">Hi Volker,
        <div><br>
        </div>
        <div>I am new to ikvmc and hence not sure if I am firing the
          correct command. THe project classpath is included in
          FMXSLT.jar and hence I was hoping ikvmc would resolve the
          classes automatically by reading that file from the jar.</div>
        <div><br>
        </div>
        <div>I even tried providing -classpath to saxon9he.jar with this
          command which created FMXSLTJava.dll without any warnings but
          when running it from my application I got a error as below</div>
        <div><br>
        </div>
        <div>[A]net.sf.saxon.Controller cannot be cast to
          [B]net.sf.saxon.Controller. Type A originates from
          'ikvm_dynamic_assembly__769101500, Version=2017.608.1608.6942,
          Culture=neutral, PublicKeyToken=null' in the context
          'LoadNeither' in a byte array. Type B originates from
          'FMXSLTJava, Version=0.0.0.0, Culture=neutral,
          PublicKeyToken=null' in the context 'Default' at location
          'base-path\FMXSLTJava.dll'.<br>
        </div>
        <div><br>
        </div>
        <div>I also tried <span style="font-size:12.8px">call ikvmc
            -debug -target:library -nostdlib
            -lib:C:\Windows\Microsoft.NET\</span><wbr
            style="font-size:12.8px"><span style="font-size:12.8px">Framework\v4.0.30319
            { saxon9he.jar } { FMXSLTJava.jar } which created two dlls
            (saxon9he.dll and FMXSLTJava.dll), but again on running with
            my app I got a similar error as below</span></div>
        <div><span style="font-size:12.8px"><br>
          </span></div>
        <div>
          <div>[A]net.sf.saxon.Controller cannot be cast to
            [B]net.sf.saxon.Controller. Type A originates from
            'ikvm_dynamic_assembly__769101500,
            Version=2017.608.1608.6942, Culture=neutral,
            PublicKeyToken=null' in the context 'LoadNeither' in a byte
            array. Type B originates from 'FMXSLTJava, Version=0.0.0.0,
            Culture=neutral, PublicKeyToken=null' in the context
            'Default' at location 'base-path\saxon9he.dll'.<br>
          </div>
        </div>
        <div><br>
        </div>
        <div>My eclipse project contains other jar file too like
          (xercesImpl.jar and xalan.jar) and it all used to work fine
          before....only after introducing this particular code into my
          project I am facing this error.</div>
        <div><br>
        </div>
        <div>Thanks and Regards,</div>
        <div>Tilak Raj Singh</div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Fri, Jun 9, 2017 at 12:55 AM, Volker
          Berlin <span dir="ltr">&lt;<a
              href="mailto:[email protected]" target="_blank"
              moz-do-not-send="true">[email protected]</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF">
              <p>I can not see that you give ikvmc any reference
                saxon9he.dll that the error is expected.</p>
              <p>And what you expected with the eclipse project
                classpath? <br>
              </p>
              Volker
              <div>
                <div class="h5"><br>
                  <br>
                  <div class="m_2518658352095596822moz-cite-prefix">Am
                    08.06.2017 um 13:34 schrieb Tilak Raj Singh:<br>
                  </div>
                </div>
              </div>
              <blockquote type="cite">
                <div>
                  <div class="h5">
                    <div dir="ltr">Hi All,
                      <div><br>
                      </div>
                      <div>I have a Java Application for xslt
                        transformation which was compiling correctly
                        using ikvmc and the dll generated was working
                        fine in my app.</div>
                      <div><br>
                      </div>
                      <div>Now when I added a few lines of code to my
                        java app as follows </div>
                      <div><br>
                      </div>
                      <div>
                        <div>if(tClassName.<wbr>equalsIgnoreCase("net.sf.<wbr>saxon.TransformerFactoryImpl")<wbr>)</div>
                        <div><span class="m_2518658352095596822gmail-Apple-tab-span" style="white-space:pre-wrap">			</span>((net.sf.saxon.Controller)<wbr>transformer).<wbr>setMessageEmitter(new
                          net.sf.saxon.serialize.<wbr>MessageWarner());</div>
                      </div>
                      <div><br>
                      </div>
                      <div>and generating dll using the command </div>
                      <div><br>
                      </div>
                      <div>call ikvmc -debug -target:library -nostdlib
                        -lib:C:\Windows\Microsoft.NET\<wbr>Framework\v4.0.30319
                        FMXSLTJava.jar -out:FMXSLTJava.dll<br>
                      </div>
                      <div><br>
                      </div>
                      <div>following warning messages are being thrown</div>
                      <div><br>
                      </div>
                      <div>
                        <div><a href="http://IKVM.NET" target="_blank"
                            moz-do-not-send="true">IKVM.NET</a> Compiler
                          version 7.2.4630.5</div>
                        <div>Copyright (C) 2002-2012 Jeroen Frijters</div>
                        <div><a href="http://www.ikvm.net/"
                            target="_blank" moz-do-not-send="true">http://www.ikvm.net/</a></div>
                        <div><br>
                        </div>
                        <div>warning IKVMC0123: Assuming assembly
                          reference "System, Version=4.0.0.0,
                          Culture=neutral, PublicKeyToken=<wbr>b77a5c561934e089"
                          matches "System, Version=2.0.0.0,
                          Culture=neutral, PublicKeyToken=<wbr>b77a5c561934e089",
                          you may need to supply runtime policy</div>
                        <div>warning IKVMC0100: Class
                          "net.sf.saxon.Controller" not found</div>
                        <div>warning IKVMC0100: Class
                          "net.sf.saxon.serialize.<wbr>MessageWarner"
                          not found</div>
                        <div>warning IKVMC0111: Emitted
                          java.lang.NoClassDefFoundError in
                          "FMJAXPInvoker.transform(<wbr>Ljavax.xml.transform.Source;<wbr>Ljavax.xml.transform.Source;<wbr>Ljavax.xml.transform.Result;[<wbr>Ljava.lang.String;)Z"</div>
                        <div>    ("net.sf.saxon.serialize.<wbr>MessageWarner")</div>
                      </div>
                      <div><br>
                      </div>
                      <div>ignoring these messages as given on several
                        other forums and proceeding to use this
                        generated dll in my app causes it to crash on
                        this particular line of code which I have
                        inserted.</div>
                      <div><br>
                      </div>
                      <div>saxon9he.jar is embedded in this jar file I
                        am using here. Also the eclipse project
                        classpath contains the path to the jar file
                        correctly. Jar is also being generated without
                        any error.</div>
                      <div><br>
                      </div>
                      <div>Can anyone provide some pointers on how do I
                        procedd to resolve this?</div>
                      <div><br>
                      </div>
                      <div>Thanks and Regards,</div>
                      <div>Tilak Raj Singh</div>
                      <div><br>
                      </div>
                    </div>
                    <br>
                    <fieldset
                      class="m_2518658352095596822mimeAttachmentHeader"></fieldset>
                    <br>
                  </div>
                </div>
                <pre>------------------------------<wbr>------------------------------<wbr>------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! <a class="m_2518658352095596822moz-txt-link-freetext" href="http://sdm.link/slashdot" target="_blank" moz-do-not-send="true">http://sdm.link/slashdot</a></pre>
                <br>
                <fieldset
                  class="m_2518658352095596822mimeAttachmentHeader"></fieldset>
                <br>
                <pre>______________________________<wbr>_________________
Ikvm-developers mailing list
<a class="m_2518658352095596822moz-txt-link-abbreviated" href="mailto:[email protected]" target="_blank" moz-do-not-send="true">Ikvm-developers@lists.<wbr>sourceforge.net</a>
<a class="m_2518658352095596822moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/ikvm-developers" target="_blank" moz-do-not-send="true">https://lists.sourceforge.net/<wbr>lists/listinfo/ikvm-developers</a>
</pre>
              </blockquote>
              <br>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>

--------------382DF99FAB4E3FE737908007--


--===============3226798830783466747==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
--===============3226798830783466747==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Ikvm-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

--===============3226798830783466747==--