Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Xalan installation fails / Java problem [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Implication
n00b
n00b


Joined: 07 Mar 2005
Posts: 14

PostPosted: Mon Mar 07, 2005 5:06 pm    Post subject: Xalan installation fails / Java problem [SOLVED] Reply with quote

Hi,

when I try to emerge xalan-2.6.0 I get the following error

Code:

xml.compile:
     [echo] Compiling DTM implementation and utilities
    [javac] Compiling 186 source files to /var/tmp/portage/xalan-2.6.0/work/xalan-j_2_6_0/build/classes
    [javac] javac: target release 1.1 conflicts with default source release 1.5


The reason for this is, that the default value of "source" changed with java 1.5.
(As described here:
http://forum.java.sun.com/thread.jspa?threadID=534086&messageID=2601838
http://stefanbodewig.blogger.de/stories/213538/ )
It would be necessary to set it manually in the ant build file. I tried to do that, but of course, emerge overwrites the changes when I next try to emerge it.

Therefore I next installed java 1.4.2 and now get the following error, when emerging xalan:
Code:

BUILD FAILED
java.lang.UnsupportedClassVersionError: org/apache/xerces/jaxp/SAXParserFactoryImpl (Unsupported major.minor version 49.0)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
...

The reason for this seems to be that I compiled a lot of stuff with java 1.5 and there are conflicts.
(As described here:
https://forums.gentoo.org/viewtopic-t-280441-view-next.html)
This guy solved the problem by recompiling all java stuff.

My question now, what can I do about it? Is recompiling all java really the only solution? And if yes, how do I do that? Since I installed programms like tomcat and ant (huge dependencies) before, I certainly lost track of the java-related packages I have installed. Is there some magic emerge command for doing that?

Many thanks,

John


Last edited by Implication on Tue Mar 08, 2005 2:30 pm; edited 2 times in total
Back to top
View user's profile Send private message
Sorcerer'sApprentice
Tux's lil' helper
Tux's lil' helper


Joined: 15 Jan 2005
Posts: 121
Location: Jesus College, Cambridge, England

PostPosted: Mon Mar 07, 2005 5:25 pm    Post subject: Reply with quote

I solved similar problems to your first error as follows:

    Copy relevant archive from /usr/portage/distfiles to your home directory, and unpack.
    Edit the build.xml file so that target = 1.5
    Repack the archive, and move back to /usr/portage/distfiles
    ebuild /usr/portage/<package-category>/<package-name> digest
    emerge <package-name>


I know it's ugly and time consuming, but so far it works.
_________________
"One of the major problems encountered in time travel is not that of accidentally becoming your own father or mother ... The major problem is quite simply one of grammar..."

Douglas Adams
Back to top
View user's profile Send private message
Implication
n00b
n00b


Joined: 07 Mar 2005
Posts: 14

PostPosted: Mon Mar 07, 2005 6:08 pm    Post subject: Reply with quote

The source/target problem can be solved by this. Unfortunately it still does not work.

Code:

xml.compile:
     [echo] Compiling DTM implementation and utilities
    [javac] Compiling 186 source files to /var/tmp/portage/xalan-2.6.0/work/xalan-j_2_6_0/build/classes
    [javac] /var/tmp/portage/xalan-2.6.0/work/xalan-j_2_6_0/src/org/apache/xml/dtm/DTMException.java:345: warning: non-varargs call of varargs method with inexact argument type for last parameter;
    [javac] cast to java.lang.Class for a varargs call
    [javac] cast to java.lang.Class[] for a non-varargs call and to suppress this warning
    [javac]                         null);
    [javac]                         ^
    [javac] /var/tmp/portage/xalan-2.6.0/work/xalan-j_2_6_0/src/org/apache/xml/dtm/DTMException.java:350: warning: non-varargs call of varargs method with inexact argument type for last parameter;
    [javac] cast to java.lang.Object for a varargs call
    [javac] cast to java.lang.Object[] for a non-varargs call and to suppress this warning
    [javac]                     exception = (Throwable) meth.invoke(exception, null);
    [javac]                                                                    ^
    [javac] /var/tmp/portage/xalan-2.6.0/work/xalan-j_2_6_0/src/org/apache/xml/dtm/ref/DTMNodeProxy.java:54: org.apache.xml.dtm.ref.DTMNodeProxy is not abstract and does not override abstract method getUserData(java.lang.String) in org.w3c.dom.Node
    [javac] public class DTMNodeProxy
    [javac]        ^
    [javac] /var/tmp/portage/xalan-2.6.0/work/xalan-j_2_6_0/src/org/apache/xml/dtm/ref/DTMNodeProxy.java:1327: org.apache.xml.dtm.ref.DTMNodeProxy.DTMNodeProxyImplementation is not abstract and does not override abstract method getFeature(java.lang.String,java.lang.String) in org.w3c.dom.DOMImplementation
    [javac]   static class DTMNodeProxyImplementation implements DOMImplementation
    [javac]          ^
    [javac] /var/tmp/portage/xalan-2.6.0/work/xalan-j_2_6_0/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java:48: org.apache.xml.dtm.ref.dom2dtm.DOM2DTMdefaultNamespaceDeclarationNode is not abstract and does not override abstract method isId() in org.w3c.dom.Attr
    [javac] public class DOM2DTMdefaultNamespaceDeclarationNode implements Attr
    [javac]        ^
    [javac] /var/tmp/portage/xalan-2.6.0/work/xalan-j_2_6_0/src/org/apache/xml/utils/UnImplNode.java:44: org.apache.xml.utils.UnImplNode is not abstract and does not override abstract method getUserData(java.lang.String) in org.w3c.dom.Node
    [javac] public class UnImplNode implements Node, Element, NodeList, Document
    [javac]        ^
    [javac] Note: * uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 4 errors
    [javac] 2 warnings

It seems to expect another version of w3c DOM. I guess there is little hope of getting it to run with java 1.5. :(

Any hints about the recompilaton?
Back to top
View user's profile Send private message
Sorcerer'sApprentice
Tux's lil' helper
Tux's lil' helper


Joined: 15 Jan 2005
Posts: 121
Location: Jesus College, Cambridge, England

PostPosted: Mon Mar 07, 2005 9:04 pm    Post subject: Reply with quote

No sorry.:( The errors that you are getting seem rather odd to me. I can't really see how the 1.5 compiler is to blame for them. If the output is correct, then they probably should not compile on any JDK version.
_________________
"One of the major problems encountered in time travel is not that of accidentally becoming your own father or mother ... The major problem is quite simply one of grammar..."

Douglas Adams
Back to top
View user's profile Send private message
Implication
n00b
n00b


Joined: 07 Mar 2005
Posts: 14

PostPosted: Mon Mar 07, 2005 9:37 pm    Post subject: Reply with quote

The errors reflect, that the w3c dom implementation changed in java 1.5.
For example Node does not have a method "getUserData" in java 1.4
(http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Node.html)
which was introduced in 1.5
(http://java.sun.com/j2se/1.5.0/docs/api/org/w3c/dom/Node.html).
Code:

    [javac] /var/tmp/portage/xalan-2.6.0/work/xalan-j_2_6_0/src/org/apache/xml/dtm/ref/DTMNodeProxy.java:54: org.apache.xml.dtm.ref.DTMNodeProxy is not abstract and does not override abstract method getUserData(java.lang.String) in org.w3c.dom.Node

Therefore when a xalan class tries to implement Node, some methods are left unimplemented. Hmm. I wonder if it would be sufficient to add empty methods stubs into these classes.

Thank you for your help so far. :)
Back to top
View user's profile Send private message
Implication
n00b
n00b


Joined: 07 Mar 2005
Posts: 14

PostPosted: Tue Mar 08, 2005 2:35 pm    Post subject: Reply with quote

Fixing errors in xalan proofed fruitless as expected.

The reinstallation of "everything java" worked quite nicely with
Code:

qpkg -I -v | grep java
emerge --unmerge
emerge --noreplace

in combination with a bash script.

Now I like my Gentoo again. :D
Back to top
View user's profile Send private message
shredz
Apprentice
Apprentice


Joined: 05 Feb 2004
Posts: 215
Location: Antwerp

PostPosted: Thu Mar 10, 2005 1:27 pm    Post subject: Reply with quote

I need an eclipse plugin that will ONLY work on java 1.5
Do you people suppose I will run into problems considering eclipse will want ant which can only work on a 1.4.2 installed system (as shown above) ?

(the german topic I found says to install eclipse on 1.4.2 and then point eclipse to 1.5 to use that one, but I only figured it from guessing half the german words so any reply is still welcome...)
Back to top
View user's profile Send private message
Implication
n00b
n00b


Joined: 07 Mar 2005
Posts: 14

PostPosted: Thu Mar 10, 2005 2:59 pm    Post subject: Reply with quote

I can't really say for sure, because I am using a not-emerged version directly from eclipse.org (from an old installation). I am also not sure how the ant issue is connected to this, because eclipse uses its own (plugined) version of ant.
However, I guess that the eclipse-project people also compile with a 1.4 java and it runs on my system when pointed to 1.5.

To make sure, perhaps you could give a link to the german thread you have found. I happen to be german. :wink:
Back to top
View user's profile Send private message
shredz
Apprentice
Apprentice


Joined: 05 Feb 2004
Posts: 215
Location: Antwerp

PostPosted: Thu Mar 10, 2005 7:31 pm    Post subject: Reply with quote

Great, that might help :)

https://forums.gentoo.org/viewtopic-t-304946-highlight-xalan.html
Back to top
View user's profile Send private message
Implication
n00b
n00b


Joined: 07 Mar 2005
Posts: 14

PostPosted: Thu Mar 10, 2005 9:13 pm    Post subject: Reply with quote

I think you understood it pretty well. Did you learn german in school or did you figure with dutch-german similarities? :D

To summarise it, this guy had the same problem with xalan (when emergeing eclipse) I had (when emerging the xalan ebuild). They agreed it is the java 1.5 to java 1.4 incompatability.
The solution was, as you expected, to set java to 1.4 with java-config, set it up again after the installation and point eclipse to java 1.5 afterwards.
Back to top
View user's profile Send private message
shredz
Apprentice
Apprentice


Joined: 05 Feb 2004
Posts: 215
Location: Antwerp

PostPosted: Fri Mar 11, 2005 7:19 am    Post subject: Reply with quote

Yea that worked like a charm, thanks. I still get some errors on annotations in the editor though, but not really in a consistent matter. Guess the next eclipse version will fix this.

PS I just figured dutch-german similarities as I never learned any german :)
Back to top
View user's profile Send private message
elykyllek
Tux's lil' helper
Tux's lil' helper


Joined: 16 Sep 2002
Posts: 103
Location: Halifax, Nova Scotia, Canada

PostPosted: Fri Mar 11, 2005 2:48 pm    Post subject: Reply with quote

I'm having the same problem, but when I set java-config back to a 1.4 jdk and try to compile xalan I get this error:
Code:

Buildfile: build.xml

BUILD FAILED
java.lang.UnsupportedClassVersionError: org/apache/xerces/jaxp/SAXParserFactoryImpl (Unsupported major.minor version 49.0)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:93)
        at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:174)
        at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:87)
        at org.apache.tools.ant.util.JAXPUtils.newParserFactory(JAXPUtils.java:114)
        at org.apache.tools.ant.util.JAXPUtils.getNSParserFactory(JAXPUtils.java:100)
        at org.apache.tools.ant.util.JAXPUtils.getNamespaceXMLReader(JAXPUtils.java:163)
        at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:184)
        at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:131)
        at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:91)
        at org.apache.tools.ant.Main.runBuild(Main.java:658)
        at org.apache.tools.ant.Main.startAnt(Main.java:188)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)

Total time: 0 seconds
java.lang.UnsupportedClassVersionError: org/apache/xerces/jaxp/SAXParserFactoryImpl (Unsupported major.minor version 49.0)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:93)
        at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:174)
        at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:87)
        at org.apache.tools.ant.util.JAXPUtils.newParserFactory(JAXPUtils.java:114)
        at org.apache.tools.ant.util.JAXPUtils.getNSParserFactory(JAXPUtils.java:100)
        at org.apache.tools.ant.util.JAXPUtils.getNamespaceXMLReader(JAXPUtils.java:163)
        at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:184)
        at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:131)
        at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:91)
        at org.apache.tools.ant.Main.runBuild(Main.java:658)
        at org.apache.tools.ant.Main.startAnt(Main.java:188)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
org/apache/xerces/jaxp/SAXParserFactoryImpl (Unsupported major.minor version 49.0)


Any ideas?
Back to top
View user's profile Send private message
Implication
n00b
n00b


Joined: 07 Mar 2005
Posts: 14

PostPosted: Fri Mar 11, 2005 3:06 pm    Post subject: Reply with quote

Well that's exactly the same problem I encountered (and described above).

The only solution I have seen for this is to uninstall and recompile all java related programms. But that is described above, right?
Back to top
View user's profile Send private message
shredz
Apprentice
Apprentice


Joined: 05 Feb 2004
Posts: 215
Location: Antwerp

PostPosted: Fri Mar 11, 2005 3:21 pm    Post subject: Reply with quote

Yes, setting java back to 1.4 and not recompiling previous builds won't work. The solution above kinda overdoes it by remerging EVERYTHING java... which includes the jdk's themselves for instance.
Back to top
View user's profile Send private message
elykyllek
Tux's lil' helper
Tux's lil' helper


Joined: 16 Sep 2002
Posts: 103
Location: Halifax, Nova Scotia, Canada

PostPosted: Fri Mar 11, 2005 3:24 pm    Post subject: Reply with quote

Ok, thanks for the clarification.

Implication would you mind posting the bash script you used to recompile everything java? (if you still have it)

Thanks
Back to top
View user's profile Send private message
Implication
n00b
n00b


Joined: 07 Mar 2005
Posts: 14

PostPosted: Fri Mar 11, 2005 4:37 pm    Post subject: Reply with quote

Ups, I forgot to mention to ignore the jdks. Would not make sense to re-emerge those, of course.
I'll see if I can find the script when I am home.
Back to top
View user's profile Send private message
Implication
n00b
n00b


Joined: 07 Mar 2005
Posts: 14

PostPosted: Fri Mar 11, 2005 5:21 pm    Post subject: Reply with quote

I could not find the original script I used, but the following should work.
:!: However, definitely make a backup-list of the installed packages before executing the script. Otherwise if an installation step fails, all java packages will be removed and you wont know which to install anymore (except for some emerge log-files which probably would tell, but I don't know about that stuff).

So I would recommend that you save the list of packages like that.
Code:

 qpkg -nc -I -v | grep java | grep -v jdk | grep -v java-conf > packages.txt


And then if you feel confident about my script. :wink:
Code:

#!/bin/bash

tmp=$(qpkg -nc -I -v | grep java | grep -v jdk | grep -v java-config)
for i in $tmp; do
    echo emerge --unmerge $i
    #emerge --unmerge $i
done
for i in $tmp; do
    echo emerge --noreplace =$i
    #emerge --noreplace =$i
done

You can execute it like this first and see if the commands are what you intend. Then if you are sure you know what you are doing uncomment the emerge commands.

As a disclaimer, if you don't understand what the script is doing or can't recover from the errors if it fails, I would not advise you to use it. I am not an expert, no garantuees. 8)
Back to top
View user's profile Send private message
elykyllek
Tux's lil' helper
Tux's lil' helper


Joined: 16 Sep 2002
Posts: 103
Location: Halifax, Nova Scotia, Canada

PostPosted: Fri Mar 11, 2005 6:07 pm    Post subject: Reply with quote

Thanks!

Probably adding --oneshot to the emerge line would be recommended as well. No need to put all of them in your world file.

Thanks again.
Back to top
View user's profile Send private message
voltairien
Tux's lil' helper
Tux's lil' helper


Joined: 24 Apr 2004
Posts: 123

PostPosted: Tue Mar 15, 2005 2:41 pm    Post subject: Reply with quote

Implication wrote:
set java to 1.4 with java-config


How do you do that ?
I have modify the version number in build.xml for 1.5, and now i have the second error (DOM). But i can't resolv it ... :-(
What is the syntax for java-config to set 1.4 ?

I have try to unmerge/emerge "all Java" but it didn't works for me. Do i have to use the java-config ?
Thx.
V
_________________
[Les Mechants] Voltairien
Back to top
View user's profile Send private message
Implication
n00b
n00b


Joined: 07 Mar 2005
Posts: 14

PostPosted: Tue Mar 15, 2005 5:50 pm    Post subject: Reply with quote

To list installed vms.
Code:

root@myhost # java-config --list-available-vms
[sun-jdk-1.5.0] "Sun JDK 1.5.0" (/etc/env.d/java/20sun-jdk-1.5.0)
[sun-jdk-1.4.2.07] "Sun JDK 1.4.2.07" (/etc/env.d/java/20sun-jdk-1.4.2.07) *


To set vm:
Code:

root@myhost # java-config --set-system-vm=sun-jdk-1.4.2.07
System Virtual Machine set
You may want to update your enviroment by running:
        "/usr/sbin/env-update && source /etc/profile"


If you modified the build.xml, be aware that you have to undo any changes (and recreate the digest). Otherwise an installation with 1.4 will fail (since it cannot understand a source/taget=1.5 argument).
Back to top
View user's profile Send private message
voltairien
Tux's lil' helper
Tux's lil' helper


Joined: 24 Apr 2004
Posts: 123

PostPosted: Tue Mar 15, 2005 6:08 pm    Post subject: Reply with quote

Ok, so we have to install 2 differents versions of sun-jdk ... thx.
V.
_________________
[Les Mechants] Voltairien
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum