Wrote a simple web app that uses programmatic configuration of Log4J2 . ( no log4j2.xml )
The configurator snippet looks like below
ConfigurationBuilder<BuiltConfiguration> builder = ConfigurationBuilderFactory.newConfigurationBuilder();
builder.setStatusLevel(Level.ERROR);
builder.setConfigurationName("LogicLoggerConfigurations");
builder.setPackages("main.logging.config");
AppenderComponentBuilder appenderBuilderConsole = builder.newAppender("Stdout", "CONSOLE").addAttribute("target",
ConsoleAppender.Target.SYSTEM_OUT);
AppenderComponentBuilder appenderBuilderFile = builder.newAppender("toFile", "FILE").addAttribute("fileName",
"/pathto/logtest.log");
appenderBuilderConsole.add(builder.newLayout("PatternLayout")
.addAttribute("pattern", "%d [%t] %-5level: %msg%n%throwable"));
appenderBuilderFile.add(builder.newLayout("PatternLayout")
.addAttribute("pattern", "%d [%t] %-5level: %msg%n%throwable"));
AppenderComponentBuilder appenderBuilder = builder.newAppender("lacmem", "LogicMemoryAppender");
appenderBuilder.add(builder.newLayout("PatternLayout")
.addAttribute("pattern", "%d [%t] %-5level: %msg%n%throwable"));
builder.add(appenderBuilder);
builder.add(appenderBuilderConsole);
builder.add(appenderBuilderFile);
builder.add(builder.newLogger("main", Level.TRACE)
.add(builder.newAppenderRef("lacmem")).addAttribute("additivity", true));
builder.add(builder.newRootLogger(Level.ERROR).add(builder.newAppenderRef("Stdout"))
.add(builder.newAppenderRef("toFile")));
logicLoggerContext = Configurator.initialize(builder.build());
logicLoggerContext.updateLoggers();
There is a custom appender (plugin) under packages main.logging.config that looks like below
#Plugin(name = "LogicMemoryAppender", category = "Core", elementType = "appender", printObject = true)
public class LogicMemoryAppender extends AbstractAppender {
List<Map<String, Object>> logs = new CopyOnWriteArrayList<>();
protected LogicMemoryAppender(String name, Filter filter, Layout<? extends Serializable> layout, boolean ignoreExceptions) {
super(name, filter, layout, ignoreExceptions);
}
/*
*
* #see
* org.apache.logging.log4j.core.Appender#append(org.apache.logging.log4j.
* core.LogEvent)
*/
public void append(LogEvent event) {
Map<String, Object> logEntry = new HashMap<String, Object>();
logEntry.put("logger", event.getLoggerName());
if (null != event.getLevel())
logEntry.put("level", event.getLevel());
long millis = event.getTimeMillis();
logEntry.put("ts", millis);
logEntry.put("timestamp", "timestamp");
String exceptionText = "";
if (null != event.getThrown()) {
exceptionText = event.getThrown().getMessage();
}
String msg = event.getMessage().toString();
if (!msg.isEmpty()) {
msg = msg.replace("\"", "\\\"");
msg = msg.replace("\n", "\\n");
if (!exceptionText.isEmpty()) {
logEntry.put("message", msg + " : " + exceptionText);
} else {
logEntry.put("message", msg);
}
} else {
logEntry.put("message", exceptionText);
}
System.out.println("Log entry added "+logEntry);
logs.add(logEntry);
}
/**
* Factory method called by Log4j2 to initialize this appender.
* #param name
* #param layout
* #param filter
* #return
*/
#PluginFactory
public static LogicMemoryAppender createAppender(
#PluginAttribute("name") String name,
#PluginElement("Layout") Layout<? extends Serializable> layout,
#PluginElement("Filter") final Filter filter) {
if (name == null) {
LOGGER.error("No name provided for LogicMemoryAppender");
return null;
}
if (layout == null) {
layout = PatternLayout.createDefaultLayout();
}
return new LogicMemoryAppender(name, filter, layout, true);
}
}
The application is a servlet based app that has a single logging statement under doGet()
soloLogger = LogManager.getLogger();
soloLogger.trace("What is up");
I also disable the logging subsystem by adding the below config to Web-Inf
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclude-subsystems>
<subsystem name="logging"/>
</exclude-subsystems>
</deployment>
</jboss-deployment-structure>
The application is deployed as a WAR file and uploaded to WildFly via the admin console.
Once i visit the URL, I see the below error in Wildfly console. The code works as expected for Tomcat8x and Weblogic 12.2.1.3 but not Jboss. :(
5:12:45,204 INFO [stdout] (default task-1) 2017-10-30 15:12:45,203 default task-1 ERROR Unable to locate plugin type for LogicMemoryAppender
15:12:45,237 INFO [stdout] (default task-1) 2017-10-30 15:12:45,237 default task-1 ERROR Unable to locate plugin for LogicMemoryAppender
15:12:45,247 INFO [stdout] (default task-1) 2017-10-30 15:12:45,246 default task-1 ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.config.AppendersPlugin for element Appenders: java.lang.NullPointerException java.lang.NullPointerException
15:12:45,247 INFO [stdout] (default task-1) at org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.visit(PluginElementVisitor.java:52)
15:12:45,247 INFO [stdout] (default task-1) at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.generateParameters(PluginBuilder.java:248)
15:12:45,247 INFO [stdout] (default task-1) at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:135)
15:12:45,247 INFO [stdout] (default task-1) at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:958)
15:12:45,247 INFO [stdout] (default task-1) at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:898)
15:12:45,247 INFO [stdout] (default task-1) at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:513)
15:12:45,247 INFO [stdout] (default task-1) at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:237)
15:12:45,247 INFO [stdout] (default task-1) at org.apache.logging.log4j.core.config.builder.impl.DefaultConfigurationBuilder.build(DefaultConfigurationBuilder.java:204)
15:12:45,247 INFO [stdout] (default task-1) at org.apache.logging.log4j.core.config.builder.impl.DefaultConfigurationBuilder.build(DefaultConfigurationBuilder.java:161)
15:12:45,247 INFO [stdout] (default task-1) at org.apache.logging.log4j.core.config.builder.impl.DefaultConfigurationBuilder.build(DefaultConfigurationBuilder.java:57)
15:12:45,247 INFO [stdout] (default task-1) at main.test.HanSolo.initConfig(HanSolo.java:63)
15:12:45,248 INFO [stdout] (default task-1) at main.test.HanSolo.<clinit>(HanSolo.java:23)
15:12:45,248 INFO [stdout] (default task-1) at main.test.TestLogging.doGet(TestLogging.java:31)
15:12:45,248 INFO [stdout] (default task-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
15:12:45,248 INFO [stdout] (default task-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
15:12:45,248 INFO [stdout] (default task-1) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
15:12:45,248 INFO [stdout] (default task-1) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
15:12:45,248 INFO [stdout] (default task-1) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
15:12:45,248 INFO [stdout] (default task-1) at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
15:12:45,248 INFO [stdout] (default task-1) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
15:12:45,248 INFO [stdout] (default task-1) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
15:12:45,248 INFO [stdout] (default task-1) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
15:12:45,248 INFO [stdout] (default task-1) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
15:12:45,248 INFO [stdout] (default task-1) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
15:12:45,248 INFO [stdout] (default task-1) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
15:12:45,248 INFO [stdout] (default task-1) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
15:12:45,248 INFO [stdout] (default task-1) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
15:12:45,248 INFO [stdout] (default task-1) at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
15:12:45,249 INFO [stdout] (default task-1) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
15:12:45,249 INFO [stdout] (default task-1) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
15:12:45,249 INFO [stdout] (default task-1) at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
15:12:45,249 INFO [stdout] (default task-1) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
15:12:45,249 INFO [stdout] (default task-1) at org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
15:12:45,249 INFO [stdout] (default task-1) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
15:12:45,249 INFO [stdout] (default task-1) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
15:12:45,249 INFO [stdout] (default task-1) at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
15:12:45,249 INFO [stdout] (default task-1) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
15:12:45,249 INFO [stdout] (default task-1) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
15:12:45,249 INFO [stdout] (default task-1) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
15:12:45,249 INFO [stdout] (default task-1) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
15:12:45,249 INFO [stdout] (default task-1) at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
15:12:45,249 INFO [stdout] (default task-1) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
15:12:45,249 INFO [stdout] (default task-1) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
15:12:45,249 INFO [stdout] (default task-1) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
15:12:45,249 INFO [stdout] (default task-1) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
15:12:45,249 INFO [stdout] (default task-1) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
15:12:45,249 INFO [stdout] (default task-1) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
15:12:45,249 INFO [stdout] (default task-1) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
15:12:45,249 INFO [stdout] (default task-1) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:326)
15:12:45,250 INFO [stdout] (default task-1) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:812)
15:12:45,250 INFO [stdout] (default task-1) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
15:12:45,250 INFO [stdout] (default task-1) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
15:12:45,250 INFO [stdout] (default task-1) at java.lang.Thread.run(Thread.java:745)
15:12:45,250 INFO [stdout] (default task-1)
15:12:45,250 INFO [stdout] (default task-1) 2017-10-30 15:12:45,250 default task-1 ERROR Unable to locate appender "Stdout" for logger config "root"
15:12:45,250 INFO [stdout] (default task-1) 2017-10-30 15:12:45,250 default task-1 ERROR Unable to locate appender "toFile" for logger config "root"
15:12:45,251 INFO [stdout] (default task-1) 2017-10-30 15:12:45,251 default task-1 ERROR Unable to locate appender "lacmem" for logger config "main"
Log4j2 does not seem to recognize the annotated plugin in WildFly. Not sure if this is a problem with log4j2 or WildFly.
JVM is Java 8x112
EDIT: Same error on WildFly 10 Final.
I could not find the solution for the problem referred above but i did find a workaround.
Instead of doing configuration programmatically, i combined it with an XML configuration file (log4j2.xml). Inside the XML, I initialized all the loggers that i use in the code.
Check out the official doc for more information on how to combine.
Then for the programmatic configuration
1. Create your own ConfigurationFactory that
2. returns an instance of your own XMLConfiguration ->Create a class that extends XMLConfiguration that manipulates and adds appenders to the above loggers ( LoggerConfig).
Once i am done changing the configuration, i called myloggercontext.updateLoggers() to load the changes. One thing to note here is that, to get your ConfigurationFactory registered, you will have to add a property file called log4j2.component.properties to the classpath. The content of my property file is as below
log4j.configurationFactory=main.logging.config.LogConfigurationFactory
This would make sure that your ConfigurationFactory gets loaded before any calls to the logger inside your app.
The above changes worked for JBoss as it was able to load the plugins as expected.
Related
This setup was already running and working fine. But something happened: maybe some package got updated, some file corrupted or a network change broke it.
The command bin/gerrit.sh start returns Starting Gerrit Code Review: FAILED.
logs/error_log:
[2018-11-28 11:49:01,135] [main] WARN com.google.gerrit.sshd.SshDaemon : Disabling cipher aes192-ctr: Unable to initialize cipher BaseCipher[AES,16,24,AES/CTR/NoPadding]
[2018-11-28 11:49:01,135] [main] WARN com.google.gerrit.sshd.SshDaemon : Disabling cipher aes256-ctr: Unable to initialize cipher BaseCipher[AES,16,32,AES/CTR/NoPadding]
[2018-11-28 11:49:01,138] [main] WARN com.google.gerrit.sshd.SshDaemon : Disabling cipher arcfour256: Illegal key size or default parameters; try installing unlimited cryptography extension
[2018-11-28 11:49:01,145] [main] WARN com.google.gerrit.sshd.SshDaemon : Disabling cipher aes192-cbc: Unable to initialize cipher BaseCipher[AES,16,24,AES/CBC/NoPadding]
[2018-11-28 11:49:01,145] [main] WARN com.google.gerrit.sshd.SshDaemon : Disabling cipher aes256-cbc: Unable to initialize cipher BaseCipher[AES,16,32,AES/CBC/NoPadding]
[2018-11-28 11:49:01,214] [main] WARN com.google.gerrit.sshd.SshDaemon : Cannot format SSHD host key [EdDSA]: invalid key type
[2018-11-28 11:49:01,227] [main] WARN com.google.gerrit.server.config.GitwebCgiConfig : gitweb not installed (no /usr/lib/cgi-bin/gitweb.cgi found)
[2018-11-28 11:49:02,025] [main] INFO org.eclipse.jetty.util.log : Logging initialized #8689ms
[2018-11-28 11:49:02,102] [main] INFO com.google.gerrit.server.git.LocalDiskRepositoryManager : Defaulting core.streamFileThreshold to 332m
[2018-11-28 11:49:02,121] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Removing stale plugin file: plugin_hooks_181128_1116_5514078957117773811.jar
[2018-11-28 11:49:02,121] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Removing stale plugin file: plugin_events-log_181128_1116_8975419966674917654.jar
[2018-11-28 11:49:02,122] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Removing stale plugin file: plugin_download-commands_181128_1116_7149912149640119287.jar
[2018-11-28 11:49:02,122] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Removing stale plugin file: plugin_replication_181128_1116_3000551844744811569.jar
[2018-11-28 11:49:02,122] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Removing stale plugin file: plugin_commit-message-length-validator_181128_1116_2800985912637941647.jar
[2018-11-28 11:49:02,122] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Removing stale plugin file: plugin_reviewnotes_181128_1116_1435979824854811361.jar
[2018-11-28 11:49:02,122] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Removing stale plugin file: plugin_singleusergroup_181128_1116_4944938881709642049.jar
[2018-11-28 11:49:02,122] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Loading plugins from /home/gerrit/gerrit_testsite/plugins
[2018-11-28 11:49:02,199] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin commit-message-length-validator, version v2.14.2
[2018-11-28 11:49:02,250] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin download-commands, version v2.14.2
[2018-11-28 11:49:02,484] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin events-log, version e271462
[2018-11-28 11:49:02,550] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin hooks, version v2.14.2
[2018-11-28 11:49:02,638] [main] WARN com.googlesource.gerrit.plugins.replication.ReplicationFileBasedConfig : Config file /home/gerrit/gerrit_testsite/etc/replication.config does not exist; not replicating
[2018-11-28 11:49:02,641] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin replication, version v2.14.2
[2018-11-28 11:49:02,697] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin reviewnotes, version v2.14.2
[2018-11-28 11:49:02,736] [main] INFO com.google.gerrit.server.plugins.PluginLoader : Loaded plugin singleusergroup, version v2.14.2
[2018-11-28 11:49:02,975] [main] INFO com.google.gerrit.server.change.ChangeCleanupRunner : Ignoring missing changeCleanup schedule configuration
[2018-11-28 11:49:02,998] [main] INFO com.google.gerrit.sshd.SshDaemon : Started Gerrit SSHD-CORE-1.4.0 on *:29419
[2018-11-28 11:49:03,002] [main] INFO org.eclipse.jetty.server.Server : jetty-9.3.17.v20170317
[2018-11-28 11:49:03,787] [main] INFO org.eclipse.jetty.server.handler.ContextHandler : Started o.e.j.s.ServletContextHandler#384cd83a{/r,null,AVAILABLE}
[2018-11-28 11:49:43,834] [main] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
java.lang.IllegalStateException: Cannot start HTTP daemon
at com.google.gerrit.pgm.http.jetty.JettyServer$Lifecycle.start(JettyServer.java:106)
at com.google.gerrit.lifecycle.LifecycleManager.start(LifecycleManager.java:92)
at com.google.gerrit.pgm.Daemon.start(Daemon.java:323)
at com.google.gerrit.pgm.Daemon.run(Daemon.java:232)
at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:204)
at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:108)
at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:63)
at Main.main(Main.java:24)
Caused by: java.net.SocketException: Unresolved address
at sun.nio.ch.Net.translateToSocketException(Net.java:131)
at sun.nio.ch.Net.translateException(Net.java:157)
at sun.nio.ch.Net.translateException(Net.java:163)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:76)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:317)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:235)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:401)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at com.google.gerrit.pgm.http.jetty.JettyServer$Lifecycle.start(JettyServer.java:92)
... 12 more
Caused by: java.nio.channels.UnresolvedAddressException
at sun.nio.ch.Net.checkAddress(Net.java:101)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:218)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
... 19 more
The configuration file is listed below, we use a LDAP server to authenticate:
[gerrit]
basePath = git
serverId = c3094920-33f3-4219-82cf-0181f4f0c7e7
canonicalWebUrl = http://oururl/r/
[database]
type = h2
database = /home/gerrit/gerrit_testsite/db/ReviewDB
[index]
type = LUCENE
[auth]
type = ldap
gitBasicAuthPolicy = LDAP
[ldap]
server = ldap://ldapserver
accountBase = OU=Usuários Rede,DC=company,DC=com,DC=br
groupBase = OU=Grupos,DC=company,DC=com,DC=br
referral = follow
accountPattern = (mailNickname=${username})
groupPattern = (memberOf=${cn})
accountFullName = cn
accountEmailAddress = mail
localUsernameToLowerCase = true
accountSshUserName = cn
username = ldapread#company.com.br
password = pass
[receive]
enableSignedPush = false
[sendemail]
smtpServer = mail.company.com.br
smtpServerPort = 587
smtpEncryption = tls
sslVerify = false
allowedDomain = company.com.br
smtpUser = gerrit#company.com.br
smtpPass = pass
[container]
user = gerrit
javaHome = /usr/lib/jvm/java-8-oracle/jre
[sshd]
listenAddress = *:29419
[httpd]
listenUrl = http://engenharia.company.com.br:8888/r/
[cache]
directory = cache
[download]
command = checkout
command = cherry_pick
command = format_patch
command = pull
scheme = ssh
[capability]
accessDatabase = group Administrators
[plugins]
allowRemoteAdmin = true
[plugin "events-log"]
storeUrl = jdbc:h2:/tmp/db
What can I do to debug the issue? (I haven't done the Gerrit setup and installation.)
It wasn't related to Gerrit.
A network change disabled Gerrit. After changing the DNS server and gateway of the Gerrit machine, everything is working again.
We are upgrading grails version from 1.3.7 to 2.4.4 and see the below exception in the logs. Does anyone know what I am missing? Any help is greatly appreciated.
I have updated all the dependencies below to 2.4.4 along with grails-web:
grails-bootstrap
grails-core
grails-resources
grails-spring
grails-web
grails-project-api
grails-maven-plugin
2017-07-04 11:08:24,787 INFO [io.undertow.servlet] (default task-1) Initializing Spring FrameworkServlet 'gsp'
2017-07-04 11:08:24,790 INFO [org.codehaus.groovy.grails.web.pages.GroovyPagesServlet] (default task-1) FrameworkServlet 'gsp': initialization started
2017-07-04 11:08:24,791 INFO [io.undertow.servlet] (default task-1) GSP servlet initialized
2017-07-04 11:08:24,833 ERROR [org.codehaus.groovy.grails.web.pages.GroovyPagesServlet] (default task-1) Context initialization failed: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'groovyPagesTemplateEngine' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:570)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1114)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:279)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:270)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1121)
at org.codehaus.groovy.grails.web.pages.GroovyPagesServlet.initFrameworkServlet(GroovyPagesServlet.java:114)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:460)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:244)
at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)
at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:239)
at io.undertow.servlet.core.ManagedServlet.getServlet(ManagedServlet.java:171)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:84)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:285)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:264)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:175)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:792)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
In case if anyone needs help on this - With grails 2.4.4, the groovyPagesTemplateEngine is moved to a different jar by name grails-web-gsp-2.4.4.jar
Including this along with grails-web-gsp-taglib-2.4.4.jar resolved the issue.
In my grails application I had a custom redirect for "404". Whenever the application used to hit a 404, it used to log the request.forwardURI and redirect the user to a 404 page. But after upgrading to wildfly-8.0.0(also tried 8.1.0 and 9.0.0-alpha), the application doesn't log the actual URI( request.forwardURI).
However, in the request dump I see the actual URI that was requested. I believe, it might not be a grails problem as the actual request is getting logged in jboss-4 and the jboss-eap-6.2.
The Request class in wildfly is HttpServletRequestImpl, whereas in older version it was ApplicationHttpRequest.
I have copied the war into https://www.dropbox.com/sh/trzzmfp7pp5ut0f/AADBDczE4fx1oJGDUAw8FxAqa?dl=0. Please let me know if is there any other way by which I can get the actual request.
Logs for wildfly
10:32:18,242 INFO [stdout] (default task-8) Request Class *** class io.undertow.servlet.spec.HttpServletRequestImpl
10:32:18,242 INFO [stdout] (default task-8) Request dump-------------------
10:32:18,245 INFO [stdout] (default task-8) <io.undertow.servlet.spec.HttpServletRequestImpl#6d806f8e exchange=HttpServerExchange{ GET /test1/grails/common/redirectUrl.dispatch} originalServletContext=io.undertow.servlet.spec.ServletContextImpl#4a622bb servletContext=io.undertow.servlet.spec.ServletContextImpl#4a622bb attributes=[javax.servlet.forward.request_uri:/test1/grails-errorhandler, org.springframework.web.servlet.DispatcherServlet.THEME_SOURCE:org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext#52728c5: startup date [Thu Sep 18 10:31:55 IST 2014]; parent: Root WebApplicationContext, org.springframework.web.servlet.DispatcherServlet.THEME_RESOLVER:org.springframework.web.servlet.theme.FixedThemeResolver#39ec09de, javax.servlet.forward.context_path:/test1, javax.servlet.error.servlet_name:default, javax.servlet.error.message:Not Found, javax.servlet.forward.servlet_path:/grails-errorhandler, org.codehaus.groovy.grails.GRAILS_APPLICATION_ATTRIBUTES:org.codehaus.groovy.grails.web.servlet.DefaultGrailsApplicationAttributes#377beb87, urlMapping.FILTERED:true, charEncodingFilter.FILTERED:true, org.codehaus.groovy.grails.FLASH_SCOPE:[:], org.codehaus.groovy.grails.CONTROLLER_NAME_ATTRIBUTE:common, org.codehaus.groovy.grails.CONTROLLER:CommonController#28a40886, javax.servlet.error.request_uri:/test1/asdf, hiddenHttpMethod.FILTERED:true, grailsWebRequest.FILTERED:true, javax.servlet.forward.query_string:null, org.springframework.web.servlet.DispatcherServlet.FLASH_MAP_MANAGER:org.springframework.web.servlet.support.SessionFlashMapManager#292baa42, javax.servlet.forward.path_info:null, org.springframework.web.servlet.DispatcherServlet.CONTEXT:org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext#52728c5: startup date [Thu Sep 18 10:31:55 IST 2014]; parent: Root WebApplicationContext, javax.servlet.error.status_code:404, org.codehaus.grails.INCLUDED_JS_LIBRARIES:[], org.codehaus.groovy.grails.ACTION_NAME_ATTRIBUTE:redirectUrl, org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.GSP_SITEMESH_PAGE:org.codehaus.groovy.grails.web.sitemesh.GSPSitemeshPage#71b6e82b, org.springframework.web.servlet.DispatcherServlet.OUTPUT_FLASH_MAP:[:], com.opensymphony.sitemesh.APPLIED_ONCE:true, org.hibernate.impl.SessionFactoryImpl#22de1eda.PARTICIPATE:1, org.codehaus.groovy.grails.WEB_REQUEST:ServletWebRequest: uri=/test1/grails/common/redirectUrl.dispatch;client=127.0.0.1, org.springframework.web.servlet.DispatcherServlet.LOCALE_RESOLVER:org.springframework.web.servlet.i18n.SessionLocaleResolver#1f449960] servletInputStream=null reader=null cookies=null parts=null asyncStarted=false asyncContext=null queryParameters=[:[]] parsedFormData=null characterEncoding=UTF-8 readStarted=false sessionCookieSource=null>
10:32:18,246 INFO [stdout] (default task-8) ---------------------------
10:32:18,247 INFO [stdout] (default task-8) Request URI *** /test1/grails/common/redirectUrl.dispatch
10:32:18,249 INFO [stdout] (default task-8) Forward URI *** /test1/grails-errorhandler
Logs for older jboss
10:25:37,510 INFO [stdout] (http-/127.0.0.1:8080-1) Request Class *** class org.apache.catalina.core.ApplicationHttpRequest
10:25:37,510 INFO [stdout] (http-/127.0.0.1:8080-1) Request dump-------------------
10:25:37,514 INFO [stdout] (http-/127.0.0.1:8080-1) <org.apache.catalina.core.ApplicationHttpRequest#4cc7420c context=StandardEngine[jboss.web].StandardHost[default-host].StandardContext[/test1] contextPath=/test1 crossContext=false dispatcherType=1 parameters=[:] parsedParams=true pathInfo=null queryParamString=null queryString=null requestDispatcherPath=/grails-errorhandler requestURI=/test1/grails/common/redirectUrl.dispatch servletPath=/grails/common/redirectUrl.dispatch session=null specialAttributes=[null, null, null, null, null, null, null, null, null, null, null, null, null, null, null] request=org.apache.catalina.core.ApplicationHttpRequest#1ad23c25>
10:25:37,514 INFO [stdout] (http-/127.0.0.1:8080-1) ------------URI and domainname --------------
10:25:37,515 INFO [stdout] (http-/127.0.0.1:8080-1) Request URI *** / /test1/grails/common/redirectUrl.dispatch
10:25:37,516 INFO [stdout] (http-/127.0.0.1:8080-1) Forward URI *** /test1/test
I was able to get the forwardURI through another workaround. Though, not the ideal way to get the forwardURI, but it worked for me.
forwardURI = request?.attributes.get("javax.servlet.error.request_uri")
I have a facelet that refreshes the browser window 30 seconds after session timeout e.g.
<a4j:region>
<h:form>
<a4j:poll id="poll" interval="#{(session.maxInactiveInterval + 30)*1000}" onbegin="window.document.location.href='/Patrac'"/>
</h:form>
</a4j:region>
The facelet, when reloaded, causes a method to be invoked on a SFSB e.g.
<ui:define name="title">PATRAC - #{workflowManager.currentWorkflow.screenTitle}</ui:define>
The SFSB is session scoped.
#SessionScoped
#Stateful
public class WorkflowManager {
...
public Workflow getCurrentWorkflow() { return currentWorkflow; }
#PreDestroy public void bye() { System.out.println("Destroying: "+ getClass().getName() +", ID = "+ getId()); }
}
85 percent of the time the screen is refreshed without incident:
15:56:44,951 INFO [stdout] (http-/127.0.0.1:8443-1) Destroying: com.patrac.controller.statemachine.WorkflowManager, ID = -1906221148858801782
15:56:44,968 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-1) NoCacheFilter.doFilter() URI: /Patrac/
15:58:01,343 INFO [stdout] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) Destroying: com.patrac.controller.statemachine.WorkflowManager, ID = -3546919396833964128
15:58:15,288 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-3) NoCacheFilter.doFilter() URI: /Patrac/index.xhtml
15:58:15,319 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-4) NoCacheFilter.doFilter() URI: /Patrac/
15:58:15,349 WARNING [com.patrac.controller.exceptionhandler.ViewExpiredExceptionHandler] (http-/127.0.0.1:8443-3) Attempt to access an expired view: /index.xhtml from remote host: 127.0.0.1
15:58:15,389 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-4) NoCacheFilter.doFilter() URI: /Patrac/index.xhtml
15:59:45,771 INFO [stdout] (http-/127.0.0.1:8443-1) Destroying: com.patrac.controller.statemachine.WorkflowManager, ID = -5655846827584878649
15:59:45,777 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-1) NoCacheFilter.doFilter() URI: /Patrac/index.xhtml
15:59:45,800 WARNING [com.patrac.controller.exceptionhandler.ViewExpiredExceptionHandler] (http-/127.0.0.1:8443-1) Attempt to access an expired view: /index.xhtml from remote host: 127.0.0.1
15:59:45,890 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-1) NoCacheFilter.doFilter() URI: /Patrac/index.xhtml
16:00:01,356 INFO [stdout] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) Destroying: com.patrac.controller.statemachine.WorkflowManager, ID = 4579100734353654546
16:01:01,363 INFO [stdout] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) Destroying: com.patrac.controller.statemachine.WorkflowManager, ID = 4317425328092070112
16:01:16,518 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-3) NoCacheFilter.doFilter() URI: /Patrac/index.xhtml
16:01:16,526 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-8) NoCacheFilter.doFilter() URI: /Patrac/
16:01:16,544 WARNING [com.patrac.controller.exceptionhandler.ViewExpiredExceptionHandler] (http-/127.0.0.1:8443-3) Attempt to access an expired view: /index.xhtml from remote host: 127.0.0.1
16:01:16,572 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-3) NoCacheFilter.doFilter() URI: /Patrac/index.xhtml
16:02:46,894 INFO [stdout] (http-/127.0.0.1:8443-1) Destroying: com.patrac.controller.statemachine.WorkflowManager, ID = 7360031599060690367
16:02:46,900 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-1) NoCacheFilter.doFilter() URI: /Patrac/index.xhtml
16:02:46,923 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-6) NoCacheFilter.doFilter() URI: /Patrac/
16:02:46,950 WARNING [com.patrac.controller.exceptionhandler.ViewExpiredExceptionHandler] (http-/127.0.0.1:8443-1) Attempt to access an expired view: /index.xhtml from remote host: 127.0.0.1
16:02:46,975 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-1) NoCacheFilter.doFilter() URI: /Patrac/index.xhtml
16:03:01,380 INFO [stdout] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) Destroying: com.patrac.controller.statemachine.WorkflowManager, ID = -5741388414554084710
16:04:01,389 INFO [stdout] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) Destroying: com.patrac.controller.statemachine.WorkflowManager, ID = -1149102875316717372
16:04:01,395 INFO [stdout] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) Destroying: com.patrac.controller.statemachine.WorkflowManager, ID = -7198492156368620025
16:04:17,355 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-7) NoCacheFilter.doFilter() URI: /Patrac/index.xhtml
16:04:17,365 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-8) NoCacheFilter.doFilter() URI: /Patrac/
16:04:17,405 WARNING [com.patrac.controller.exceptionhandler.ViewExpiredExceptionHandler] (http-/127.0.0.1:8443-7) Attempt to access an expired view: /index.xhtml from remote host: 127.0.0.1
16:04:17,460 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-8) NoCacheFilter.doFilter() URI: /Patrac/index.xhtml
16:05:47,769 INFO [stdout] (http-/127.0.0.1:8443-7) Destroying: com.patrac.controller.statemachine.WorkflowManager, ID = -8106288024707282506
16:05:47,773 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-7) NoCacheFilter.doFilter() URI: /Patrac/index.xhtml
16:05:47,808 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-6) NoCacheFilter.doFilter() URI: /Patrac/
16:05:47,809 WARNING [com.patrac.controller.exceptionhandler.ViewExpiredExceptionHandler] (http-/127.0.0.1:8443-7) Attempt to access an expired view: /index.xhtml from remote host: 127.0.0.1
16:05:47,856 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-7) NoCacheFilter.doFilter() URI: /Patrac/index.xhtml
16:06:01,409 INFO [stdout] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) Destroying: com.patrac.controller.statemachine.WorkflowManager, ID = 6737131848251158629
16:07:01,419 INFO [stdout] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) Destroying: com.patrac.controller.statemachine.WorkflowManager, ID = -3248726216386741006
16:07:01,423 INFO [stdout] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) Destroying: com.patrac.controller.statemachine.WorkflowManager, ID = -7798326820709515585
16:07:18,188 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-8) NoCacheFilter.doFilter() URI: /Patrac/
16:07:18,188 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-1) NoCacheFilter.doFilter() URI: /Patrac/index.xhtml
16:07:18,219 WARNING [com.patrac.controller.exceptionhandler.ViewExpiredExceptionHandler] (http-/127.0.0.1:8443-1) Attempt to access an expired view: /index.xhtml from remote host: 127.0.0.1
16:07:18,250 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-1) NoCacheFilter.doFilter() URI: /Patrac/index.xhtml
However, sometimes the following happens:
16:08:48,536 INFO [stdout] (http-/127.0.0.1:8443-7) Destroying: com.patrac.controller.statemachine.WorkflowManager, ID = 601708170643229812
16:08:48,537 INFO [com.patrac.filter.NoCacheFilter] (http-/127.0.0.1:8443-7) NoCacheFilter.doFilter() URI: /Patrac/index.xhtml
16:08:48,540 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host]] (http-/127.0.0.1:8443-3) Exception sending request initialized lifecycle event to listener instance of class org.jboss.weld.servlet.WeldListener: javax.ejb.NoSuchEJBException: JBAS016055: EJB has been removed
at org.jboss.as.weld.ejb.StatefulSessionObjectReferenceImpl.getBusinessObject(StatefulSessionObjectReferenceImpl.java:124) [jboss-as-weld-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:108) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
at com.patrac.controller.statemachine.WorkflowManager$Proxy$_$$_Weld$Proxy$.toString(WorkflowManager$Proxy$_$$_Weld$Proxy$.java) [Patrac-ejb.jar:]
at java.lang.String.valueOf(String.java:2854) [rt.jar:1.7.0_07]
at java.lang.StringBuilder.append(StringBuilder.java:128) [rt.jar:1.7.0_07]
at org.jboss.weld.context.SerializableContextualInstanceImpl.toString(SerializableContextualInstanceImpl.java:60) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
at java.lang.String.valueOf(String.java:2854) [rt.jar:1.7.0_07]
at java.lang.StringBuilder.append(StringBuilder.java:128) [rt.jar:1.7.0_07]
at org.jboss.weld.context.beanstore.AttributeBeanStore.attach(AttributeBeanStore.java:109) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
at org.jboss.weld.context.AbstractBoundContext.activate(AbstractBoundContext.java:66) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
at org.jboss.weld.servlet.WeldListener.requestInitialized(WeldListener.java:141) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.17.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897) [jbossweb-7.0.17.Final.jar:]
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:634) [jbossweb-7.0.17.Final.jar:]
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2039) [jbossweb-7.0.17.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]
16:08:48,561 WARNING [com.patrac.controller.exceptionhandler.ViewExpiredExceptionHandler] (http-/127.0.0.1:8443-7) Attempt to access an expired view: /index.xhtml from remote host: 127.0.0.1
The stack trace always appears in the browser window, so this happens after the browser makes a request when the session is timed out. It only happens when the request is received at nearly the same time that the SFSB is destroyed (within milliseconds). It never happens upon logout, although the 302 REDIRECT causes the brower to make a request only milliseconds after the SFSB is destroyed. It seems to be that not only is timing a factor but also a ViewExpiredException is thrown every time this happens.
It seems as though what's happening is that because the session times out but the EJB is not immediately removed, when the browser makes a request JBoss removes the EJB from the timed out session and then throws the exception that the EJB has been removed instead of first creating a new EJB and binding it to the new session.
How can I handle the NoSuchEJBException, or better yet to avoid it altogether?
The problem was solved by making the ViewExpiredExceptionHandler redirect to a facelet, viewExpired.xhtml.
Prior to this change, ViewExpiredExceptionHandler was redirecting to the root of the web app, /Patrac, and the following entry in web.xml was causing another redirect to index.xhtml:
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
Moreover, index.xhtml was configured to refresh to /Patrac, which would be redirected to /Patrac/index.xhtml, which would result in a ViewExpiredException, which would result in another redirect /Patrac, which would redirect to the welcome page, /Patrac/index.xhtml, all in rapid succession.
<a4j:poll id="poll" interval="#{(session.maxInactiveInterval + 30)*1000}" onbegin="window.document.location.href='/Patrac'"/>
Usually, there was no problem. But per the Servlet spec., sessions aren't necessarily destroyed exactly at the time specified in the deployment descriptor -- there is some variation. So, occasionally when when the browser refresh occurred within several milliseconds of the session being destroyed on the server side and JBoss hadn't finished cleaning up its state the NoSuchEJBExceptions were being thrown.
Changing the client side ajax poll/timeout in index.xhtml to the following and making sure that viewExpiredException.xhtml did not do any browser refresh/ ajax polling made the problem go away.
<a4j:poll id="poll" interval="#{(session.maxInactiveInterval + 30)*1000}" onbegin="window.document.location.href='/Patrac/viewExpired.xhtml"/>
Try to use StatefulTimeout
#StatefulTimeout(unit = TimeUnit.MINUTES, value = 30)
I'm just starting with Mono for Android and installed it using the steps here http://mono-android.net/Installation/Visual_Studio and followed all the steps http://mono-android.net/Tutorials/Hello_World to create my Hello World abut I was not seeing anything, until I found this post to enable debug log http://mono-android.net/Documentation/Troubleshoot everything in the log seems to be ok except that I get the above error.
Here's the full log
-- Starting Process - 5/20/2011 7:48:39 PM --
Executable: C:\Program Files\MSBuild\Novell\mandroid.exe
Arguments: -activated
Appending Java path: C:\Program Files\Java\jdk1.6.0_25\bin
[STDERR] License file is missing. Please activate Mono for Android.
-- Starting Process - 5/20/2011 7:48:40 PM --
Executable: C:\Program Files\MSBuild\Novell\mandroid.exe
Arguments: -activated
Appending Java path: C:\Program Files\Java\jdk1.6.0_25\bin
[STDERR] License file is missing. Please activate Mono for Android.
-- Starting Process - 5/20/2011 7:48:40 PM --
Executable: C:\Program Files\Android\android-sdk\platform-tools\adb.exe
Arguments: start-server
Appending Java path: C:\Program Files\Java\jdk1.6.0_25\bin
[STDERR]
-- Process Finished [5000] --
-- Starting Process - 5/20/2011 7:48:40 PM --
Executable: C:\Program Files\Android\android-sdk\platform-tools\adb.exe
Arguments: devices
Appending Java path: C:\Program Files\Java\jdk1.6.0_25\bin
[STDOUT] List of devices attached
[STDOUT]
-- Starting Process - 5/20/2011 7:48:42 PM --
Executable: C:\Program Files\Android\android-sdk\platform-tools\adb.exe
Arguments: start-server
Appending Java path: C:\Program Files\Java\jdk1.6.0_25\bin
[STDOUT]
[STDERR]
-- Process Finished [5000] --
-- Starting Process - 5/20/2011 7:48:42 PM --
Executable: C:\Program Files\Android\android-sdk\platform-tools\adb.exe
Arguments: devices
Appending Java path: C:\Program Files\Java\jdk1.6.0_25\bin
[STDOUT] List of devices attached
[STDOUT]
-- Starting Process - 5/20/2011 7:48:43 PM --
Executable: C:\Program Files\Android\android-sdk\tools\android.bat
Arguments: list avd
Appending Java path: C:\Program Files\Java\jdk1.6.0_25\bin
[STDOUT] Available Android Virtual Devices:
[STDOUT] Name: MonoDroid
[STDOUT] Path: C:\Users\Zubair.android\avd\MonoDroid.avd
[STDOUT] Target: Android 2.2 (API level 8)
[STDOUT] Skin: HVGA
[STDOUT] Sdcard: 512M
-- Starting Process - 5/20/2011 7:48:44 PM --
Executable: C:\Program Files\Android\android-sdk\platform-tools\adb.exe
Arguments: start-server
Appending Java path: C:\Program Files\Java\jdk1.6.0_25\bin
[STDOUT]
[STDERR]
-- Process Finished [5000] --
-- Starting Process - 5/20/2011 7:48:44 PM --
Executable: C:\Program Files\Android\android-sdk\platform-tools\adb.exe
Arguments: devices
Appending Java path: C:\Program Files\Java\jdk1.6.0_25\bin
[STDOUT] List of devices attached
[STDOUT]
-- Starting Process - 5/20/2011 7:48:45 PM --
Executable: C:\Program Files\Android\android-sdk\tools\emulator.exe
Arguments: -partition-size 512 -avd MonoDroid -prop monodroid.avdname=MonoDroid
Appending Java path: C:\Program Files\Java\jdk1.6.0_25\bin
-- Starting Process - 5/20/2011 7:48:46 PM --
Executable: C:\Program Files\Android\android-sdk\platform-tools\adb.exe
Arguments: start-server
Appending Java path: C:\Program Files\Java\jdk1.6.0_25\bin
-- Process Finished [5000] --
-- Starting Process - 5/20/2011 7:48:46 PM --
Executable: C:\Program Files\Android\android-sdk\platform-tools\adb.exe
Arguments: devices
Appending Java path: C:\Program Files\Java\jdk1.6.0_25\bin
[STDOUT] List of devices attached
[STDOUT] emulator-5554 offline
[STDOUT]
-- Starting Process - 5/20/2011 7:48:46 PM --
Executable: C:\Program Files\Android\android-sdk\platform-tools\adb.exe
Arguments: -s emulator-5554 shell getprop monodroid.avdname
Appending Java path: C:\Program Files\Java\jdk1.6.0_25\bin
[STDERR] error: device offline
-- Process Still Running [5000] --
-- Starting Process - 5/20/2011 7:48:52 PM --
Executable: C:\Program Files\Android\android-sdk\platform-tools\adb.exe
Arguments: start-server
Appending Java path: C:\Program Files\Java\jdk1.6.0_25\bin
[STDOUT]
[STDERR]
-- Process Finished [5000] --
-- Starting Process - 5/20/2011 7:48:52 PM --
Executable: C:\Program Files\Android\android-sdk\platform-tools\adb.exe
Arguments: devices
Appending Java path: C:\Program Files\Java\jdk1.6.0_25\bin
[STDOUT] List of devices attached
[STDOUT]
I figured out that I wasn't selecting the device after hitting Ctrl+F5, did it and it works, it does however take a while to deploy the files on the emulator and run.
I don't think that's your actual error. I think that's a normal message for a machine that hasn't been activated.
Can you walk through what does happen, and tell us where something is happening that you are not expecting?