zoukankan      html  css  js  c++  java
  • 图片生成报错

    图片生成报错

     

    图片生成报错

    1 图片生成报错

    1:  org.awareness.user.commons.image.utils.ImageUtils
    2:  有图片自动生成器,windows上正常,linux上就报以上错误
    3:  
    4:  java.lang.InternalError: 
    5:  Can't connect to X11 window server using 'localhost:11.0' as the value of the DISPLAY variable.
    6:  at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
    7:  at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:134)
    8:  at java.lang.Class.forName0(Native Method)
    9:  at java.lang.Class.forName(Class.java:141) 
    

    原因是windows内核集成了gui,而linux上没有启动x server

    1.1 解决办法:

    1. 启动x server
    2. 在java运行参数上加-Djava.awt.headless=true

    修改${TOMCATHOME}/bin/catalina.sh

    在org.apache.catalina.startup.Bootstrap "$@" * 部分后面前加上 -Djava.awt.headless=true \ 修改为如下: 共有7处.

      1:  #!/bin/sh
      2:  # -----------------------------------------------------------------------------
      3:  # Start/Stop Script for the CATALINA Server
      4:  #
      5:  # Environment Variable Prequisites
      6:  #
      7:  #   CATALINA_HOME   May point at your Catalina "build" directory.
      8:  #
      9:  #   CATALINA_BASE   (Optional) Base directory for resolving dynamic portions
     10:  #                   of a Catalina installation.  If not present, resolves to
     11:  #                   the same directory that CATALINA_HOME points to.
     12:  #
     13:  #   CATALINA_OPTS   (Optional) Java runtime options used when the "start",
     14:  #                   or "run" command is executed.
     15:  #
     16:  #   CATALINA_TMPDIR (Optional) Directory path location of temporary directory
     17:  #                   the JVM should use (java.io.tmpdir).  Defaults to
     18:  #                   $CATALINA_BASE/temp.
     19:  #
     20:  #   JAVA_HOME       Must point at your Java Development Kit installation.
     21:  #                   Required to run the with the "debug" or "javac" argument.
     22:  #
     23:  #   JRE_HOME        Must point at your Java Development Kit installation.
     24:  #                   Defaults to JAVA_HOME if empty.
     25:  #
     26:  #   JAVA_OPTS       (Optional) Java runtime options used when the "start",
     27:  #                   "stop", or "run" command is executed.
     28:  #
     29:  #   JPDA_TRANSPORT  (Optional) JPDA transport used when the "jpda start"
     30:  #                   command is executed. The default is "dt_socket".
     31:  #
     32:  #   JPDA_ADDRESS    (Optional) Java runtime options used when the "jpda start"
     33:  #                   command is executed. The default is 8000.
     34:  #
     35:  #   JPDA_SUSPEND    (Optional) Java runtime options used when the "jpda start"
     36:  #                   command is executed. Specifies whether JVM should suspend
     37:  #                   execution immediately after startup. Default is "n".
     38:  #
     39:  #   JPDA_OPTS       (Optional) Java runtime options used when the "jpda start"
     40:  #                   command is executed. If used, JPDA_TRANSPORT, JPDA_ADDRESS,
     41:  #                   and JPDA_SUSPEND are ignored. Thus, all required jpda
     42:  #                   options MUST be specified. The default is:
     43:  #
     44:  #                   -Xdebug -Xrunjdwp:transport=$JPDA_TRANSPORT,
     45:  #                       address=$JPDA_ADDRESS,server=y,suspend=$JPDA_SUSPEND
     46:  #
     47:  #   JSSE_HOME       (Optional) May point at your Java Secure Sockets Extension
     48:  #                   (JSSE) installation, whose JAR files will be added to the
     49:  #                   system class path used to start Tomcat.
     50:  #
     51:  #   CATALINA_PID    (Optional) Path of the file which should contains the pid
     52:  #                   of catalina startup java process, when start (fork) is used
     53:  #
     54:  # $Id: catalina.sh 609438 2008-01-06 22:14:28Z markt $
     55:  # -----------------------------------------------------------------------------
     56:  
     57:  # OS specific support.  $var _must_ be set to either true or false.
     58:  cygwin=false
     59:  os400=false
     60:  darwin=false
     61:  case "`uname`" in
     62:  CYGWIN*) cygwin=true;;
     63:  OS400*) os400=true;;
     64:  Darwin*) darwin=true;;
     65:  esac
     66:  
     67:  # resolve links - $0 may be a softlink
     68:  PRG="$0"
     69:  
     70:  while [ -h "$PRG" ]; do
     71:    ls=`ls -ld "$PRG"`
     72:    link=`expr "$ls" : '.*-> \(.*\)$'`
     73:    if expr "$link" : '/.*' > /dev/null; then
     74:      PRG="$link"
     75:    else
     76:      PRG=`dirname "$PRG"`/"$link"
     77:    fi
     78:  done
     79:  
     80:  # Get standard environment variables
     81:  PRGDIR=`dirname "$PRG"`
     82:  
     83:  # Only set CATALINA_HOME if not already set
     84:  [ -z "$CATALINA_HOME" ] && CATALINA_HOME=`cd "$PRGDIR/.." ; pwd`
     85:  
     86:  if [ -r "$CATALINA_BASE"/bin/setenv.sh ]; then
     87:    . "$CATALINA_BASE"/bin/setenv.sh
     88:  elif [ -r "$CATALINA_HOME"/bin/setenv.sh ]; then
     89:    . "$CATALINA_HOME"/bin/setenv.sh
     90:  fi
     91:  
     92:  # For Cygwin, ensure paths are in UNIX format before anything is touched
     93:  if $cygwin; then
     94:    [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
     95:    [ -n "$JRE_HOME" ] && JRE_HOME=`cygpath --unix "$JRE_HOME"`
     96:    [ -n "$CATALINA_HOME" ] && CATALINA_HOME=`cygpath --unix "$CATALINA_HOME"`
     97:    [ -n "$CATALINA_BASE" ] && CATALINA_BASE=`cygpath --unix "$CATALINA_BASE"`
     98:    [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
     99:    [ -n "$JSSE_HOME" ] && JSSE_HOME=`cygpath --absolute --unix "$JSSE_HOME"`
    100:  fi
    101:  
    102:  # For OS400
    103:  if $os400; then
    104:    # Set job priority to standard for interactive (interactive - 6) by using
    105:    # the interactive priority - 6, the helper threads that respond to requests
    106:    # will be running at the same priority as interactive jobs.
    107:    COMMAND='chgjob job('$JOBNAME') runpty(6)'
    108:    system $COMMAND
    109:  
    110:    # Enable multi threading
    111:    export QIBM_MULTI_THREADED=Y
    112:  fi
    113:  
    114:  # Get standard Java environment variables
    115:  if $os400; then
    116:    # -r will Only work on the os400 if the files are:
    117:    # 1. owned by the user
    118:    # 2. owned by the PRIMARY group of the user
    119:    # this will not work if the user belongs in secondary groups
    120:    BASEDIR="$CATALINA_HOME"
    121:    . "$CATALINA_HOME"/bin/setclasspath.sh 
    122:  else
    123:    if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then
    124:      BASEDIR="$CATALINA_HOME"
    125:      . "$CATALINA_HOME"/bin/setclasspath.sh
    126:    else
    127:      echo "Cannot find $CATALINA_HOME/bin/setclasspath.sh"
    128:      echo "This file is needed to run this program"
    129:      exit 1
    130:    fi
    131:  fi
    132:  
    133:  gcj=no
    134:  "$_RUNJAVA" -version 2>&1 | grep -q "^gij (GNU libgcj)" && gcj=yes
    135:  
    136:  # Add on extra jar files to CLASSPATH
    137:  if [ -n "$JSSE_HOME" -a "$gcj" != "yes" ]; then
    138:    CLASSPATH="$CLASSPATH":"$JSSE_HOME"/lib/jcert.jar:"$JSSE_HOME"/lib/jnet.jar:"$JSSE_HOME"/lib/jsse.jar
    139:  fi
    140:  CLASSPATH="$CLASSPATH":"$CATALINA_HOME"/bin/bootstrap.jar:"$CATALINA_HOME"/bin/commons-logging-api.jar
    141:  
    142:  if [ -z "$CATALINA_BASE" ] ; then
    143:    CATALINA_BASE="$CATALINA_HOME"
    144:  fi
    145:  
    146:  if [ -z "$CATALINA_TMPDIR" ] ; then
    147:    # Define the java.io.tmpdir to use for Catalina
    148:    CATALINA_TMPDIR="$CATALINA_BASE"/temp
    149:  fi
    150:  
    151:  # Bugzilla 37848: When no TTY is available, don't output to console
    152:  have_tty=0
    153:  if [ "`tty`" != "not a tty" ]; then
    154:      have_tty=1
    155:  fi
    156:  
    157:  # For Cygwin, switch paths to Windows format before running java
    158:  if $cygwin; then
    159:    JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
    160:    JRE_HOME=`cygpath --absolute --windows "$JRE_HOME"`
    161:    CATALINA_HOME=`cygpath --absolute --windows "$CATALINA_HOME"`
    162:    CATALINA_BASE=`cygpath --absolute --windows "$CATALINA_BASE"`
    163:    CATALINA_TMPDIR=`cygpath --absolute --windows "$CATALINA_TMPDIR"`
    164:    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
    165:    [ -n "$JSSE_HOME" ] && JSSE_HOME=`cygpath --absolute --windows "$JSSE_HOME"`
    166:    JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
    167:  fi
    168:  
    169:  # Set juli LogManager if it is present
    170:  # Dont use juli LogManager when running with gcj
    171:  if [ -r "$CATALINA_HOME"/bin/tomcat-juli.jar -a "$gcj" != "yes" ]; then
    172:    JAVA_OPTS="$JAVA_OPTS "-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" "-Djava.util.logging.config.file="$CATALINA_BASE/conf/logging.properties"
    173:  fi
    174:  
    175:  # ----- Execute The Requested Command -----------------------------------------
    176:  
    177:  # Bugzilla 37848: only output this if we have a TTY
    178:  if [ $have_tty -eq 1 ]; then
    179:    echo "Using CATALINA_BASE:   $CATALINA_BASE"
    180:    echo "Using CATALINA_HOME:   $CATALINA_HOME"
    181:    echo "Using CATALINA_TMPDIR: $CATALINA_TMPDIR"
    182:    if [ "$1" = "debug" -o "$1" = "javac" ] ; then
    183:      echo "Using JAVA_HOME:       $JAVA_HOME"
    184:    else
    185:      echo "Using JRE_HOME:       $JRE_HOME"
    186:    fi
    187:  fi
    188:  
    189:  if [ "$1" = "jpda" ] ; then
    190:    if [ -z "$JPDA_TRANSPORT" ]; then
    191:      JPDA_TRANSPORT="dt_socket"
    192:    fi
    193:    if [ -z "$JPDA_ADDRESS" ]; then
    194:      JPDA_ADDRESS="8000"
    195:    fi
    196:    if [ -z "$JPDA_SUSPEND" ]; then
    197:      JPDA_SUSPEND="n"
    198:    fi
    199:    if [ -z "$JPDA_OPTS" ]; then
    200:      JPDA_OPTS="-Xdebug -Xrunjdwp:transport=$JPDA_TRANSPORT,address=$JPDA_ADDRESS,server=y,suspend=$JPDA_SUSPEND"
    201:    fi
    202:    CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS"
    203:    shift
    204:  fi
    205:  
    206:  if [ "$1" = "debug" ] ; then
    207:    if $os400; then
    208:      echo "Debug command not available on OS400"
    209:      exit 1
    210:    else
    211:      shift
    212:      if [ "$1" = "-security" ] ; then
    213:        echo "Using Security Manager"
    214:        shift
    215:        exec "$_RUNJDB" $JAVA_OPTS $CATALINA_OPTS \
    216:          -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
    217:          -sourcepath "$CATALINA_HOME"/http://www.cnblogs.com/jakarta-tomcat-catalina/catalina/src/share \
    218:          -Djava.security.manager \
    219:          -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \
    220:          -Dcatalina.base="$CATALINA_BASE" \
    221:          -Dcatalina.home="$CATALINA_HOME" \
    222:          -Djava.io.tmpdir="$CATALINA_TMPDIR" \
    223:          # java io exception 101028
    224:          -Djava.awt.headless=true \ 
    225:          org.apache.catalina.startup.Bootstrap "$@" start
    226:      else
    227:        exec "$_RUNJDB" $JAVA_OPTS $CATALINA_OPTS \
    228:          -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
    229:          -sourcepath "$CATALINA_HOME"/http://www.cnblogs.com/jakarta-tomcat-catalina/catalina/src/share \
    230:          -Dcatalina.base="$CATALINA_BASE" \
    231:          -Dcatalina.home="$CATALINA_HOME" \
    232:          -Djava.io.tmpdir="$CATALINA_TMPDIR" \
    233:          # java io exception 101028
    234:          -Djava.awt.headless=true \ 
    235:          org.apache.catalina.startup.Bootstrap "$@" start
    236:      fi
    237:    fi
    238:  
    239:  elif [ "$1" = "run" ]; then
    240:  
    241:    shift
    242:    if [ "$1" = "-security" ] ; then
    243:      echo "Using Security Manager"
    244:      shift
    245:      exec "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
    246:        -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
    247:        -Djava.security.manager \
    248:        -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \
    249:        -Dcatalina.base="$CATALINA_BASE" \
    250:        -Dcatalina.home="$CATALINA_HOME" \
    251:        -Djava.io.tmpdir="$CATALINA_TMPDIR" \
    252:          # java io exception 101028
    253:          -Djava.awt.headless=true \ 
    254:        org.apache.catalina.startup.Bootstrap "$@" start
    255:    else
    256:      exec "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
    257:        -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
    258:        -Dcatalina.base="$CATALINA_BASE" \
    259:        -Dcatalina.home="$CATALINA_HOME" \
    260:        -Djava.io.tmpdir="$CATALINA_TMPDIR" \
    261:          # java io exception 101028
    262:          -Djava.awt.headless=true \ 
    263:        org.apache.catalina.startup.Bootstrap "$@" start
    264:    fi
    265:  
    266:  elif [ "$1" = "start" ] ; then
    267:  
    268:    shift
    269:    touch "$CATALINA_BASE"/logs/catalina.out
    270:    if [ "$1" = "-security" ] ; then
    271:      if [ "$gcj" = "yes" ]; then
    272:        echo "The java-gcj-compat-dev environment currently doesn't support"
    273:        echo "a security manager. Please check the TOMCAT5_SECURITY variable"
    274:        echo "in /etc/default/tomcat5.5."
    275:        exit 1
    276:      fi
    277:      echo "Using Security Manager"
    278:      shift
    279:      "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
    280:        -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
    281:        -Djava.security.manager \
    282:        -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \
    283:        -Dcatalina.base="$CATALINA_BASE" \
    284:        -Dcatalina.home="$CATALINA_HOME" \
    285:        -Djava.io.tmpdir="$CATALINA_TMPDIR" \
    286:          # java io exception 101028
    287:          -Djava.awt.headless=true \ 
    288:        org.apache.catalina.startup.Bootstrap "$@" start \
    289:        >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
    290:  
    291:        if [ ! -z "$CATALINA_PID" ]; then
    292:          echo $! > $CATALINA_PID
    293:        fi
    294:    else
    295:      "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
    296:        -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
    297:        -Dcatalina.base="$CATALINA_BASE" \
    298:        -Dcatalina.home="$CATALINA_HOME" \
    299:        -Djava.io.tmpdir="$CATALINA_TMPDIR" \
    300:          # java io exception 101028
    301:          -Djava.awt.headless=true \ 
    302:        org.apache.catalina.startup.Bootstrap "$@" start \
    303:        >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
    304:  
    305:        if [ ! -z "$CATALINA_PID" ]; then
    306:          echo $! > $CATALINA_PID
    307:        fi
    308:    fi
    309:  
    310:  elif [ "$1" = "stop" ] ; then
    311:  
    312:    shift
    313:    FORCE=0
    314:    if [ "$1" = "-force" ]; then
    315:      shift
    316:      FORCE=1
    317:    fi
    318:  
    319:    "$_RUNJAVA" $JAVA_OPTS \
    320:      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
    321:      -Dcatalina.base="$CATALINA_BASE" \
    322:      -Dcatalina.home="$CATALINA_HOME" \
    323:      -Djava.io.tmpdir="$CATALINA_TMPDIR" \
    324:          # java io exception 101028
    325:          -Djava.awt.headless=true \ 
    326:      org.apache.catalina.startup.Bootstrap "$@" stop
    327:  
    328:    if [ $FORCE -eq 1 ]; then
    329:      if [ ! -z "$CATALINA_PID" ]; then
    330:         echo "Killing: `cat $CATALINA_PID`"
    331:         kill -9 `cat $CATALINA_PID`
    332:      else
    333:         echo "Kill failed: \$CATALINA_PID not set"
    334:      fi
    335:    fi
    336:  
    337:  elif [ "$1" = "version" ] ; then
    338:  
    339:      "$_RUNJAVA"   \
    340:        -classpath "$CATALINA_HOME/server/lib/catalina.jar" \
    341:        org.apache.catalina.util.ServerInfo
    342:  
    343:  else
    344:  
    345:    echo "Usage: catalina.sh ( commands ... )"
    346:    echo "commands:"
    347:    if $os400; then
    348:      echo "  debug             Start Catalina in a debugger (not available on OS400)"
    349:      echo "  debug -security   Debug Catalina with a security manager (not available on OS400)"
    350:    else
    351:      echo "  debug             Start Catalina in a debugger"
    352:      echo "  debug -security   Debug Catalina with a security manager"
    353:    fi
    354:    echo "  jpda start        Start Catalina under JPDA debugger"
    355:    echo "  run               Start Catalina in the current window"
    356:    echo "  run -security     Start in the current window with security manager"
    357:    echo "  start             Start Catalina in a separate window"
    358:    echo "  start -security   Start in a separate window with security manager"
    359:    echo "  stop              Stop Catalina"
    360:    echo "  stop -force       Stop Catalina (followed by kill -KILL)"
    361:    echo "  version           What version of tomcat are you running?"
    362:    exit 1
    363:  
    364:  fi
    

    Date: 2012-11-21 21:12:36 CST

    Author: machine of awareness

    Org version 7.8.06 with Emacs version 23

    Validate XHTML 1.0
  • 相关阅读:
    文件操作类2
    C# 统计文章中字符的种类和个数 哈希表和字典的使用
    hdu 1018 Big Number (求一个数的阶乘的位数,公式!!!)
    hdu 4313 Matrix (最小生成树krusual)
    孙子定理,求余定理
    poj 1005 Biorhythms (孙子定理,求余定理)
    poj 2151 Check the difficulty of problems (DP)
    poj1861/zoj1542 (最小生成树krusual)
    hdu 1256 画8 (模拟)
    hdu 2082 找单词 (母函数)
  • 原文地址:https://www.cnblogs.com/machine/p/2781505.html
Copyright © 2011-2022 走看看