[logback-user] Google App Engine and java.net.InetAddress
cosanta
public at cosanta.com
Fri May 28 21:44:46 CEST 2010
I'm trying to hook up slf4j/logback into a Google App Engine project but it
looks like I'm running into a problem with a class that GAE blocks, namely
java.net.InetAddress. I'm using the latest: slf4j 1.6.0 and logback 0.9.21,
tied into v1.3.3.1 of the AppEngine SDK and here is my java version:
* java version "1.6.0_18"
* OpenJDK Runtime Environment (IcedTea6 1.8) (6b18-1.8-0ubuntu1)
* OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)
If I don't include a logback.xml, my gae dev server starts up properly and I
see my log messages printed to the console.
The place in *my* code where the failure happens is in the very first call
to grab the logger, in
com.cosanta.eventflow.control.EventServletContextListener:43, which is just:
private org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(this.getClass().getName());
I took the logback.xml right out of the examples:
logback-examples/src/main/java/chapters/configuration/sample0.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<appender name="STDOUT"
class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned by default the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
%msg%n</pattern>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="STDOUT" />
</root>
</configuration>
When I try to start the GAE dev server from my eclipse workspace, I get the
following printed to the console:
May 21, 2010 1:25:05 AM
com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed
/home/sean/Dropbox/dev/workspace/EventFlow/war/WEB-INF/web.xml
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.addHostNameAsProperty(ContextUtil.java:34)
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:60)
at
ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:121)
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
com.cosanta.eventflow.control.EventServletContextListener.<init>(EventServletContextListener.java:43)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at
org.mortbay.jetty.webapp.WebXmlConfiguration.newListenerInstance(WebXmlConfiguration.java:650)
at
org.mortbay.jetty.webapp.WebXmlConfiguration.initListener(WebXmlConfiguration.java:631)
at
org.mortbay.jetty.webapp.WebXmlConfiguration.initWebXmlElement(WebXmlConfiguration.java:368)
at
org.mortbay.jetty.webapp.WebXmlConfiguration.initialize(WebXmlConfiguration.java:289)
at
org.mortbay.jetty.webapp.WebXmlConfiguration.configure(WebXmlConfiguration.java:222)
at
org.mortbay.jetty.webapp.WebXmlConfiguration.configureWebApp(WebXmlConfiguration.java:180)
at
org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1247)
at
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at
org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at
org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at
com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:185)
at
com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:146)
at
com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:219)
at
com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:162)
at
com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
at
com.google.appengine.tools.development.DevAppServerMain.<init>(DevAppServerMain.java:113)
at
com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:89)
01:25:06,971 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found
resource [WEB-INF/logback.xml] at
[file:/home/sean/Dropbox/dev/workspace/EventFlow/war/WEB-INF/logback.xml]
01:25:07,598 |-INFO in
ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute
not set
The server is running at http://localhost:8888/
So as you can see, the server starts fine. It has no problem handling
requests etc but there is no further logging displayed.
The logback code that causes GAE to scream is the placement of the hostname
onto the context in ContextUtils:34:
InetAddress localhost = InetAddress.getLocalHost();
context.putProperty(CoreConstants.HOSTNAME_KEY,
localhost.getHostName());
Has anyone seen the same problem?
Is there something I'm misconfiguring?
If not, is there any way to work around this?
Thanks for your help.
Sean
--
View this message in context: http://old.nabble.com/Google-App-Engine-and-java.net.InetAddress-tp28628992p28628992.html
Sent from the Logback User mailing list archive at Nabble.com.
More information about the Logback-user
mailing list