8 Replies Latest reply: May 7, 2013 4:28 AM by Neq RSS

    [Solved] WLST Script - NameError

    Neq
      Hi all.
      I have probably very basic problem, but I don't know how to solve it.

      I try to write some simple script to manage application roles through WLST, like this:

      createAppRole("obi","ROLE_A")
      createAppRole("obi","ROLE_B")

      After login, I try to call this script:

      execfile('D:/test.py')

      Result:

      Traceback (innermost last):
      File "<console>", line 1, in ?
      File "D:\test.py", line 1, in ?
      NameError: createAppRole

      I have the same error with every command I tried.
      I tried this: http://docs.oracle.com/cd/E12840_01/wls/docs103/config_scripting/using_WLST.html#wp1094333
      and like here: WLST NameError
      Nothing works.

      I use WLST shipped with JDeveloper.

      Thanks for any help :)

      Edited by: 1001885 on 2013-04-23 06:04

      Edited by: Neq on 2013-05-07 02:28
        • 1. Re: WLST Script - NameError
          KirandeepKaur
          Hi,

          Try changing syntax to:

          createAppRole(appStripe="obi", appRoleName="ROLE_A")

          Regards,
          Kirandeep
          • 2. Re: WLST Script - NameError
            Neq
            I tried that syntax earlier, the same error...
            It looks like lack of some weblogic libs or something. I installed JDeveloper once more from new installer, but problem still exist.

            Can I download some standalone version of WLST?
            • 3. Re: WLST Script - NameError
              KirandeepKaur
              If you have downloaded weblogic, there would be a wlst.jar present you can use it directly by calling

              ./setDomainEnv.sh

              java weblogic.WLST
              • 4. Re: WLST Script - NameError
                Neq
                There is no such file wlst.jar.
                File setDomainEnv.cmd exists (file setDomainEnv.sh exists too, but I'm running Windows 7)

                Command:
                java weblogic.WLST

                returns:
                Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/WLST
                Caused by: java.lang.ClassNotFoundException: weblogic.WLST
                at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
                at java.security.AccessController.doPrivileged(Native Method)
                at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:305)
                at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
                Could not find the main class: weblogic.WLST. Program will exit.
                • 5. Re: WLST Script - NameError
                  KirandeepKaur
                  What is the WLS version you are using?

                  Set the env. and classpath before for run java weblogic.WLST.

                  Run


                  WL_HOME\server\bin\setWLSEnv.cmd

                  Regards,
                  Kirandeep
                  • 6. Re: WLST Script - NameError
                    Neq
                    Version:
                    wls:/offline> print version
                    WebLogic Server 10.3.5.0 Fri Apr 1 20:20:06 PDT 2011 1398638

                    Next, I run setWLSEnv.cmd and java weblogic.WLST without errors, but after connecting to server I get still the same error:

                    wls:/biprod_domain/serverConfig> execfile('D:/test.py')
                    Traceback (innermost last):
                    File "<console>", line 1, in ?
                    NameError: createAppRole
                    wls:/biprod_domain/serverConfig> listAppStripes()
                    Traceback (innermost last):
                    File "<console>", line 1, in ?
                    NameError: listAppStripes

                    Edited by: Neq on 2013-04-25 05:38
                    • 7. Re: WLST Script - NameError
                      Neq
                      Anyone?

                      How can download working version of WLST? Or missing libs? Or something? :|
                      • 8. Re: WLST Script - NameError
                        Neq
                        SOLVED

                        As stated here: Re: Facing Problem while executing a command through WLST

                        I used wrong(?) path. Proper path is:
                        JDeveloper\oracle_common\common\wlst
                        against:
                        JDeveloper\wlserver_10.3\common\wlst

                        ------

                        Btw. great support...