How are you packaging and running the app? Is application.properties inside a jar / war?

You should be able to repo this locally by running the app the same way that Heroku is running it.

-James


On 03/10/2012 05:00 AM, Daniel Qian wrote:
I have a Java app (using apache wicket and guice).
Everything works fine when I use foreman to start on local machine, but
things go wrong when I deploy it on heroku.

Below is the error message I strip from heroku log.

The red marked line is where the error happenes, and the code is

    public class ConfigProvider implements Provider<Properties> {

    .....

    InputStream input =
    this.getClass().getResourceAsStream("/application.properties");

    .....

    }



2012-03-10T11:11:08+00:00 app[web.1]: INFO : started {} at ?.(?:?) on
2012-03-10 11:11:08,988
INFO : Reading OAuth2 Configuration at
com.github.chillhall.bootstrap.provider.ConfigProvider.(ConfigProvider.java:22)
on 2012-03-10 11:11:09,256
WARN : FAILED guiceFilter: com.google.inject.ProvisionException: Guice
provision errors:

1) Error in custom provider, java.lang.NullPointerException
while locating com.github.chillhall.bootstrap.provider.ConfigProvider
at
com.github.chillhall.bootstrap.Bootstrap$1.configureServlets(Bootstrap.java:31)
while locating java.util.Properties annotated with interface
com.github.chillhall.bootstrap.annotation.WicketConfig

1 error at ?.(?:?) on 2012-03-10 11:11:09,261
com.google.inject.ProvisionException: Guice provision errors:

1) Error in custom provider, java.lang.NullPointerException
while locating com.github.chillhall.bootstrap.provider.ConfigProvider
at
com.github.chillhall.bootstrap.Bootstrap$1.configureServlets(Bootstrap.java:31)
while locating java.util.Properties annotated with interface
com.github.chillhall.bootstrap.annotation.WicketConfig

1 error
at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:987)
at
com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1009)
at
com.github.chillhall.GourmetApplication.getConfigurationType(GourmetApplication.java:105)
at org.apache.wicket.Application.configure(Application.java:297)
at
org.apache.wicket.protocol.http.WebApplication.internalInit(WebApplication.java:613)
at org.apache.wicket.Application.initApplication(Application.java:806)
at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:346)
at com.github.chillhall.wicket.GourmetFilter.init(GourmetFilter.java:25)
at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:286)
at
com.google.inject.servlet.FilterDefinition.init(FilterDefinition.java:114)
at
com.google.inject.servlet.ManagedFilterPipeline.initPipeline(ManagedFilterPipeline.java:98)
at com.google.inject.servlet.GuiceFilter.init(GuiceFilter.java:172)
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:102)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at
org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:745)
at
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:247)
at
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1212)
at
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:589)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:453)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at
org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:89)
at org.eclipse.jetty.server.Server.doStart(Server.java:261)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at com.github.chillhall.JettyBootstrap.main(JettyBootstrap.java:25)
Caused by: java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Properties.java:435)
at java.util.Properties.load0(Properties.java:354)
at java.util.Properties.load(Properties.java:342)
*at
com.github.chillhall.bootstrap.provider.ConfigProvider.get(ConfigProvider.java:26)*
at
com.github.chillhall.bootstrap.provider.ConfigProvider.get(ConfigProvider.java:16)
at
com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:55)
at
com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
at
com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.Scopes$1$1.get(Scopes.java:65)
at
com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978)
at
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974)
... 23 more
WARN : Failed startup of context
o.e.j.w.WebAppContext{/,file:/app/src/main/webapp/},src/main/webapp at
?.(?:?) on 2012-03-10 11:11:09,264
com.google.inject.ProvisionException: Guice provision errors:

1) Error in custom provider, java.lang.NullPointerException
while locating com.github.chillhall.bootstrap.provider.ConfigProvider
at
com.github.chillhall.bootstrap.Bootstrap$1.configureServlets(Bootstrap.java:31)
while locating java.util.Properties annotated with interface
com.github.chillhall.bootstrap.annotation.WicketConfig

1 error
at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:987)
at
com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1009)
at
com.github.chillhall.GourmetApplication.getConfigurationType(GourmetApplication.java:105)
at org.apache.wicket.Application.configure(Application.java:297)
at
org.apache.wicket.protocol.http.WebApplication.internalInit(WebApplication.java:613)
at org.apache.wicket.Application.initApplication(Application.java:806)
at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:346)
at com.github.chillhall.wicket.GourmetFilter.init(GourmetFilter.java:25)
at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:286)
at
com.google.inject.servlet.FilterDefinition.init(FilterDefinition.java:114)
at
com.google.inject.servlet.ManagedFilterPipeline.initPipeline(ManagedFilterPipeline.java:98)
at com.google.inject.servlet.GuiceFilter.init(GuiceFilter.java:172)
at org.eclipse.jetty.servlet.FilterHolder.doStart(FilterHolder.java:102)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at
org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:745)
at
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:247)
at
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1212)
at
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:589)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:453)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at
org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:89)
at org.eclipse.jetty.server.Server.doStart(Server.java:261)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at com.github.chillhall.JettyBootstrap.main(JettyBootstrap.java:25)
Caused by: java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Properties.java:435)
at java.util.Properties.load0(Properties.java:354)
at java.util.Properties.load(Properties.java:342)
at
com.github.chillhall.bootstrap.provider.ConfigProvider.get(ConfigProvider.java:26)
at
com.github.chillhall.bootstrap.provider.ConfigProvider.get(ConfigProvider.java:16)
at
com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:55)
at
com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
at
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
at
com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.Scopes$1$1.get(Scopes.java:65)
at
com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978)
at
com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974)
... 23 more
INFO : Started {} at ?.(?:?) on 2012-03-10 11:11:09,317

--
You received this message because you are subscribed to the Google
Groups "Heroku" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/heroku/-/b7o27WI_F7gJ.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en.

--
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to