Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.0-rc2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      Linux, JDK1.4.2
    • Number of attachments :
      1

      Description

      I have a Java app that I want to invoke via Maven. The Java app uses stdin and stdout.

      If I invoke using ant:java using "fork=true" then stdin doesn not respond correctly. That is, the app prompts, but the user can type to their hearts content and nothing reaches the app.

      If I invoke using ant:java using "fork=false" then I get strange XML related errors about unresolved references org/w3c/dom/Node, org/w3c/dom/Document

        Activity

        Hide
        Brett Porter added a comment -

        more succinct report: MAVEN-1425

        Show
        Brett Porter added a comment - more succinct report: MAVEN-1425
        Hide
        Andy Jefferson added a comment -

        Hi,
        this was closed in March (didnt receive a notification) and finally came back to the issue. I read the "more succinct report" that it refers to and the "solution" does nothing for me. How am i to use ant:java with fork=false and avoid the xml-apis messages ? How am I to use ant:java with fork=true and get the input ? What do i pass in to the "InputHandler" ? Point me to a doc at least that defines this, please

        Is this fixed in Maven 1.1-beta-X for ant fork=false ? No, I dont use Maven 2 yet. Would it work there ?

        Show
        Andy Jefferson added a comment - Hi, this was closed in March (didnt receive a notification) and finally came back to the issue. I read the "more succinct report" that it refers to and the "solution" does nothing for me. How am i to use ant:java with fork=false and avoid the xml-apis messages ? How am I to use ant:java with fork=true and get the input ? What do i pass in to the "InputHandler" ? Point me to a doc at least that defines this, please Is this fixed in Maven 1.1-beta-X for ant fork=false ? No, I dont use Maven 2 yet. Would it work there ?
        Hide
        Arnaud Heritier added a comment -

        Hi andy,

        I'm sorry but we need to force maven and its plugin to use a known version (for us) of the XML APIs (xml-apis 1.3.03 + xml-resolver 1.1 + xercesImpl 2.8.0). For that we are defining these APIs in the endorsed libraries which create a conflict with your own if you don't fork the JVM.
        As said in the issue MAVEN-1425, did you try to use $

        {pom.getAntProject().setInputHandler(...)}

        ?

        Show
        Arnaud Heritier added a comment - Hi andy, I'm sorry but we need to force maven and its plugin to use a known version (for us) of the XML APIs (xml-apis 1.3.03 + xml-resolver 1.1 + xercesImpl 2.8.0). For that we are defining these APIs in the endorsed libraries which create a conflict with your own if you don't fork the JVM. As said in the issue MAVEN-1425 , did you try to use $ {pom.getAntProject().setInputHandler(...)} ?
        Hide
        Andy Jefferson added a comment -

        Hi Arnaud,
        so if i dont want to fork the JVM (and I dont see why I should since I want console input from my sample application), what do i need to do in maven.xml ? or project.xml ?

        I have (in maven.xml)
        <ant:java dir="$

        {basedir}" classname="org.jpox.samples.hello.Main" failonerror="true" fork="false">
        <classpath refid="myclasspath"/>
        <jvmarg value="-Dlog4j.configuration=file:${basedir}

        /log4j.properties"/>
        </ant:java>

        With fork=false I just tried adding your versions of xml-apis, xml-resolver, xercesImpl to project.xml (previously I had nothing specified for those – just entries for my own app jars) and I get
        java.lang.NoClassDefFoundError: sun/reflect/ConstructorAccessorImpl
        (using JDK 1.4.2_11)

        With fork=true, then it never reads the console input. What do i do to get Ant to read from the console when fork=true ? What do I specify in this setInputHandler ? (in the above maven.xml snippet)

        All I want to do is run a sample (Java) app that uses console input via Maven. It works via an Ant task (using fork=false) so I dont see a good reason why not with Maven.

        Show
        Andy Jefferson added a comment - Hi Arnaud, so if i dont want to fork the JVM (and I dont see why I should since I want console input from my sample application), what do i need to do in maven.xml ? or project.xml ? I have (in maven.xml) <ant:java dir="$ {basedir}" classname="org.jpox.samples.hello.Main" failonerror="true" fork="false"> <classpath refid="myclasspath"/> <jvmarg value="-Dlog4j.configuration= file:$ {basedir} /log4j.properties"/> </ant:java> With fork=false I just tried adding your versions of xml-apis, xml-resolver, xercesImpl to project.xml (previously I had nothing specified for those – just entries for my own app jars) and I get java.lang.NoClassDefFoundError: sun/reflect/ConstructorAccessorImpl (using JDK 1.4.2_11) With fork=true, then it never reads the console input. What do i do to get Ant to read from the console when fork=true ? What do I specify in this setInputHandler ? (in the above maven.xml snippet) All I want to do is run a sample (Java) app that uses console input via Maven. It works via an Ant task (using fork=false) so I dont see a good reason why not with Maven.
        Hide
        Andy Jefferson added a comment -

        If I take a very simple Java app that accepts input on System.in and reads it using a BufferedReader and does nothing more complicated then using fork=false will work Sadly I want to do something more complicated.

        When I bring in other things (like XML parsing) then I get the xml-apis messages. I then add your jars to the dependencies and they get resolved (why I should have to do this is another issue since I haven't specified ANYTHING in project.xml to impose any restriction on XML parsing. I simply selected to run with JDK1.4.2_11 ... all other choices were made by Maven itself. My project.xml contains entries for log4j, jpox, and javax.jdo/jdo2-api ONLY).

        I then bring in reflection to my (simple) app. It then gives
        Caused by: java.lang.NoClassDefFoundError: sun/reflect/ConstructorAccessorImpl
        at sun.misc.Unsafe.defineClass(Native Method)
        at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:45)
        at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:377)
        at sun.reflect.MethodAccessorGenerator.generateConstructor(MethodAccessorGenerator.java:76)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:30)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
        at org.jpox.util.ClassUtils.newInstance(ClassUtils.java:70)

        so Maven (1.0.2) is doing something with the CLASSPATH and basic JDK classes (since they are part of the JDK i am using and that Maven is running with) are no longer found whereas they are by using a plain Ant (1.6.1) run with fork=false. This is the issue. [My current JDK is j2sdk1.4.2_11 on Linux]

        Let's just forget the fork=true case since I shouldn't have to fork just to get something working

        Show
        Andy Jefferson added a comment - If I take a very simple Java app that accepts input on System.in and reads it using a BufferedReader and does nothing more complicated then using fork=false will work Sadly I want to do something more complicated. When I bring in other things (like XML parsing) then I get the xml-apis messages. I then add your jars to the dependencies and they get resolved (why I should have to do this is another issue since I haven't specified ANYTHING in project.xml to impose any restriction on XML parsing. I simply selected to run with JDK1.4.2_11 ... all other choices were made by Maven itself. My project.xml contains entries for log4j, jpox, and javax.jdo/jdo2-api ONLY). I then bring in reflection to my (simple) app. It then gives Caused by: java.lang.NoClassDefFoundError: sun/reflect/ConstructorAccessorImpl at sun.misc.Unsafe.defineClass(Native Method) at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:45) at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381) at java.security.AccessController.doPrivileged(Native Method) at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:377) at sun.reflect.MethodAccessorGenerator.generateConstructor(MethodAccessorGenerator.java:76) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:30) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:274) at org.jpox.util.ClassUtils.newInstance(ClassUtils.java:70) so Maven (1.0.2) is doing something with the CLASSPATH and basic JDK classes (since they are part of the JDK i am using and that Maven is running with) are no longer found whereas they are by using a plain Ant (1.6.1) run with fork=false. This is the issue . [My current JDK is j2sdk1.4.2_11 on Linux] Let's just forget the fork=true case since I shouldn't have to fork just to get something working
        Hide
        Andy Jefferson added a comment -

        Attached jar attempts to reproduce this.

        To run with Ant
        You need jpox-1.1.0.jar, jdo2-api-2.0.jar, hsqldb-1.8.0.4.jar, log4j-1.2.8.jar in your maven local repo, and set the maven local repo location in build.xml
        Type "ant clean compile run", and it runs fine, prompting for input and returning it.

        To run with Maven (1.0.2)
        Type "maven clean jar run"
        Gives java.lang.NoClassDefFoundError: org/w3c/dom/Document
        (xml-apis, xml-resolver, xercesImpl are listed as dependencies)

        Either there's something I can add to maven.xml/project.xml to get this to work, or something is incorrect in Maven. Maybe there's something I've got wrong in maven.xml ?

        Show
        Andy Jefferson added a comment - Attached jar attempts to reproduce this. To run with Ant You need jpox-1.1.0.jar, jdo2-api-2.0.jar, hsqldb-1.8.0.4.jar, log4j-1.2.8.jar in your maven local repo, and set the maven local repo location in build.xml Type "ant clean compile run", and it runs fine, prompting for input and returning it. To run with Maven (1.0.2) Type "maven clean jar run" Gives java.lang.NoClassDefFoundError: org/w3c/dom/Document (xml-apis, xml-resolver, xercesImpl are listed as dependencies) Either there's something I can add to maven.xml/project.xml to get this to work, or something is incorrect in Maven. Maybe there's something I've got wrong in maven.xml ?
        Hide
        Arnaud Heritier added a comment -

        I 'll have a look at this issue....

        Show
        Arnaud Heritier added a comment - I 'll have a look at this issue....
        Hide
        Lukas Theussl added a comment -

        To be revisited...

        Show
        Lukas Theussl added a comment - To be revisited...
        Hide
        Michael Osipov added a comment -

        Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.

        Show
        Michael Osipov added a comment - Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.

          People

          • Assignee:
            Unassigned
            Reporter:
            Andy Jefferson
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: