Search code examples
batch-filecmdweblogic

Weblogic12 - start Admin Server throws syntax error


I have a big problem with Weblogic12. I tried to run Admin Server and the command line just disappear without any information. So I was debugging it deeper and there is a problem in shortenPaths.cmd file which looks like:

@rem **************************************************************************
@rem This script is used to shorten CLASSPATH and PATH environmental variables.
@rem 
@rem Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. 
@rem **************************************************************************
if NOT "%CLASSPATH%"=="" (
  call :handle_classpath
)

if NOT "%PATH%"=="" (
  call :handle_path
)
goto :EOF

:handle_classpath
pause
  set __SHORT_CLASSPATH__=
  call :process_classpath "%CLASSPATH%"
  set CLASSPATH=%__SHORT_CLASSPATH__%
  goto :EOF

:handle_path
  set __SHORT_PATH__=
  call :process_path "%PATH%"
  set PATH=%__SHORT_PATH__%
  goto :EOF

:process_classpath
  FOR /F "TOKENS=1,* DELIMS=;" %%a IN (%1) DO (
    if NOT "%%a"=="" (
      if exist "%%a" (
        call :add_to_classpath %%~fsa
      )
    )
    if NOT "%%b"=="" (
      call :process_classpath "%%b"
    )
  )
  goto :EOF

:add_to_classpath
  if NOT "%1"=="" (
    if NOT "%__SHORT_CLASSPATH__%"=="" (
      set __SHORT_CLASSPATH__=%__SHORT_CLASSPATH__%;%1
    ) else (
      set __SHORT_CLASSPATH__=%1
    )
  )
  goto :EOF

:process_path
  FOR /F "TOKENS=1,* DELIMS=;" %%a IN (%1) DO (
    if NOT "%%a"=="" (
      if exist "%%a" (
        call :add_to_path %%~fsa
      )
    )
    if NOT "%%b"=="" (
      call :process_path "%%b"
    )
  )
  goto :EOF

:add_to_path
  if NOT "%1"=="" (
    if NOT "%__SHORT_PATH__%"=="" (
      set __SHORT_PATH__=%__SHORT_PATH__%;%1
    ) else (
      set __SHORT_PATH__=%1
    ) 
  )

Command line throws this error:

if NOT "" == "" (call :handle_classpath )
The syntax of the command is incorrect.

So I tried to simulate the same if statement in my own script:

set CLASSPATH=""

if NOT "%CLASSPATH%"=="" (
  echo "inside"
)
pause

And the result is :

C:\Tools\Weblogic12\oracle_common\common\bin>if NOT """" == "" (echo "inside" )
"inside"

C:\Tools\Weblogic12\oracle_common\common\bin>pause
Press any key to continue . . .

I have no idea what is going on with this Weblogic. I didn't do anything just try to test my application and I cannot start it. Two days ago it works fine without any problems. The most reflecting is why command line throw error in Weblogic script and the same situation in my own works fine.


Solution

  • I found solution. There was a problem with Path environment variable. When I check it with using GUI and when I print it in console there was differences. In console system add path to microsoft .net framework which contains at the end quotation marks which causes problems. The most important is when I add something to Path using GUI and delete it there was no more that weird path to microsoft .net and it started to work correctly...