public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "mohsens at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug java/31647]  New: Embedded class dependencies cannot be loaded dynamically from a staic binary
Date: Sat, 21 Apr 2007 13:14:00 -0000	[thread overview]
Message-ID: <bug-31647-14129@http.gcc.gnu.org/bugzilla/> (raw)

I compiled statically an application with dependencies to javax.xml.parser
using GCJ, replacing DocumentBuilderFactory.newInstance() with new
DomDocumentBuilderFactory() (with -static-gcj switch).

By bad fortune, there is no DomDocumentBuilderFactory entry in the output of
command:
nm --demangle=java myapp.executable

I extracted a portion of libgcj-4.2.0.jar (the whole content of gnu.xml.*
package), say gcj-dom.jar, and compiled and linked it with my application. The
result executable has DomDocumentBuilderFactory but this time I'm facing with
NoClassDefFoundError for gnu.xml.dom.DomImpl.

Again I put the trivial code new DomImpl() and linked the app. This time again
I'm facing with:
java.lang.NoClassDefFoundError: gnu.xml.dom.DomImpl
java.lang.Class.initializeClass(zekr_static_olpc.exe)
gnu.xml.dom.ImplementationSource.<clinit>(zekr_static_olpc.exe)
java.lang.Class.initializeClass(zekr_static_olpc.exe)
java.lang.Class.newInstance(zekr_static_olpc.exe)
org.w3c.dom.bootstrap.DOMImplementationRegistry.newInstance(zekr_static_olpc.exe)
gnu.xml.dom.DomDocumentBuilderFactory.<init>(zekr_static_olpc.exe)
net.sf.zekr.engine.xml.XmlReader.<init>(zekr_static_olpc.exe)
net.sf.zekr.common.config.ApplicationConfig.extractLangProps(zekr_static_olpc.exe)
...

It's strange that although there exists some entry for gnu.xml.dom.DomImpl
with:
nm --demangle=java myapp.exe
it gives me that error.

I should also say that I tried to embed xercesImpl.jar with my app, setting:
-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
so that it uses xerces instead of gnu.xml.*. It gives me again a
NoClassDefFoundError.

It seems that even when a class is embedded in a static binary, class loader
(java.lang.Class.initializeClass()) cannot load that.

I used this on Ubuntu 6.10 (Edgy); GCC version is 4.1.2 (2006-9-28 prerelease,
Ubuntu 4.1.1.14ubuntu7)

Here is some posts on GCJ mailing list regarding this problem:
- http://www.nabble.com/libgcj_bc.so-not-embedded-t3538410.html
- http://www.nabble.com/libgcj_bc.so-not-embedded-t3538410i20.html
-
http://www.nabble.com/Trying-to-embed-gnu.xml.dom.DomDocumentBuilderFactory-t3608745.html


-- 
           Summary: Embedded class dependencies cannot be loaded dynamically
                    from a staic binary
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mohsens at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31647


                 reply	other threads:[~2007-04-21 13:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31647-14129@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).