Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Friday, July 18, 2014

Running tomcat 7 under java8 in ubuntu 12.04

Latest tomcat version for ubuntu 12.04 is 7.0.26, which doesn't support java 8:

SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1095)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1617)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 18
    at org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:131)
    at org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:60)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:209)
    at org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:119)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2032)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:2011)

http://stackoverflow.com/questions/23484098/invalid-byte-tag-in-constant-pool-tomcat7-war-jdk-incompatibilty
https://issues.apache.org/bugzilla/show_bug.cgi?id=53735

So to use java 8 you have to upgrade tomcat. Newest version can be found in Ubuntu 14.04 (see Packages.gz).

To add this repo, edit /etc/apt/sources.list, add
deb http://ru.archive.ubuntu.com/ubuntu trusty main multiverse
at the end of the file. Then
sudo apt-get update
sudo apt-get install tomcat7

Next, this version of tomcat uses eclipse compiler to compile jsp. Bundled version has issue with java 8:

org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
    at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:372)
    at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:231)
    at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:187)
    at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:102)
    at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:49)
    at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:122)

All you have to do is to add ecj-4.4M7.jar to /usr/share/java. Just google this file, I've founded it here: https://devtools.jahia.com/nexus/content/groups/public/org/eclipse/jdt/core/compiler/ecj/4.4M7/.
Also update symlinks eclipse-ecj.jar to point to ecj-4.4M7.jar instead of eclipse-ecj-3.5.1.jar.

Thursday, August 11, 2011

ubuntu network with p8p67 motherboard (rtl8111e LAN)

Got new motherboard: asus p8p67 with realtek 8111e Gigabit LAN controller. On ubuntu the network works ugly - sometimes it doesn't connect to google and some other sites.

The problem is that ubuntu loads wrong driver for the network - r8169 instead of r8168. The solution is to download correct driver from realtek website and use it.

Wednesday, August 10, 2011

ubuntu 11.04 - setup sun java

sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jdk

according to this