Wowza Community

Upgrade adventure - "Error starting: java.lang.reflect.InvocationTargetException"

This isn’t actually a question or a problem, just sharing something that I just had to deal with. I upgraded a client’s Wowza machine from 3.0.4 to 3.1.2, and when the upgrade was finished the Wowza process wouldn’t start! It was rather nerve-wracking, as the client had a live event coming up soon.

Running ./startup.sh initially produced:

Error starting: java.lang.reflect.InvocationTargetException

java.lang.reflect.InvocationTargetException

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 com.wowza.wms.bootstrap.Bootstrap.startServer(Unknown Source)

at com.wowza.wms.bootstrap.Bootstrap.main(Unknown Source)

Caused by: java.lang.NoClassDefFoundError:

org/apache/log4j/spi/LoggerFactory

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)

at java.lang.ClassLoader.defineClass(ClassLoader.java:615)

at

java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)

at java.net.URLClassLoader.access$000(URLClassLoader.java:58)

at java.net.URLClassLoader$1.run(URLClassLoader.java:197)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

at com.wowza.wms.server.Server.b(Unknown Source)

at com.wowza.wms.server.Server.start(Unknown Source)

… 6 more

Caused by: java.lang.ClassNotFoundException:

org.apache.log4j.spi.LoggerFactory

at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

… 19 more

That message about org.apache.log4j.spi.LoggerFactory was the key. I ran “jar tvf log4j-1.2.16.jar” and got an error. I then wrote a shell script to run “jar tvf” against all the jar files and look at the command line result code. This showed that 4 jars were bad. A great deal of wheel-spinning ensued as I copied good copies of those jars over from one of my Wowza machines, but further digging showed the real problem -

I had run “unzip -a WowzaMediaServer-3.0.x-3.1.2.zip”. I get really tired of having to clean up document and source files with DOS line ends, so I automatically use “-a” when I run unzip. However, running zipinfo against that zip file showed that zip and unzip believe that bcprov-ext-jdk15-146.jar, commons-lang-2.6.jar, jid3lib-0.5.4.jar, and log4j-1.2.16.jar are text files. Therefore, it munged them when it unpacked them.

So the bottom line is, when unpacking the upgrade zip file DO NOT USE “-a”.