7 Replies Latest reply on May 9, 2011 6:48 AM by 859190

    Using WLST with ant. Need help

    creed
      I try to create ant task which connects to WLST engine and creates datasource.

      This is build.xml :

      +<?xml version="1.0" ?>+
      +<project name="deploy" default="connect" basedir=".">+
      +<echo> ${wl.home} </echo>+
      +<path id="wl.appc.classpath">+
      +<pathelement location="${wl.home}/server/lib/weblogic.jar"/>+
      +</path>+
      +<taskdef name="wlst" classpathref="wl.appc.classpath" classname="weblogic.ant.taskdefs.management.WLSTTask" />+
      +<target name="connect">+
      +<wlst executescriptbeforefile="true" debug="false">+
      +<script>+
      connect('weblogic','weblogic','t3://localhost:7001')
      +</script>+
      +</wlst>+
      +</target>+
      +</project>+

      Running this is script I'm getting the following error:

      Buildfile: c:\wl-ds.xml
      [echo] C:/Oracle/Middleware11.1.1.4/wlserver_10.3

      connect:
      [wlst] java.lang.NoClassDefFoundError: weblogic/management/scripting/WLSTInterpreterInvoker
      [wlst] Caused by: java.lang.ClassNotFoundException: weblogic.management.scripting.WLSTInterpreterInvoker
      [wlst] at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
      [wlst] at java.security.AccessController.doPrivileged(Native Method)
      [wlst] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      [wlst] at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
      [wlst] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      [wlst] at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
      [wlst] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
      [wlst] Could not find the main class: weblogic.management.scripting.WLSTInterpreterInvoker. Program will exit.
      [wlst] Exception in thread "main"

      BUILD FAILED
      c:\wl-ds.xml:12: Java returned: 1

      Ant founds weblogic.ant.taskdefs.management.WLSTTask but in some reasons cannot find weblogic.management.scripting.WLSTInterpreterInvoker, although they both placed in the weblogic.jar

      I can't understand what I do wrong! Please, help or advice what to do...

      Edited by: creed on 03.03.2011 20:55
        • 1. Re: Using WLST with ant. Need help
          Jay SenSharma MiddlewareMagic
          Try this:
          <?xml version="1.0" ?>
          <project name="deploy" default="run" basedir=".">
          <property name="wl.home" value="E:\bea10_3_2\wlserver_10.3" />
           
           
          <path id="wl.classpath">
                  <fileset dir="${wl.home}/server/lib">
                        <include name="*.jar"/>
                  </fileset>
          </path>
           
          <taskdef name="wlst" classpathref="wl.classpath" classname="weblogic.ant.taskdefs.management.WLSTTask" />
          <target name="connect">
                <echo message="WebLogic Home is : ${wl.home}" />
                 <wlst executescriptbeforefile="true" debug="false">
                     <script>
                                connect('weblogic','weblogic1','t3://localhost:7001') 
                     </script>
                 </wlst>
          </target>
          
          <target name="run" depends="connect">
                <java classname="weblogic.version" >
                        <classpath refid="wl.classpath"/> 
                 </java>
          </target>
          </project>
          • 2. Re: Using WLST with ant. Need help
            Jay SenSharma MiddlewareMagic
            Hi,

            The Class "weblogic/management/scripting/WLSTInterpreterInvoke" is not present in WLS10.3 onwards because the package is changed to:


            Class: weblogic.management.scripting.utils.WLSTInterpreter
            Package: weblogic.management.scripting.utils
            Library Name: wls-api.jar



            So please make sure that you are setting the Correct *"wl.home"* in your ANT Script...It might be using an Older version wl.home

            Try to Hardcode the value of following property:

            <b><font color=red>
            <property name="wl.home" value="E:\bea10_3_2\wlserver_10.3" />
            </font>
            </b>


            WORKED for me:
            F:\DELETE>ant
            Buildfile: build.xml
            
            connect:
                 [echo] WebLogic Home is : E:\bea10_3_2\wlserver_10.3
                 [wlst] Connecting to t3://localhost:7001 with userid weblogic ...
                 [wlst] Successfully connected to Admin Server 'AdminServer' that belongs to domain '7001_Plain_Domain'.
                 [wlst]
                 [wlst] Warning: An insecure protocol was used to connect to the
                 [wlst] server. To ensure on-the-wire security, the SSL port or
                 [wlst] Admin port should be used instead.
                 [wlst]
            
            run:
                 [java]
                 [java] WebLogic Server 10.3  Tue Oct 20 12:16:15 PDT 2009 1267925
                 [java] WebLogic Server 10.3  Tue Oct 20 12:16:15 PDT 2009 1267925
                 [java] WebLogic Server 10.3.2.0  Tue Oct 20 12:16:15 PDT 2009 1267925
                 [java] WebLogic Server WebService SSL Client 10.3  Tue Oct 20 12:16:15 PDT 2009 1267925
                 [java] WebLogic Server WebService Client 10.3  Tue Oct 20 12:16:15 PDT 2009 1267925
                 [java] WebLogic Server 10.3  Tue Oct 20 12:16:15 PDT 2009 1267925
                 [java] WebLogic Server 10.3  Tue Oct 20 12:16:15 PDT 2009 1267925
                 [java] WebLogic Server 10.3  Tue Oct 20 12:16:15 PDT 2009 1267925
                 [java] WebLogic Server 10.3  Tue Oct 20 12:16:15 PDT 2009 1267925
                 [java] WebLogic Server 10.3  Tue Oct 20 12:16:15 PDT 2009 1267925
                 [java] WebLogic Server 10.3  Tue Oct 20 12:16:15 PDT 2009 1267925
                 [java] WebLogic Server WebService Client 10.3  Tue Oct 20 12:32:30 PDT 2009 1267925
                 [java]
                 [java] Use 'weblogic.version -verbose' to get subsystem information
                 [java]
                 [java] Use 'weblogic.utils.Versions' to get version information for all modules
            
            BUILD SUCCESSFUL
            Total time: 4 seconds
            • 3. Re: Using WLST with ant. Need help
              creed
              thanks for reply, Jay!

              Script with task run doesn't work too - same error..
              wl.home is checked, it's right.

              Weblogic 10.3.4

              It's look like a bug..
              • 4. Re: Using WLST with ant. Need help
                859190
                Hi,

                Just wanted to check if the issue was resolved, I have the same issue , Below is the details of the error i get when i try jay's script

                Apache Ant version 1.8.0 compiled on February 1 2010
                Trying the default build file: build.xml
                Buildfile: D:\anttest\build.xml
                Adding reference: ant.PropertyHelper
                Detected Java version: 1.6 in: D:\SYS\JAVA\jdk1.6.0_21\jre
                Detected OS: Windows Server 2008
                Adding reference: ant.ComponentHelper
                Setting ro project property: ant.file -> D:\anttest\build.xml
                Setting ro project property: ant.file.type -> file
                Adding reference: ant.projectHelper
                Adding reference: ant.parsing.context
                Adding reference: ant.targets
                parsing buildfile D:\anttest\build.xml with URI = file:/D:/anttest/build.xml
                Setting ro project property: ant.project.name -> deploy
                Adding reference: deploy
                Setting ro project property: ant.project.default-target -> run
                Setting ro project property: ant.file.deploy -> D:\anttest\build.xml
                Setting ro project property: ant.file.type.deploy -> file
                Project base dir set to: D:\anttest
                +Target:
                +Target: connect
                +Target: run
                Adding reference: ant.LocalProperties
                parsing buildfile jar:file:/D:/SYS/apache-ant-1.8.0/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/D:/SYS/apache-ant-1.8.0/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
                Setting project property: wl.home -> D:\SYS\Weblogic1034\wlserver_10.3
                Adding reference: wl.classpath
                fileset: Setup scanner in dir D:\SYS\Weblogic1034\wlserver_10.3\server\lib with patternSet{ includes: [*.jar] excludes: [] }
                Finding class weblogic.ant.taskdefs.management.WLSTTask
                Loaded from D:\SYS\Weblogic1034\wlserver_10.3\server\lib\weblogic.jar weblogic/ant/taskdefs/management/WLSTTask.class
                Class org.apache.tools.ant.taskdefs.Java loaded from parent loader (parentFirst)
                Class weblogic.ant.taskdefs.management.WLSTTask loaded from ant loader (parentFirst)
                Class java.lang.Object loaded from parent loader (parentFirst)
                Class java.lang.Throwable loaded from parent loader (parentFirst)
                Class org.apache.tools.ant.BuildException loaded from parent loader (parentFirst)
                Class java.lang.Exception loaded from parent loader (parentFirst)
                Class java.lang.IllegalStateException loaded from parent loader (parentFirst)
                Class java.io.Reader loaded from parent loader (parentFirst)
                Class java.io.StringReader loaded from parent loader (parentFirst)
                Class java.lang.String loaded from parent loader (parentFirst)
                Class java.io.IOException loaded from parent loader (parentFirst)
                Class java.io.OutputStream loaded from parent loader (parentFirst)
                Class java.io.FileOutputStream loaded from parent loader (parentFirst)
                +Datatype wlst weblogic.ant.taskdefs.management.WLSTTask
                Setting ro project property: ant.project.invoked-targets -> run
                Attempting to create object of type org.apache.tools.ant.helper.DefaultExecutor
                Adding reference: ant.executor
                Build sequence for target(s) `run' is [connect, run]
                Complete build sequence is [connect, run, ]

                connect:
                [echo] WebLogic Home is : D:\SYS\Weblogic1034\wlserver_10.3
                Class org.apache.tools.ant.types.Path loaded from parent loader (parentFirst)
                Finding class weblogic.ant.taskdefs.management.WLSTScript
                Loaded from D:\SYS\Weblogic1034\wlserver_10.3\server\lib\weblogic.jar weblogic/ant/taskdefs/management/WLSTScript.class
                Class org.apache.tools.ant.Task loaded from parent loader (parentFirst)
                Class weblogic.ant.taskdefs.management.WLSTScript loaded from ant loader (parentFirst)
                Class java.lang.Boolean loaded from parent loader (parentFirst)
                Class java.lang.StringBuilder loaded from parent loader (parentFirst)
                Class org.apache.tools.ant.types.Commandline$Argument loaded from parent loader (parentFirst)
                Class org.apache.tools.ant.util.FileUtils loaded from parent loader (parentFirst)
                Class java.io.PrintWriter loaded from parent loader (parentFirst)
                Class java.io.LineNumberReader loaded from parent loader (parentFirst)
                Finding class weblogic.utils.StringUtils
                Loaded from D:\SYS\Weblogic1034\modules\com.bea.core.utils_1.9.0.0.jar weblogic/utils/StringUtils.class
                Class weblogic.utils.StringUtils loaded from ant loader (parentFirst)
                Class java.lang.SecurityException loaded from parent loader (parentFirst)
                Class java.lang.NoSuchMethodException loaded from parent loader (parentFirst)
                Finding class weblogic.utils.StringUtils$StringMaker
                Loaded from D:\SYS\Weblogic1034\modules\com.bea.core.utils_1.9.0.0.jar weblogic/utils/StringUtils$StringMaker.class
                Class weblogic.utils.StringUtils$StringMaker loaded from ant loader (parentFirst)
                Finding class weblogic.utils.StringUtils$ReflectedStringMaker
                Loaded from D:\SYS\Weblogic1034\modules\com.bea.core.utils_1.9.0.0.jar weblogic/utils/StringUtils$ReflectedStringMaker.class
                Class weblogic.utils.StringUtils$ReflectedStringMaker loaded from ant loader (parentFirst)
                Class java.lang.Class loaded from parent loader (parentFirst)
                Class java.lang.Integer loaded from parent loader (parentFirst)
                Class java.lang.reflect.Constructor loaded from parent loader (parentFirst)
                Class java.lang.reflect.InvocationTargetException loaded from parent loader (parentFirst)
                Class java.lang.IllegalAccessException loaded from parent loader (parentFirst)
                Class java.lang.InstantiationException loaded from parent loader (parentFirst)
                Class java.lang.RuntimeException loaded from parent loader (parentFirst)
                Class java.lang.Character loaded from parent loader (parentFirst)
                Class java.io.File loaded from parent loader (parentFirst)
                Class org.apache.tools.ant.types.CommandlineJava loaded from parent loader (parentFirst)
                [wlst] Executing 'D:\SYS\JAVA\jdk1.6.0_21\jre\bin\java.exe' with arguments:
                [wlst] '-Ddebug=false'
                [wlst] '-DfailOnError=true'
                [wlst] '-DexecuteScriptBeforeFile=true'
                [wlst] '-DscriptTempFile=C:\Users\Administrator\AppData\Local\Temp\2\wlsttempfile214271013.py'
                [wlst] '-classpath'
                [wlst] 'D:\SYS\apache-ant-1.8.0\lib\ant-launcher.jar;D:\SYS\apache-ant-1.8.0\lib\ant-antlr.jar;D:\SYS\apache-ant-1.8.0\lib\ant-apache-bcel.jar;D:\SYS\apache-ant-1.8.0\lib\ant-apache-bsf.jar;D:\SYS\apache-ant-1.8.0\lib\ant-apache-log4j.jar;D:\SYS\apache-ant-1.8.0\lib\ant-apache-oro.jar;D:\SYS\apache-ant-1.8.0\lib\ant-apache-regexp.jar;D:\SYS\apache-ant-1.8.0\lib\ant-apache-resolver.jar;D:\SYS\apache-ant-1.8.0\lib\ant-apache-xalan2.jar;D:\SYS\apache-ant-1.8.0\lib\ant-commons-logging.jar;D:\SYS\apache-ant-1.8.0\lib\ant-commons-net.jar;D:\SYS\apache-ant-1.8.0\lib\ant-jai.jar;D:\SYS\apache-ant-1.8.0\lib\ant-javamail.jar;D:\SYS\apache-ant-1.8.0\lib\ant-jdepend.jar;D:\SYS\apache-ant-1.8.0\lib\ant-jmf.jar;D:\SYS\apache-ant-1.8.0\lib\ant-jsch.jar;D:\SYS\apache-ant-1.8.0\lib\ant-junit.jar;D:\SYS\apache-ant-1.8.0\lib\ant-netrexx.jar;D:\SYS\apache-ant-1.8.0\lib\ant-nodeps.jar;D:\SYS\apache-ant-1.8.0\lib\ant-stylebook.jar;D:\SYS\apache-ant-1.8.0\lib\ant-swing.jar;D:\SYS\apache-ant-1.8.0\lib\ant-testutil.jar;D:\SYS\apache-ant-1.8.0\lib\ant-trax.jar;D:\SYS\apache-ant-1.8.0\lib\ant.jar;D:\SYS\apache-ant-1.8.0\lib\xercesImpl.jar;D:\SYS\apache-ant-1.8.0\lib\xml-apis.jar;D:\SYS\JAVA\jdk1.6.0_21\lib\tools.jar'
                [wlst] 'weblogic.management.scripting.WLSTInterpreterInvoker'
                [wlst]
                [wlst] The ' characters around the executable and arguments are
                [wlst] not part of the command.
                [wlst] Using input " "
                Execute:Java13CommandLauncher: Executing 'D:\SYS\JAVA\jdk1.6.0_21\jre\bin\java.exe' with arguments:
                '-Ddebug=false'
                '-DfailOnError=true'
                '-DexecuteScriptBeforeFile=true'
                '-DscriptTempFile=C:\Users\Administrator\AppData\Local\Temp\2\wlsttempfile214271013.py'
                '-classpath'
                'D:\SYS\apache-ant-1.8.0\lib\ant-launcher.jar;D:\SYS\apache-ant-1.8.0\lib\ant-antlr.jar;D:\SYS\apache-ant-1.8.0\lib\ant-apache-bcel.jar;D:\SYS\apache-ant-1.8.0\lib\ant-apache-bsf.jar;D:\SYS\apache-ant-1.8.0\lib\ant-apache-log4j.jar;D:\SYS\apache-ant-1.8.0\lib\ant-apache-oro.jar;D:\SYS\apache-ant-1.8.0\lib\ant-apache-regexp.jar;D:\SYS\apache-ant-1.8.0\lib\ant-apache-resolver.jar;D:\SYS\apache-ant-1.8.0\lib\ant-apache-xalan2.jar;D:\SYS\apache-ant-1.8.0\lib\ant-commons-logging.jar;D:\SYS\apache-ant-1.8.0\lib\ant-commons-net.jar;D:\SYS\apache-ant-1.8.0\lib\ant-jai.jar;D:\SYS\apache-ant-1.8.0\lib\ant-javamail.jar;D:\SYS\apache-ant-1.8.0\lib\ant-jdepend.jar;D:\SYS\apache-ant-1.8.0\lib\ant-jmf.jar;D:\SYS\apache-ant-1.8.0\lib\ant-jsch.jar;D:\SYS\apache-ant-1.8.0\lib\ant-junit.jar;D:\SYS\apache-ant-1.8.0\lib\ant-netrexx.jar;D:\SYS\apache-ant-1.8.0\lib\ant-nodeps.jar;D:\SYS\apache-ant-1.8.0\lib\ant-stylebook.jar;D:\SYS\apache-ant-1.8.0\lib\ant-swing.jar;D:\SYS\apache-ant-1.8.0\lib\ant-testutil.jar;D:\SYS\apache-ant-1.8.0\lib\ant-trax.jar;D:\SYS\apache-ant-1.8.0\lib\ant.jar;D:\SYS\apache-ant-1.8.0\lib\xercesImpl.jar;D:\SYS\apache-ant-1.8.0\lib\xml-apis.jar;D:\SYS\JAVA\jdk1.6.0_21\lib\tools.jar'
                'weblogic.management.scripting.WLSTInterpreterInvoker'

                The ' characters around the executable and arguments are
                not part of the command.
                [wlst] java.lang.NoClassDefFoundError: weblogic/management/scripting/WLSTInterpreterInvoker
                [wlst] Caused by: java.lang.ClassNotFoundException: weblogic.management.scripting.WLSTInterpreterInvoker
                [wlst] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
                [wlst] at java.security.AccessController.doPrivileged(Native Method)
                [wlst] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
                [wlst] at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
                [wlst] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
                [wlst] at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
                [wlst] Could not find the main class: weblogic.management.scripting.WLSTInterpreterInvoker. Program will exit.
                [wlst] Exception in thread "main"
                • 5. Re: Using WLST with ant. Need help
                  Ravish Mody_MiddlewareMagic
                  Hi,

                  As the *"NoClassDefFoundError: weblogic/management/scripting/WLSTInterpreterInvoker"* that this class is also missing in your CLASSPATH...If you will search this JAR then you won't find it inside "${wl.home}/server/lib" So please add the directory "*${oracle.home}/modules"* as well inside the PATH reference like following, Because some of the Classes are moved inside the Modules directory inform of Jars:

                  <property name="oracle.home" value="E:\bea10_3_4" />
                  <property name="wl.home" value="E:\bea10_3_4\wlserver_10.3" />
                  
                  <path id="wl.classpath">
                          <fileset dir="${wl.home}/server/lib">
                                <include name="*.jar"/>
                          </fileset>
                  
                          <fileset dir="${oracle.home}/modules">
                                <include name="*.jar"/>
                          </fileset>
                  </path>
                  Thanks
                  Ravish Mody
                  • 6. Re: Using WLST with ant. Need help
                    859281
                    I installed weblogic 10.3.4, got same issue, I DO see that the reported missing weblogic.management.scripting.WLSTInterpreterInvoker class is in weblogic.jar,
                    I have to comment out my <taskdef name="wlst" classpathref="wl.classpath" classname="weblogic.ant.taskdefs.management.WLSTTask" /> line to
                    follow this following to make my ant + WLST to create a domain as I expect.
                    1 cd to ${wl.home}/server/lib and run setWLSEnv
                    2 cd to your folder with build.xml and "ant whatever_wlst_task"
                    • 7. Re: Using WLST with ant. Need help
                      859190
                      Hi ,

                      Thanks for the replies, I have got it working finally. I needed to change the script so that the classpath was set for the task as well .

                      <path id="wl.classpath">
                      <fileset dir="${wl.home}/server/lib">
                      <include name="*.jar"/>
                      </fileset>
                      </path>

                      <taskdef name="wlst" classpathref="wl.classpath" classname="..." />
                      <target name="connect" >
                      <echo message="WebLogic Home is : ${wl.home}" />
                      <wlst executeScriptBeforeFile="true" debug="true" failOnError="true" classpathref="wl.classpath" >
                      <script>
                      nmConnect('weblogic', 'wleadmin12!', '192.1.6.xxx','5556' , 'base_domain', 'D:/SYS/Weblogic1034/user_projects/domains/base_domain','SSL' )
                      nmStart('BM1')
                      nmDisconnect()
                      </script>
                      </wlst>
                      </target>

                      Edited by: user10020167 on May 8, 2011 11:47 PM