2

I have a jar called framework.jar. I'm renaming it to framework.zip, decompiling one of its class files, modifing it, and putting it back in to the zip and renaming it back to framework.jar.

While I do this without making any modifications to any of the .class files, my tomcat runs fine. However, with my modifications, I get a Lifecycle exception. Note that I took the corresponding latest compiled .class file from eclipse and replaced the same .class file file.

update:

SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngin
e[Catalina].StandardHost[localhost].StandardContext[/enovia]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:87
7)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)

        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:1120)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig
.java:1678)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:51
1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        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)
Caused by: org.apache.tomee.catalina.TomEERuntimeException: org.apache.openejb.O
penEJBException: Unable to create annotation scanner for web module enovia: null

        at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatW
ebAppBuilder.java:2049)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWeb
AppBuilder.java:1091)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWe
bAppBuilder.java:1051)
        at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(Global
ListenerSupport.java:127)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBa
se.java:90)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContex
t.java:5322)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 10 more
Caused by: org.apache.openejb.OpenEJBException: Unable to create annotation scan
ner for web module enovia: null
        at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoa
der.java:838)
        at org.apache.openejb.config.DeploymentLoader.load(DeploymentLoader.java
:219)
        at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatW
ebAppBuilder.java:2047)
        ... 17 more
Caused by: java.lang.IllegalArgumentException
        at org.apache.xbean.asm4.ClassReader.<init>(Unknown Source)
        at org.apache.xbean.asm4.ClassReader.<init>(Unknown Source)
        at org.apache.xbean.asm4.ClassReader.<init>(Unknown Source)
        at org.apache.xbean.finder.AnnotationFinder.readClassDef(AnnotationFinde
r.java:1120)
        at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java
:139)
        at org.apache.xbean.finder.AnnotationFinder.<init>(AnnotationFinder.java
:152)
        at org.apache.xbean.finder.AsynchronousInheritanceAnnotationFinder.<init
>(AsynchronousInheritanceAnnotationFinder.java:43)
        at org.apache.openejb.config.FinderFactory.newFinder(FinderFactory.java:
114)
        at org.apache.openejb.config.FinderFactory.create(FinderFactory.java:68)

        at org.apache.openejb.config.FinderFactory.createFinder(FinderFactory.ja
va:57)
        at org.apache.openejb.config.DeploymentLoader.addWebModule(DeploymentLoa
der.java:830)
        ... 19 more

May 13, 2015 9:14:52 PM org.apache.catalina.startup.HostConfig deployDirectory
SEVERE: Error deploying web application directory D:\16x_tomcat\apache-tomee-plu
s-1.6.0\webapps\enovia
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catal
ina.LifecycleException: Failed to start component [StandardEngine[Catalina].Stan
dardHost[localhost].StandardContext[/enovia]]
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:904)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:87
7)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)

        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:1120)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig
.java:1678)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:51
1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        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)

update 2:

As greg-449's comment pointed out, the issue was because I was using a java 8 compiler. And that jar was built on a java 7 compiler.

stackMan10
  • 732
  • 6
  • 25
  • `LifecycleException` is not a Java exception. What you are discussing makes sense and should work fine. – Dan Grahn May 13 '15 at 15:41
  • Your process should work fine. Post the exception, and watch out for mismatches in java class versions (compiling in one version, running in a lower version JVM) – JP Moresmau May 13 '15 at 15:42
  • No. It is illegal! Be aware, in some legislations this is punishable by forcing you to write an application server in assembler. Some even go as far as to make you write it using emacs!! – Markus W Mahlberg May 13 '15 at 16:21
  • It is a jar that belongs to my application itself. Legal might have been the wrong word for me to use... or it should be is it technically correct. – stackMan10 May 13 '15 at 16:24
  • 1
    Possible duplicate of http://stackoverflow.com/q/22921889/2670892 – greg-449 May 13 '15 at 16:25
  • Ok a more serious comment: In general, this should be perfectly fine - as long as you obey copyright laws. Since you do not seem to have the source, it might be proprietary software. Depending on the respective legislation, one ore all of decompiling, changing, using and/or redistribution may be illegal and lead to both civil or even legal action. Since there are free ( both as in speech and in beer) alternatives for almost every peace off software, it's not worth three hassle. – Markus W Mahlberg May 13 '15 at 16:27
  • If you have the sources, why such a hassle? Change it or extend it... – Markus W Mahlberg May 13 '15 at 16:29
  • I'm testing this on a domain box. I don't have the source files there. hence the hassle. – stackMan10 May 13 '15 at 16:40
  • As par the agreement from DS its illegal. Even the fact they are giving it in jar itself gives us a hint that they do not want others to modify their code. Now days the jar comes as signed jar so you can not decompile make changes and add jar again. In any case framework.jar is core jar making any changes to this jar will have many undesirable effects on your stack – Amol Patil Jan 23 '19 at 09:51

1 Answers1

1

Tomcat: LifecycleException when deploying

Based on the post referenced above you might be missing some start up, note that there should be a log file for a more detailed error report.

Also the legally behind editing pre-compiled jar files... In almost all cases it is illegal to redistribute work. So therefore if you redistributed in most cases it would not be legal but you really need to check the copyright.

One way to get around it... shhh I didn't tell you this, is to make the user download the jar legally and have them modify it. Normally this is done by giving them a program to do so. And almost all the time the program involves Byte code, so you should use ASM or BCEL. This will shift the legal implications from you to the user. Therefore the user will be violating the terms of user agreement.

For example I used to be apart of the development team for a runescape bot, They used java so we had the user download the jar from the game as they needed anyway and before running it we would inject listeners in the jar. Using BCEL or Reflection

Community
  • 1
  • 1
Ya Wang
  • 1,758
  • 1
  • 19
  • 41
  • This is actually a jar that belongs to my application. I'm testing my code on a domain box and hence I don't have access to the source files there. I might have wrongly used the term "legal" in the question. I'll change that. – stackMan10 May 13 '15 at 18:40