Showing posts with label java. Show all posts
Showing posts with label java. 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.

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

Thursday, April 21, 2011

Beans binding with human face

In my previous article I've showed how to easily compose swing forms with html markup. Since that time my swinghtmltemplate library moved to version 0.3 with beans binding support. Here I'll show basic examples of using binding.

Thursday, March 24, 2011

О вреде использования domain object в качестве ключей

В vaadin в таблице ключем в containerDataSource  можно использовать domain object и синхронизировать значения его полей с редакторами, к примеру, при нажатии на кнопку сохранить. Удобно получать все редакторы объекта по этому объекту. Особенно, если объект задать как data в редакторах.

table.addContainerProperty("description", TextArea.class, null, "Описание", null, null); 
table.addContainerProperty("operations", Button.class, null, "Операции", null, null); 
 

Button paste = new Button("Вставить"); 
paste.setStyleName(BaseTheme.BUTTON_LINK); 
paste.setData(description); //description - это domain object 
buttons.addComponent(paste); 
 
table.addItem(new Object[] {textField, paste}, description); 




Проблема в том, что если поменять значение поля, то hashCode у объекта соответственно изменится (мы же переопределили методы) и после этого найти редакторы объекта не представляется возможным (там внутри данные хранятся в Hashtable).

Thursday, November 25, 2010

Ease Swing GUI Creation with HTML Templating

Creating GUI in Java is rather difficult. Ordinary code looks like:

JPanel south = new JPanel(new BorderLayout());  
south.add(new JLabel(«login»), BorderLayout.WEST); 
south.add(new JTextField(),BorderLayout.CENTER);
rootPanel.add(south, BorderLayout.SOUTH);


Imagine that you have 15 fields... TableLayout and MigLayout ease layout for many fields, but anyway you have to write Java code.

swinghtmltemplate

I'm developing new library which helps making markup of swing forms using html code.
The library is called swinghtmltamplate, you can find it here.
Documentation is also available in english and in russian.

The small introduction can be found at  codeproject.com.

Я разрабатываю библиотеку для описания swing форм с помощью html.
Библиотека называется swinghtmltemplate, код доступен здесь.
Также есть документация на английском и на русском.

Небольшая статья о библиотеке есть на codeproject.com.