javaantweblogic12c

How to start weblogic server in debug mode with ant task?


I have the following script that starts and stops the weblogic 12.1.3 server without problems, but I can't get it to start in debug, even when I add the line

<jvmarg value="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -XX:PermSize=128m -XX:MaxPermSize=256m"/>

this is the complete script

<?xml version="1.0"?>
<!DOCTYPE project>
<project name="WeblogicServer" default="start-server" basedir="/Users/E3/Oracle/Middleware/Oracle_Home">
    <property name="bea.home" value="/Users/E3/Oracle/Middleware/Oracle_Home" />
    <property name="weblogic.home" value="/Users/E3/Oracle/Middleware/Oracle_Home/wlserver" />
    <property name="domain.home" value="/Users/E3/Oracle/Middleware/Oracle_Home/user_projects/domains" />
    <property name="domain.name" value="base_domain" />
    <property name="host" value="localhost" />
    <property name="port" value="7001" />
    <property name="username" value="weblogic" />
    <property name="password" value="weblogic123" />
    <property name="admin.server.name" value="AdminServer" />

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

    <taskdef name="wlserver" classname="weblogic.ant.taskdefs.management.WLServer" classpathref="wls.classpath"/>
    
    <target name="start-server" >
        <wlserver dir="${domain.home}/${domain.name}"
                  host="${host}"
                  port="${port}"
                  domainname="${domain.name}"
                  servername="${admin.server.name}"
                  action="start"
                  username="${username}"
                  password="${password}"
                  beahome="${bea.home}"
                  weblogichome="${weblogic.home}"
                  verbose="true"
                  noexit="true"
                  protocol="t3"
                  classpath="${weblogic.home}/server/lib/weblogic.jar" >
            <jvmarg value="-server"/>
            <jvmarg value="-Xms256m"/>
            <jvmarg value="-Xmx512m"/>
            <jvmarg value="-XX:PermSize=128m"/>
            <jvmarg value="-XX:MaxPermSize=256m"/>
            <jvmarg value="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -XX:PermSize=128m -XX:MaxPermSize=256m"/>
        </wlserver>
    </target>

    <target name="stop-server">
        <wlserver dir="${domain.home}/${domain.name}"
                  host="${host}"
                  port="${port}"
                  servername="${admin.server.name}"
                  username="${username}"
                  password="${password}"
                  action="shutdown"
                  beahome="${bea.home}"
                  weblogichome="${weblogic.home}"
                  forceshutdown="true"/>
    </target>
</project>

What could I be missing?

I was reading in several places that the debug option should be added, but it doesn't work for me


Solution

  • This jvmarg:

    <jvmarg value="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -XX:PermSize=128m -XX:MaxPermSize=256m"/>
    

    Is being passed to the java executable as a single argument, with embedded spaces, rather than a series of separate arguments. Break it up into separate jvmargs.

    You can see what's happening in the call to the java executable by running ant with the -d command-line option:

    $ ant -d
    
    ...
    
    Execute:Java13CommandLauncher: Executing '/.../bin/java' 
    with arguments:
        '-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -XX:PermSize=128m -XX:MaxPermSize=256m'
        'package.and.classname'
    

    Notice how your jvmargs is a single string in the debug output.