You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Rick Hillegas <ri...@gmail.com> on 2023/10/20 20:39:23 UTC

java.lang.UnsupportedOperationException raised when invoking the task

I am running Java 21 (OpenJDK 64-Bit Server VM (build 21+35-2513, mixed 
mode, sharing)) and Ant 1.10.6. The following stanza in my build.xml 
file raises a java.lang.UnsupportedOperationException:

     <java classname="org.apache.derbyBuild.maintversion2props">
         <classpath path="${out.build.dir}"/>
         <arg value="${out.engine.dir}/org/apache/derby/info/engine/info.properties"/>
         <arg value="${release.dir}/maintversion.properties"/>
     </java>

The maintversion2props class is very simple, it just writes a file. I 
would appreciate your advice about how to get over this hurdle.

Thanks,

-Rick

Here is the maintversion2props class:

public class maintversion2props
{
     public static void main(String[] args) throws Exception
     {
         InputStream is = new FileInputStream(args[0]);
         Properties p = new Properties();
         p.load(is);

         String maint = "";
         maint = p.getProperty("derby.version.maint");
         if (maint == null)
         {
             maint = p.getProperty("maint");
         }
         
         Properties p2 = new Properties();
         p2.setProperty("interim", Integer.toString(Integer.parseInt(maint) / 1000000));
         p2.setProperty("point", Integer.toString(Integer.parseInt(maint) % 1000000));
         OutputStream os = new FileOutputStream(args[1]);
         p2.store(os, "");
     }
}

...and here is the full stack trace:

      [java] java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release

      [java]     at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:194)

      [java]     at org.apache.tools.ant.taskdefs.Java.run(Java.java:861)

      [java]     at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:231)

      [java]     at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)

      [java]     at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)

      [java]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)

      [java]     at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)

      [java]     at java.base/java.lang.reflect.Method.invoke(Method.java:580)

      [java]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)

      [java]     at org.apache.tools.ant.Task.perform(Task.java:350)

      [java]     at org.apache.tools.ant.Target.execute(Target.java:449)

      [java]     at org.apache.tools.ant.Target.performTasks(Target.java:470)

      [java]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1391)

      [java]     at org.apache.tools.ant.Project.executeTarget(Project.java:1364)

      [java]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)

      [java]     at org.apache.tools.ant.Project.executeTargets(Project.java:1254)

      [java]     at org.apache.tools.ant.Main.runBuild(Main.java:830)

      [java]     at org.apache.tools.ant.Main.startAnt(Main.java:223)

      [java]     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)

      [java]     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)

      [java] Caused by: java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release

      [java]     at java.base/java.lang.System.setSecurityManager(System.java:429)

      [java]     at org.apache.tools.ant.types.Permissions.setSecurityManager(Permissions.java:103)

      [java]     at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:216)

      [java]     at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:155)

      [java]     ... 19 more


Re: java.lang.UnsupportedOperationException raised when invoking the task

Posted by Jaikiran Pai <ja...@apache.org>.
Happy to hear that Ant 1.10.14 gets the build passing on Java 21.

-Jaikiran

On 22/10/23 2:39 am, Rick Hillegas wrote:
> Thanks, Jaikiran and Don. Ant 1.10.14 gets me over this hurdle. I'll 
> let you know if I encounter other issues building the next Derby 
> release with Java 21 and this version of Ant. Cheers
>
> On 10/21/23 7:32 AM, Brutzman, Donald (Don) (CIV) wrote:
>> As Indicated in the email thread, have gotten javac to work by including
>> fork='true' in the build.xml invocation.
>>
>>
>> * https://lists.apache.org/thread/9vhk51nkw9wjxzm7xk2q9xm6s803prmr
>>
>>
>> all the best, Don
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: java.lang.UnsupportedOperationException raised when invoking the task

Posted by Rick Hillegas <ri...@gmail.com>.
Thanks, Jaikiran and Don. Ant 1.10.14 gets me over this hurdle. I'll let 
you know if I encounter other issues building the next Derby release 
with Java 21 and this version of Ant. Cheers

On 10/21/23 7:32 AM, Brutzman, Donald (Don) (CIV) wrote:
> As Indicated in the email thread, have gotten javac to work by including
> fork='true' in the build.xml invocation.
>
>   
>
> *	https://lists.apache.org/thread/9vhk51nkw9wjxzm7xk2q9xm6s803prmr
>
>   
>
> all the best, Don
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: java.lang.UnsupportedOperationException raised when invoking the task

Posted by Jaikiran Pai <ja...@apache.org>.
Hello Rick,

Ant 1.10.6 cannot be used with Java 21 because of this very 
SecurityManager usage within Ant. Considering this issue and Java 
SecurityManager's deprecation for removal, we have released Ant 1.10.14 
a couple of months back 
https://lists.apache.org/thread/9vhk51nkw9wjxzm7xk2q9xm6s803prmr.

Please use Ant 1.10.14 when building with Java 21. I'll be interested in 
hearing how it goes and if there are any issues you run into.

-Jaikiran

On 21/10/23 2:09 am, Rick Hillegas wrote:
>
> I am running Java 21 (OpenJDK 64-Bit Server VM (build 21+35-2513, 
> mixed mode, sharing)) and Ant 1.10.6. The following stanza in my 
> build.xml file raises a java.lang.UnsupportedOperationException:
>
>      <java classname="org.apache.derbyBuild.maintversion2props">
>          <classpath path="${out.build.dir}"/>
>          <arg value="${out.engine.dir}/org/apache/derby/info/engine/info.properties"/>
>          <arg value="${release.dir}/maintversion.properties"/>
>      </java>
>
> The maintversion2props class is very simple, it just writes a file. I 
> would appreciate your advice about how to get over this hurdle.
>
> Thanks,
>
> -Rick
>
> Here is the maintversion2props class:
>
> public class maintversion2props
> {
>      public static void main(String[] args) throws Exception
>      {
>          InputStream is = new FileInputStream(args[0]);
>          Properties p = new Properties();
>          p.load(is);
>
>          String maint = "";
>          maint = p.getProperty("derby.version.maint");
>          if (maint == null)
>          {
>              maint = p.getProperty("maint");
>          }
>          
>          Properties p2 = new Properties();
>          p2.setProperty("interim", Integer.toString(Integer.parseInt(maint) / 1000000));
>          p2.setProperty("point", Integer.toString(Integer.parseInt(maint) % 1000000));
>          OutputStream os = new FileOutputStream(args[1]);
>          p2.store(os, "");
>      }
> }
>
> ...and here is the full stack trace:
>
>       [java] java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
>       [java]     at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:194)
>       [java]     at org.apache.tools.ant.taskdefs.Java.run(Java.java:861)
>       [java]     at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:231)
>       [java]     at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
>       [java]     at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
>       [java]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
>       [java]     at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
>       [java]     at java.base/java.lang.reflect.Method.invoke(Method.java:580)
>       [java]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
>       [java]     at org.apache.tools.ant.Task.perform(Task.java:350)
>       [java]     at org.apache.tools.ant.Target.execute(Target.java:449)
>       [java]     at org.apache.tools.ant.Target.performTasks(Target.java:470)
>       [java]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1391)
>       [java]     at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
>       [java]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
>       [java]     at org.apache.tools.ant.Project.executeTargets(Project.java:1254)
>       [java]     at org.apache.tools.ant.Main.runBuild(Main.java:830)
>       [java]     at org.apache.tools.ant.Main.startAnt(Main.java:223)
>       [java]     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
>       [java]     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
>       [java] Caused by: java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
>       [java]     at java.base/java.lang.System.setSecurityManager(System.java:429)
>       [java]     at org.apache.tools.ant.types.Permissions.setSecurityManager(Permissions.java:103)
>       [java]     at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:216)
>       [java]     at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:155)
>       [java]     ... 19 more
>
>