java.lang.NoClassDefFoundError: java.net.InetAddress is a restricted class. Please see the Google App Engine developer's guide for more details.

QOS.ch JIRA | Maxim Veksler | 6 years ago
  1. 0

    [LOGBACK-99] Can't use logback on GAE SDK 1.3.7 when configured with logback.xml - QOS.ch JIRA

    qos.ch | 1 year ago
    java.lang.NoClassDefFoundError: java.net.InetAddress is a restricted class. Please see the Google App Engine developer's guide for more details.
  2. 0

    Trying to initialize logback with custom configuration file (logback.xml) running on GAE platform throws the following exception Failed to instantiate [ch.qos.logback.classic.LoggerContext] Reported exception: java.lang.NoClassDefFoundError: java.net.InetAddress is a restricted class. Please see the Google App Engine developer's guide for more details. at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51) at ch.qos.logback.core.util.ContextUtil.getLocalHostName(ContextUtil.java:30) at ch.qos.logback.core.util.ContextUtil.addHostNameAsProperty(ContextUtil.java:39) at ch.qos.logback.classic.joran.action.ConfigurationAction.begin(ConfigurationAction.java:47) at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:273) at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:145) at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:127) at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:40) at ch.qos.logback.core.joran.spi.Interpreter.play(Interpreter.java:332) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:126) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:93) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:52) at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:77) at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150) at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85) at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55) at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254) ...... This happens because ch.qos.logback.core.util.ContextUtil.java contains are reference to a java.net.InetAddress which is a restricted class on Google AppEngine Platform SDK 1.3.7: static String getLocalHostName() throws UnknownHostException { InetAddress localhost = InetAddress.getLocalHost(); return localhost.getHostName(); } I should note that BasicConfigurator is working and is able to configure the logback subsystem. A couple of resolutions I can think of: 1. Don't export this parameter by default, instead let the user choose if to define it or not in the logback.xml configuration file. 2. Create a "GAEConfigurator" which will use default for the limited GAE environment. 2. Provide a custom build for GAE platform, where this parameter will be taken from http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/utils/SystemProperty.html#applicationId or not be defined at all. 4. Provide some method to override / use a different implementation of ContextUtil, one which will be suitable for GAE.

    QOS.ch JIRA | 6 years ago | Maxim Veksler
    java.lang.NoClassDefFoundError: java.net.InetAddress is a restricted class. Please see the Google App Engine developer's guide for more details.
  3. 0

    Trying to initialize logback with custom configuration file (logback.xml) running on GAE platform throws the following exception Failed to instantiate [ch.qos.logback.classic.LoggerContext] Reported exception: java.lang.NoClassDefFoundError: java.net.InetAddress is a restricted class. Please see the Google App Engine developer's guide for more details. at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51) at ch.qos.logback.core.util.ContextUtil.getLocalHostName(ContextUtil.java:30) at ch.qos.logback.core.util.ContextUtil.addHostNameAsProperty(ContextUtil.java:39) at ch.qos.logback.classic.joran.action.ConfigurationAction.begin(ConfigurationAction.java:47) at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:273) at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:145) at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:127) at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:40) at ch.qos.logback.core.joran.spi.Interpreter.play(Interpreter.java:332) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:126) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:93) at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:52) at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:77) at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150) at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85) at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55) at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254) ...... This happens because ch.qos.logback.core.util.ContextUtil.java contains are reference to a java.net.InetAddress which is a restricted class on Google AppEngine Platform SDK 1.3.7: static String getLocalHostName() throws UnknownHostException { InetAddress localhost = InetAddress.getLocalHost(); return localhost.getHostName(); } I should note that BasicConfigurator is working and is able to configure the logback subsystem. A couple of resolutions I can think of: 1. Don't export this parameter by default, instead let the user choose if to define it or not in the logback.xml configuration file. 2. Create a "GAEConfigurator" which will use default for the limited GAE environment. 2. Provide a custom build for GAE platform, where this parameter will be taken from http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/utils/SystemProperty.html#applicationId or not be defined at all. 4. Provide some method to override / use a different implementation of ContextUtil, one which will be suitable for GAE.

    QOS.ch JIRA | 6 years ago | Maxim Veksler
    java.lang.NoClassDefFoundError: java.net.InetAddress is a restricted class. Please see the Google App Engine developer's guide for more details.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    [appengine-java] java.net.InetAddress and logback 0.9.21

    Google Groups | 7 years ago | Sean
    java.lang.NoClassDefFoundError: java.net.InetAddress is a restricted class. Please see the Google App Engine developer's guide for more details.
  6. 0

    Unable to use JRuby with google app engine due to use of sun.misc.Unsafe

    GitHub | 2 years ago | jaydonnell
    java.lang.NoClassDefFoundError: sun.misc.Unsafe is a restricted class. Please see the Google App Engine developer's guide for more details.

    11 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NoClassDefFoundError

      java.net.InetAddress is a restricted class. Please see the Google App Engine developer's guide for more details.

      at com.google.appengine.tools.development.agent.runtime.Runtime.reject()
    2. com.google.appengine
      Runtime.reject
      1. com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
      1 frame
    3. Logback Core Module
      ContextUtil.addHostNameAsProperty
      1. ch.qos.logback.core.util.ContextUtil.getLocalHostName(ContextUtil.java:30)
      2. ch.qos.logback.core.util.ContextUtil.addHostNameAsProperty(ContextUtil.java:39)
      2 frames
    4. Logback Classic Module
      ConfigurationAction.begin
      1. ch.qos.logback.classic.joran.action.ConfigurationAction.begin(ConfigurationAction.java:47)
      1 frame
    5. Logback Core Module
      GenericConfigurator.doConfigure
      1. ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:273)
      2. ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:145)
      3. ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:127)
      4. ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:40)
      5. ch.qos.logback.core.joran.spi.Interpreter.play(Interpreter.java:332)
      6. ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:126)
      7. ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:93)
      8. ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:52)
      8 frames
    6. Logback Classic Module
      ContextInitializer.autoConfig
      1. ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:77)
      2. ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
      2 frames
    7. SLF4J LOG4J-12 Binding
      StaticLoggerBinder.<clinit>
      1. org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
      2. org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
      2 frames
    8. SLF4J API Module
      LoggerFactory.getLogger
      1. org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
      2. org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
      3. org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
      4. org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
      5. org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
      5 frames