I am working with log4j2. The logger initializes and creates output logfile. After writing few logs logger stops and does not write anything. The logger logs are as below:
`DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger PluginManager 'Converter' found 45 plugins
DEBUG StatusLogger Starting OutputStreamManager SYSTEM_OUT.false.false-1
DEBUG StatusLogger Starting LoggerContext[name=3bb8aabc, org.apache.logging.log4j.core.LoggerContext#73010765]...
DEBUG StatusLogger Reconfiguration started for context[name=3bb8aabc] at URI null (org.apache.logging.log4j.core.LoggerContext#73010765) with optional ClassLoader: null
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger PluginManager 'ConfigurationFactory' found 4 plugins
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger Missing dependencies for Yaml support, ConfigurationFactory org.apache.logging.log4j.core.config.yaml.YamlConfigurationFactory is inactive
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger Missing dependencies for Json support, ConfigurationFactory org.apache.logging.log4j.core.config.json.JsonConfigurationFactory is inactive
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger Using configurationFactory org.apache.logging.log4j.core.config.ConfigurationFactory$Factory#26b95b0b
WARN StatusLogger Error parsing URI C:\myApplication\config\logger-config.xml
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger Closing FileInputStream java.io.FileInputStream#245ec1a6
DEBUG StatusLogger Apache Log4j Core 2.18.0 initializing configuration XmlConfiguration[location=C:\myApplication\config\logger-config.xml]
DEBUG StatusLogger PluginManager 'Core' found 130 plugins
DEBUG StatusLogger PluginManager 'Level' found 0 plugins
DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
DEBUG StatusLogger Building Plugin[name=layout, class=org.apache.logging.log4j.core.layout.PatternLayout].
TRACE StatusLogger TypeConverterRegistry initializing.
DEBUG StatusLogger PluginManager 'TypeConverter' found 26 plugins
DEBUG StatusLogger PatternLayout$Builder(pattern="[%d] [%t] [%-5p] [%l][%M] %m%n", PatternSelector=null, Configuration(C:\myApplication\config\logger-config.xml), Replace=null, charset="null", alwaysWriteExceptions="null", disableAnsi="null", noConsoleNoAnsi="null", header="null", footer="null")
DEBUG StatusLogger PluginManager 'Converter' found 45 plugins
DEBUG StatusLogger Building Plugin[name=TimeBasedTriggeringPolicy, class=org.apache.logging.log4j.core.appender.rolling.TimeBasedTriggeringPolicy].
DEBUG StatusLogger TimeBasedTriggeringPolicy$Builder(interval="null", modulate="null", maxRandomDelay="null")
DEBUG StatusLogger Building Plugin[name=SizeBasedTriggeringPolicy, class=org.apache.logging.log4j.core.appender.rolling.SizeBasedTriggeringPolicy].
DEBUG StatusLogger createPolicy(size="1000KB")
DEBUG StatusLogger Building Plugin[name=Policies, class=org.apache.logging.log4j.core.appender.rolling.CompositeTriggeringPolicy].
DEBUG StatusLogger createPolicy(={TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false), SizeBasedTriggeringPolicy(size=1024000)})
DEBUG StatusLogger Building Plugin[name=DefaultRolloverStrategy, class=org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy].
DEBUG StatusLogger DefaultRolloverStrategy$Builder(max="5", min="null", fileIndex="null", compressionLevel="null", ={}, stopCustomActionsOnError="null", tempCompressedFilePattern="null", Configuration(C:\myApplication\config\logger-config.xml))
DEBUG StatusLogger Building Plugin[name=appender, class=org.apache.logging.log4j.core.appender.RollingFileAppender].
DEBUG StatusLogger RollingFileAppender$Builder(fileName="C:/logs/applicationLogs.log", filePattern="C:/logs_backup/${date:yyyy-MM}/applicationLogs-%d{MM-dd-yyyy}-%i.log.gz", append="null", locking="null", Policies(CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false), SizeBasedTriggeringPolicy(size=1024000)])), DefaultRolloverStrategy(DefaultRolloverStrategy(min=1, max=5, useMax=true)), advertise="null", advertiseUri="null", createOnDemand="null", filePermissions="null", fileOwner="null", fileGroup="null", bufferedIo="null", bufferSize="null", immediateFlush="null", ignoreExceptions="null", PatternLayout([%d] [%t] [%-5p] [%l][%M] %m%n), name="CASRollingfileAppender", Configuration(C:\myApplication\config\logger-config.xml), Filter=null, ={})
TRACE StatusLogger New file 'C:/logs/applicationLogs.log' created = true
DEBUG StatusLogger Returning file creation time for C:\logs\applicationLogs.log
DEBUG StatusLogger Starting RollingFileManager C:/logs/applicationLogs.log
DEBUG StatusLogger PluginManager 'FileConverter' found 2 plugins
DEBUG StatusLogger Setting prev file time to 2022-12-06T23:48:23.928-0800
DEBUG StatusLogger Initializing triggering policy CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false), SizeBasedTriggeringPolicy(size=1024000)])
DEBUG StatusLogger Initializing triggering policy TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=false)
TRACE StatusLogger PatternProcessor.getNextTime returning 2022/12/07-00:00:00.000, nextFileTime=2022/12/06-00:00:00.000, prevFileTime=1969/12/31-16:00:00.000, current=2022/12/06-23:48:23.959, freq=DAILY
TRACE StatusLogger PatternProcessor.getNextTime returning 2022/12/07-00:00:00.000, nextFileTime=2022/12/06-00:00:00.000, prevFileTime=2022/12/06-00:00:00.000, current=2022/12/06-23:48:23.959, freq=DAILY
DEBUG StatusLogger Initializing triggering policy SizeBasedTriggeringPolicy(size=1024000)
DEBUG StatusLogger Building Plugin[name=appenders, class=org.apache.logging.log4j.core.config.AppendersPlugin].
DEBUG StatusLogger createAppenders(={CASRollingfileAppender})
DEBUG StatusLogger Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].
DEBUG StatusLogger createAppenderRef(ref="CASRollingfileAppender", level="null", Filter=null)
DEBUG StatusLogger Building Plugin[name=logger, class=org.apache.logging.log4j.core.config.LoggerConfig].
DEBUG StatusLogger LoggerConfig$Builder(additivity="false", level="DEBUG", levelAndRefs="null", name="com.test.myApplication.logging", includeLocation="null", ={CASRollingfileAppender}, ={}, Configuration(C:\myApplication\config\logger-config.xml), Filter=null)
DEBUG StatusLogger Building Plugin[name=AppenderRef, class=org.apache.logging.log4j.core.config.AppenderRef].
DEBUG StatusLogger createAppenderRef(ref="CASRollingfileAppender", level="null", Filter=null)
DEBUG StatusLogger Building Plugin[name=root, class=org.apache.logging.log4j.core.config.LoggerConfig$RootLogger].
DEBUG StatusLogger LoggerConfig$RootLogger$Builder(additivity="null", level="WARN", levelAndRefs="null", includeLocation="null", ={CASRollingfileAppender}, ={}, Configuration(C:\myApplication\config\logger-config.xml), Filter=null)
DEBUG StatusLogger Building Plugin[name=loggers, class=org.apache.logging.log4j.core.config.LoggersPlugin].
DEBUG StatusLogger createLoggers(={com.test.myApplication.logging, root})
DEBUG StatusLogger Configuration XmlConfiguration[location=C:\myApplication\config\logger-config.xml] initialized
DEBUG StatusLogger Starting configuration XmlConfiguration[location=C:\myApplication\config\logger-config.xml]
DEBUG StatusLogger Started configuration XmlConfiguration[location=C:\myApplication\config\logger-config.xml] OK.
TRACE StatusLogger Stopping org.apache.logging.log4j.core.config.DefaultConfiguration#608bc8f8...
TRACE StatusLogger DefaultConfiguration notified 1 ReliabilityStrategies that config will be stopped.
TRACE StatusLogger DefaultConfiguration stopping root LoggerConfig.
TRACE StatusLogger DefaultConfiguration notifying ReliabilityStrategies that appenders will be stopped.
TRACE StatusLogger DefaultConfiguration stopping remaining Appenders.
DEBUG StatusLogger Shutting down OutputStreamManager SYSTEM_OUT.false.false-1
DEBUG StatusLogger OutputStream closed
DEBUG StatusLogger Shut down OutputStreamManager SYSTEM_OUT.false.false-1, all resources released: true
DEBUG StatusLogger Appender DefaultConsole-1 stopped with status true
TRACE StatusLogger DefaultConfiguration stopped 1 remaining Appenders.
TRACE StatusLogger DefaultConfiguration cleaning Appenders from 1 LoggerConfigs.
DEBUG StatusLogger Stopped org.apache.logging.log4j.core.config.DefaultConfiguration#608bc8f8 OK
TRACE StatusLogger Reregistering MBeans after reconfigure. Selector=org.apache.logging.log4j.core.selector.ClassLoaderContextSelector#2a3194c6
TRACE StatusLogger Reregistering context (1/1): '3bb8aabc' org.apache.logging.log4j.core.LoggerContext#73010765
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=3bb8aabc'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=3bb8aabc,component=StatusLogger'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=3bb8aabc,component=ContextSelector'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=3bb8aabc,component=Loggers,name=*'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=3bb8aabc,component=Appenders,name=*'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=3bb8aabc,component=AsyncAppenders,name=*'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=3bb8aabc,component=AsyncLoggerRingBuffer'
TRACE StatusLogger Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=3bb8aabc,component=Loggers,name=*,subtype=RingBuffer'
DEBUG StatusLogger Registering MBean org.apache.logging.log4j2:type=3bb8aabc
DEBUG StatusLogger Registering MBean org.apache.logging.log4j2:type=3bb8aabc,component=StatusLogger
DEBUG StatusLogger Registering MBean org.apache.logging.log4j2:type=3bb8aabc,component=ContextSelector
DEBUG StatusLogger Registering MBean org.apache.logging.log4j2:type=3bb8aabc,component=Loggers,name=
DEBUG StatusLogger Registering MBean org.apache.logging.log4j2:type=3bb8aabc,component=Loggers,name=com.test.myApplication.logging
DEBUG StatusLogger Registering MBean org.apache.logging.log4j2:type=3bb8aabc,component=Appenders,name=CASRollingfileAppender
TRACE StatusLogger Using default SystemClock for timestamps.
DEBUG StatusLogger org.apache.logging.log4j.core.util.SystemClock does not support precise timestamps.
TRACE StatusLogger Using DummyNanoClock for nanosecond timestamps.
DEBUG StatusLogger Reconfiguration complete for context[name=3bb8aabc] at URI C:\myApplication\config\logger-config.xml (org.apache.logging.log4j.core.LoggerContext#73010765) with optional ClassLoader: null
DEBUG StatusLogger Shutdown hook enabled. Registering a new one.
DEBUG StatusLogger LoggerContext[name=3bb8aabc, org.apache.logging.log4j.core.LoggerContext#73010765] started OK.
DEBUG StatusLogger AsyncLogger.ThreadNameStrategy=UNCACHED (user specified null, default is UNCACHED)
TRACE StatusLogger Using default SystemClock for timestamps.
DEBUG StatusLogger org.apache.logging.log4j.core.util.SystemClock does not support precise timestamps.
and the logger config file as:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<RollingFile name="CASRollingfileAppender"
fileName="C:/logs/applicationLogs.log"
filePattern="C:/logs_backup/$${date:yyyy-MM}/applicationLogs-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout pattern="[%d] [%t] [%-5p] [%l][%M] %m%n" />
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="1000KB" />
</Policies>
<DefaultRolloverStrategy max="5" />
</RollingFile>
</Appenders>
<Loggers>
<Logger
name="com.test.myApplication.logging"
level="DEBUG" additivity="false">
<AppenderRef ref="CASRollingfileAppender" />
</Logger>
<Root level="WARN">
<AppenderRef ref="CASRollingfileAppender" />
</Root>
</Loggers>
</Configuration>
Any suggestions on what is going wrong here?
In logs it shows a warning as:
WARN StatusLogger Error parsing URI C:\myApplication\config\logger-config.xml
However, I think the config file is working properly. Why does the logger stop writing after it writes a few logs?
I have several containerized applications which run in numerous locations. The application containers are based on a Tomcat container then customized accordingly for the application. Each application makes a connection to a containerized mariadb instance co-located on the same server. The JNDI Resource for the database connection is specified globally in the respective web app container server.xml.
In one location, one of the applications connects just fine to the mariadb container while the second application throws a NamingContext.lookup error immediately when tomcat starts.
I have verified the global resource is exactly the same between the applications. I also verified the resource config is the same in both applications webapp_root/META-INF/context.xml.
Here are the relevant parts:
NOTE: All variable values are defined and supplied for the respective catalina.properties file and the values are the same
Application A JNDI Resource definition for server.xml
<Resource name="jdbc/menudb"
auth="Container"
driverClassName="com.mysql.cj.jdbc.Driver"
initialSize="25"
logAbandoned="true"
minEvictableIdleTimeMillis="30000"
minIdle="10"
maxActive="50"
maxIdle="20"
maxWait="1000"
removeAbandonedOnBorrow="true"
removeAbandonedOnMaintenance="true"
removeAbandonedTimeout="15"
testOnBorrow="true"
testWhileIdle="true"
timeBetweenEvictionRunsMillis="300000"
type="javax.sql.DataSource"
username="${mfg.jdbc.menudb.user}"
password="${mfg.jdbc.menudb.password}"
url="${mfg.jdbc.menudb.url}"/>
Application B JNDI Resource definition for server.xml
<Resource name="jdbc/menudb"
auth="Container"
driverClassName="com.mysql.cj.jdbc.Driver"
initialSize="25"
logAbandoned="true"
minEvictableIdleTimeMillis="30000"
minIdle="10"
maxActive="50"
maxIdle="20"
maxWait="1000"
removeAbandonedOnBorrow="true"
removeAbandonedOnMaintenance="true"
removeAbandonedTimeout="15"
testOnBorrow="true"
testWhileIdle="true"
timeBetweenEvictionRunsMillis="300000"
type="javax.sql.DataSource"
username="${mfg.jdbc.menudb.user}"
password="${mfg.jdbc.menudb.password}"
url="${mfg.jdbc.menudb.url}"/>
Application A Context.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="mfgweb" path="/..." reloadable="true" swallowOutput="true">
<ResourceLink global="jdbc/menudb" name="jdbc/menudb" type="javax.sql.DataSource" />
<ResourceLink global="localas400" name="localas400" type="javax.sql.DataSource" />
<ResourceLink global="corpas400" name="corpas400" type="javax.sql.DataSource" />
<ResourceLink global="gaims" name="gaims" type="javax.sql.DataSource" />
</Context>
Application B Context.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="menuadmin" path="/..." privileged="true" debug="4" crossContext="true">
<ResourceLink name="jdbc/menudb" global="jdbc/menudb" type="javax.sql.DataSource" />
</Context>
NOTE: Application A utilizes additional JNDI connections, but the entry for jdbc/menudb are the same.
Here is the full error recorded in Application B docker log
12-Aug-2021 15:41:10.997 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/9.0.21
12-Aug-2021 15:41:11.017 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jun 4 2019 20:19:36 UTC
12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.21.0
12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 3.10.0-693.21.1.el7.x86_64
12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/local/openjdk-8/jre
12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_212-b04
12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/tomcat
12-Aug-2021 15:41:11.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/tomcat
12-Aug-2021 15:41:11.019 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
12-Aug-2021 15:41:11.019 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
12-Aug-2021 15:41:11.019 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.library.path=/usr/lib
12-Aug-2021 15:41:11.019 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.awt.headless=true
12-Aug-2021 15:41:11.019 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djavax.net.ssl.trustStore=/usr/local/tomcat/conf/cacerts
12-Aug-2021 15:41:11.019 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djavax.net.ssl.trustStorePassword=***
12-Aug-2021 15:41:11.019 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.security.auth.login.config=/usr/local/tomcat/conf/jaas.config
12-Aug-2021 15:41:11.020 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.security.egd=file:/dev/./urandom
...
12-Aug-2021 15:41:11.020 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -javaagent:/usr/local/tomcat/lib/applicationinsights-agent-2.5.1.jar
12-Aug-2021 15:41:11.020 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
12-Aug-2021 15:41:11.020 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
12-Aug-2021 15:41:11.020 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
12-Aug-2021 15:41:11.020 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
12-Aug-2021 15:41:11.020 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
12-Aug-2021 15:41:11.021 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
12-Aug-2021 15:41:11.021 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
12-Aug-2021 15:41:11.632 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
12-Aug-2021 15:41:11.682 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
12-Aug-2021 15:41:11.684 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [1,416] milliseconds
12-Aug-2021 15:41:11.721 WARNING [main] org.apache.naming.NamingContext.lookup Unexpected exception resolving reference
java.lang.NullPointerException
at org.apache.naming.factory.ResourceFactory.getDefaultFactory(ResourceFactory.java:45)
at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:90)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
at org.apache.naming.NamingContext.lookup(NamingContext.java:840)
at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:117)
at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:34)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:127)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:134)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:101)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:76)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:925)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:344)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475)
12-Aug-2021 15:41:11.722 SEVERE [main] org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans Exception processing global JNDI Resources
javax.naming.NamingException: Unexpected exception resolving reference [Root exception is java.lang.NullPointerException]
at org.apache.naming.NamingContext.lookup(NamingContext.java:856)
at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:117)
at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:34)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:127)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:134)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:101)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:76)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:925)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:344)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475)
Caused by: java.lang.NullPointerException
at org.apache.naming.factory.ResourceFactory.getDefaultFactory(ResourceFactory.java:45)
at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:90)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
at org.apache.naming.NamingContext.lookup(NamingContext.java:840)
... 20 more
12-Aug-2021 15:41:11.887 WARNING [main] com.hazelcast.config.AbstractXmlConfigHelper.null Name of the hazelcast schema location is incorrect, using default
12-Aug-2021 15:41:12.063 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
12-Aug-2021 15:41:12.063 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.21]
12-Aug-2021 15:41:12.100 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/usr/local/tomcat/webapps/****.war]
Does anyone see a reason why Application A works and can connect to the database just fine while Application B reports it cannot find the resource due to a Null Pointer exception?
This is extremely frustrating and this particular location has been without the use of Application B for a few months now.
For Tomcat 9 you need to define the correct factory for the resource, e.g.:
<Resource name="jdbc/menudb"
auth="Container"
driverClassName="com.mysql.cj.jdbc.Driver"
initialSize="25"
logAbandoned="true"
minEvictableIdleTimeMillis="30000"
minIdle="10"
maxActive="50"
maxIdle="20"
maxWait="1000"
removeAbandonedOnBorrow="true"
removeAbandonedOnMaintenance="true"
removeAbandonedTimeout="15"
testOnBorrow="true"
testWhileIdle="true"
timeBetweenEvictionRunsMillis="300000"
username="${mfg.jdbc.menudb.user}"
password="${mfg.jdbc.menudb.password}"
url="${mfg.jdbc.menudb.url}"
jdbcInterceptors="StatementCache"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
type="org.apache.tomcat.jdbc.pool.DataSource"
/>
I'm using next configuration:
Application Server - Wildfly 9.0
Primefaces 5.1 RC1, Atmosphere 2.2.2 - added as modules (all dependencies were added).
I've stopped on this configuration, because any other is falling down with heap of errors.
I'm going to use primepush, I've done all as in example http://www.primefaces.org/showcase/push/notify.xhtml, but it does not work for me.
My part of web.xml for primepush conf:
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<servlet>
<servlet-name>Push Servlet</servlet-name>
<servlet-class>org.primefaces.push.PushServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>Push Servlet</servlet-name>
<url-pattern>/primepush/*</url-pattern>
</servlet-mapping>
I have in my project class annotated with #PushEndpoint, in xhtml file I have socket connected to the same channel. After deploying I don't have any errors, but there is a strange string in the first line
21:25:24,433 ERROR [org.primefaces.push.PushServlet] (MSC service thread 1-8) No Annotated class using #PushEndpoint found. Push will not work.
21:25:24,433 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0021: Registered web context: /oasa
21:25:24,556 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) WFLYSRV0016: Replaced deployment "oasa.war" with deployment "oasa.war"
21:25:24,701 INFO [org.atmosphere.cpr.AtmosphereFramework] (Thread-150) Latest version of Atmosphere's JavaScript Client 2.2.4
After googling I found solution to add to my web.xml
<init-param>
<param-name>org.atmosphere.annotation.packages</param-name>
<param-value>org.primefaces.push</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.cpr.packages</param-name>
<param-value>MY_PACKAGE_WITH_PUSH_ENDPOINTS</param-value>
</init-param>
All is deploying fine, but when I send message using
EventBusFactory.getDefault().eventBus().publish(MY_CHANNEL, MY_VARIABLE);
Here is what I've gotten on wildfly console :
22:02:54,284 ERROR [io.undertow.request] (default task-19) UT005023: Exception handling request to /MY_PROJECT/primepush/MY_CHANNEL: org.atmosphere.cpr.AtmosphereMappingException: No AtmosphereHandler maps request for /MY_PROJECT/primepush/MY_CHANNEL
at org.atmosphere.cpr.AsynchronousProcessor.map(AsynchronousProcessor.java:355)
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:154)
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:104)
at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:66)
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2063)
at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:211)
at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:197)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.websockets.jsr.JsrWebSocketFilter.doFilter(JsrWebSocketFilter.java:129) [undertow-websockets-jsr-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:259) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:246) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:75) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:165) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:737) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
22:02:55,634 WARN [org.atmosphere.websocket.DefaultWebSocketProcessor] (default task-20) Failed invoking AtmosphereFramework.doCometSupport(): org.atmosphere.cpr.AtmosphereMappingException: No AtmosphereHandler maps request for http://localhost:8080/MY_PROJECT/primepush/MY_CHANNEL
at org.atmosphere.cpr.AsynchronousProcessor.map(AsynchronousProcessor.java:355)
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:154)
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:104)
at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:66)
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2063)
at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:568)
at org.atmosphere.websocket.DefaultWebSocketProcessor.open(DefaultWebSocketProcessor.java:213)
at org.atmosphere.container.JSR356Endpoint.onOpen(JSR356Endpoint.java:192)
at io.undertow.websockets.jsr.EndpointSessionHandler.onConnect(EndpointSessionHandler.java:84) [undertow-websockets-jsr-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.websockets.jsr.JsrWebSocketFilter$1.handleUpgrade(JsrWebSocketFilter.java:121) [undertow-websockets-jsr-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.server.protocol.http.HttpReadListener.exchangeComplete(HttpReadListener.java:285) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.server.protocol.http.HttpServerConnection.exchangeComplete(HttpServerConnection.java:212) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.server.HttpServerExchange.invokeExchangeCompleteListeners(HttpServerExchange.java:1141) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.server.HttpServerExchange.terminateResponse(HttpServerExchange.java:1361) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.server.Connectors.terminateResponse(Connectors.java:98) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.server.protocol.http.ServerFixedLengthStreamSinkConduit.channelFinished(ServerFixedLengthStreamSinkConduit.java:51) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.conduits.AbstractFixedLengthStreamSinkConduit.exitFlush(AbstractFixedLengthStreamSinkConduit.java:300) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.conduits.AbstractFixedLengthStreamSinkConduit.flush(AbstractFixedLengthStreamSinkConduit.java:234) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at org.xnio.conduits.ConduitStreamSinkChannel.flush(ConduitStreamSinkChannel.java:162)
at io.undertow.channels.DetachableStreamSinkChannel.flush(DetachableStreamSinkChannel.java:118) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at org.xnio.channels.Channels.flushBlocking(Channels.java:63)
at io.undertow.servlet.spec.ServletOutputStreamImpl.close(ServletOutputStreamImpl.java:607) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.spec.HttpServletResponseImpl.closeStreamAndWriter(HttpServletResponseImpl.java:483) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.spec.HttpServletResponseImpl.responseDone(HttpServletResponseImpl.java:566) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:307) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:246) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:75) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:165) [undertow-servlet-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:737) [undertow-core-1.1.0.Beta7.jar:1.1.0.Beta7]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
22:02:55,649 WARN [org.atmosphere.websocket.protocol.SimpleHttpProtocol] (default task-20) org.atmosphere.cpr.AtmosphereMappingException: No AtmosphereHandler maps request for http://localhost:8080/MY_PROJECT/primepush/MY_CHANNEL. Unable to deliver the websocket messages to installed component. Status 500 Message Server Error
In any case websockets is not working for me...
Please, advise how to fix that.
P.S. I've just repeated all steps on wildfly 8.1 Final. I have the same picture - all errors as in the wildfly 9.0 case....
P.P.S.
module.xml
atmosphere
<module xmlns="urn:jboss:module:1.3" name="org.atmosphere">
<resources>
<resource-root path="atmosphere-runtime-2.2.2.jar"/>
</resources>
<dependencies>
<module name="javax.servlet.api"/>
<module name="javax.websocket.api" export="true"/>
<module name="org.slf4j" export="true"/>
</dependencies>
</module>
primefaces
<module xmlns="urn:jboss:module:1.3" name="org.primefaces" slot="5">
<resources>
<resource-root path="primefaces-5.1.RC1.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.annotation.api"/>
<module name="javax.faces.api"/>
<module name="org.apache.commons.fileupload"/>
<module name="org.atmosphere"/>
</dependencies>
</module>
This question already has answers here:
How to use PrimeFaces p:fileUpload? Listener method is never invoked or UploadedFile is null / throws an error / not usable
(11 answers)
Closed 6 years ago.
I am using <p:fileUpload> to upload a file from my jsf page to a backing bean and getting following eror:
22:39:06,942 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "myweb.war"
22:39:07,341 INFO [org.jboss.as.jpa] (MSC service thread 1-4) JBAS011401: Read persistence.xml for mywebPU
22:39:07,399 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."myweb.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."myweb.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "myweb.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]
Caused by: java.lang.RuntimeException: Error getting reflective information for class org.primefaces.webapp.filter.FileUploadFilter with ClassLoader ModuleClassLoader for Module "deployment.myweb.war:main" from Service Module Loader
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory
at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.7.0_21]
at java.lang.Class.privateGetDeclaredFields(Class.java:2317) [rt.jar:1.7.0_21]
at java.lang.Class.getDeclaredFields(Class.java:1762) [rt.jar:1.7.0_21]
at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 10 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileItemFactory from [Module "deployment.myweb.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
... 15 more
22:39:07,429 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS015870: Deploy of deployment "myweb.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"myweb.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"myweb.war\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"myweb.war\""}}
22:39:07,433 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."myweb.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."myweb.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "myweb.war"
22:39:07,441 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"myweb.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"myweb.war\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"myweb.war\""}}}}
22:39:07,818 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment myweb.war in 381ms
My jsf page:
<h:form enctype="multipart/form-data">
<p:messages showDetail="true"/>
<p:fileUpload value="#{admin_post.uploadFile}" mode="simple" />
<p:commandButton value="Submit" ajax="false" actionListener="#{admin_post.upload}"/>
</h:form>
My web.xml: (The error occurs while using PrimeFaces FileUpload Filter)
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
<init-param>
<param-name>thresholdSize</param-name>
<param-value>51200</param-value>
</init-param>
<init-param>
<param-name>uploadDirectory</param-name>
<param-value>/tmp</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
How can I solve this problem?
For those who didn't read comments:
Adding commons-fileupload-xx.jar
and common-io-xx.jar to the classpath solved the problem perfectly.
I'm getting a strange parsing issue when I try to start Tomcat6 with my application (that I am trying to port from Tomcat7 to Tomcat6). The Digester itself does not declare an error until it hits an unexpected end of file - this parsing itself must be wrong.
Does anyone have any ideas?
My web.xml is below, followed by part of the console.
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<description>ilearn web.xml</description>
<display-name>iLearn</display-name>
<welcome-file-list>
<welcome-file>home.jsf</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<context-param>
<param-name> javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL </param-name>
<param-value>true</param-value>
</context-param>
<filter>
<filter-name>Extensions Filter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
<init-param>
<param-name>uploadMaxFileSize</param-name>
<param-value>100m</param-value>
</init-param>
<init-param>
<param-name>uploadThresholdSize</param-name>
<param-value>100k</param-value>
</init-param>
<init-param>
<param-name>uploadRepositoryPath</param-name>
<param-value>/iLearnData/temp/</param-value>
</init-param>
</filter>
</web-app>
This is the faces-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<!-- Config here -->
</faces-config>
This is the beans.xml
<?xml version="1.0" encoding="UTF-8"?>
This is part of the log from the console
[methodName=setComponentFamily, paramCount=0, paramTypes={java.lang.String}]
2012-09-04 02:20:42,503 DEBUG [main] digester.Digester (CallMethodRule.java:615) - [CallMethodRule]{faces-config/render-kit/renderer/component-family} Call org.apache.myfaces.config.impl.digester.elements.Renderer.setComponentFamily(javax.faces.SelectMany/java.lang.String)
2012-09-04 02:20:42,503 DEBUG [main] Digester.sax (Digester.java:1094) - characters(
)
2012-09-04 02:20:42,503 DEBUG [main] Digester.sax (Digester.java:1410) - startElement(http://java.sun.com/xml/ns/javaee,renderer-type,renderer-type)
2012-09-04 02:20:42,503 DEBUG [main] digester.Digester (Digester.java:1417) - Pushing body text '
'
2012-09-04 02:20:42,503 DEBUG [main] digester.Digester (Digester.java:1436) - New match='faces-config/render-kit/renderer/renderer-type'
2012-09-04 02:20:42,503 DEBUG [main] digester.Digester (Digester.java:1451) - Fire begin() for CallMethodRule[methodName=setRendererType, paramCount=0, paramTypes={java.lang.String}]
2012-09-04 02:20:42,503 DEBUG [main] Digester.sax (Digester.java:1094) - characters(javax.faces.Checkbox)
2012-09-04 02:20:42,503 DEBUG [main] Digester.sax (Digester.java:1164) - endElement(http://java.sun.com/xml/ns/javaee,renderer-type,renderer-type)
2012-09-04 02:20:42,503 DEBUG [main] digester.Digester (Digester.java:1167) - match='faces-config/render-kit/renderer/renderer-type'
2012-09-04 02:20:42,504 DEBUG [main] digester.Digester (Digester.java:1168) - bodyText='javax.faces.Checkbox'
2012-09-04 02:20:42,504 DEBUG [main] digester.Digester (Digester.java:1190) - Fire body() for CallMethodRule[methodName=setRendererType, paramCount=0, paramTypes={java.lang.String}]
2012-09-04 02:20:42,504 DEBUG [main] digester.Digester (Digester.java:1210) - Popping body text '
'
2012-09-04 02:20:42,567 DEBUG [main] digester.Digester (Digester.java:1190) - Fire body() for ObjectCreateRule[className=org.apache.myfaces.config.impl.digester.elements.FacesConfig, attributeName=null]
2012-09-04 02:20:42,567 DEBUG [main] digester.Digester (Digester.java:1190) - Fire body() for SetPropertiesRule[]
2012-09-04 02:20:42,568 DEBUG [main] digester.Digester (Digester.java:1190) - Fire body() for SetPropertiesRule[]
2012-09-04 02:20:42,568 DEBUG [main] digester.Digester (Digester.java:1210) - Popping body text ''
2012-09-04 02:20:42,568 DEBUG [main] digester.Digester (Digester.java:1220) - Fire end() for SetPropertiesRule[]
2012-09-04 02:20:42,568 DEBUG [main] digester.Digester (Digester.java:1220) - Fire end() for SetPropertiesRule[]
2012-09-04 02:20:42,568 DEBUG [main] digester.Digester (Digester.java:1220) - Fire end() for ObjectCreateRule[className=org.apache.myfaces.config.impl.digester.elements.FacesConfig, attributeName=null]
2012-09-04 02:20:42,568 DEBUG [main] digester.Digester (ObjectCreateRule.java:219) - [ObjectCreateRule]{faces-config} Pop org.apache.myfaces.config.impl.digester.elements.FacesConfig
2012-09-04 02:20:42,568 DEBUG [main] Digester.sax (Digester.java:1254) - endPrefixMapping()
2012-09-04 02:20:42,568 DEBUG [main] Digester.sax (Digester.java:1254) - endPrefixMapping(xsi)
2012-09-04 02:20:42,568 DEBUG [main] Digester.sax (Digester.java:1114) - endDocument()
Sep 4, 2012 2:20:42 AM org.apache.myfaces.config.DefaultFacesConfigurationProvider getWebAppFacesConfig
INFO: Reading config /WEB-INF/faces-config.xml
2012-09-04 02:20:42,571 DEBUG [main] Digester.sax (Digester.java:1341) - setDocumentLocator(com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser$LocatorProxy#154e4e31)
2012-09-04 02:20:42,572 DEBUG [main] Digester.sax (Digester.java:1375) - startDocument()
2012-09-04 02:20:42,574 ERROR [main] digester.Digester (Digester.java:1655) - Parse Fatal Error at line 3 column 1: Premature end of file.
org.xml.sax.SAXParseException: Premature end of file.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1427)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1056)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.apache.commons.digester.Digester.parse(Digester.java:1745)
at org.apache.myfaces.config.impl.digester.DigesterFacesConfigUnmarshallerImpl.getFacesConfig(DigesterFacesConfigUnmarshallerImpl.java:309)
at org.apache.myfaces.config.impl.digester.DigesterFacesConfigUnmarshallerImpl.getFacesConfig(DigesterFacesConfigUnmarshallerImpl.java:36)
at org.apache.myfaces.config.DefaultFacesConfigurationProvider.getWebAppFacesConfig(DefaultFacesConfigurationProvider.java:345)
at org.apache.myfaces.config.DefaultFacesConfigurationMerger.getFacesConfigData(DefaultFacesConfigurationMerger.java:75)
at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:416)
at org.apache.myfaces.webapp.AbstractFacesInitializer.buildConfiguration(AbstractFacesInitializer.java:338)
at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:73)
at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:140)
at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:119)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Sep 4, 2012 2:20:42 AM org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
SEVERE: An error occured while initializing MyFaces: org.xml.sax.SAXParseException: Premature end of file.
javax.faces.FacesException: org.xml.sax.SAXParseException: Premature end of file.
at org.apache.myfaces.config.DefaultFacesConfigurationProvider.getWebAppFacesConfig(DefaultFacesConfigurationProvider.java:357)
at org.apache.myfaces.config.DefaultFacesConfigurationMerger.getFacesConfigData(DefaultFacesConfigurationMerger.java:75)
at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:416)
at org.apache.myfaces.webapp.AbstractFacesInitializer.buildConfiguration(AbstractFacesInitializer.java:338)
at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:73)
at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:140)
at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:119)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.xml.sax.SAXParseException: Premature end of file.
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1231)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.apache.commons.digester.Digester.parse(Digester.java:1745)
at org.apache.myfaces.config.impl.digester.DigesterFacesConfigUnmarshallerImpl.getFacesConfig(DigesterFacesConfigUnmarshallerImpl.java:309)
at org.apache.myfaces.config.impl.digester.DigesterFacesConfigUnmarshallerImpl.getFacesConfig(DigesterFacesConfigUnmarshallerImpl.java:36)
at org.apache.myfaces.config.DefaultFacesConfigurationProvider.getWebAppFacesConfig(DefaultFacesConfigurationProvider.java:345)
... 21 more
Sep 4, 2012 2:20:42 AM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
at javax.faces.FactoryFinder._getFactory(FactoryFinder.java:286)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:206)
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:116)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1206)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1026)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4421)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4734)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Sep 4, 2012 2:20:42 AM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /ilearn threw load() exception
java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
at javax.faces.FactoryFinder._getFactory(FactoryFinder.java:286)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:206)
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:116)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1206)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1026)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4421)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4734)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Sep 4, 2012 2:20:42 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Sep 4, 2012 2:20:42 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Sep 4, 2012 2:20:42 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/19 config=null
Sep 4, 2012 2:20:42 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 7062 ms
You can use JBoss EL.
Instructions
Download the latest version of Seam 2
Extract lib/jboss-el.jar
Copy it to WEB-INF/lib/jboss-el.jar
In your web.xml set:
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
</context-param>