Shammer's Philosophy

My private adversaria

Java

Accessing tomcat8 application but received Unsupported major.minor version 52.0

I build war application first time in age, but response is not expected the one, but UnsupportedClassVersionError. $ curl http://10.255.230.2:8080/myapp/defaultServlet <html><head><title>Apache Tomcat/8.0.14 (Debian) - Error report</title><style type="text/css">H1 {font-family:Tahoma,…</head></html>

Debugging rows gotten by JSTL sql:query

I have some questions written in this article. Sometimes I want to handle the data gotten by sql:query, those can be accessed with the expression like ${row.id}. I don't know the class using as row in following JSTL. At first, trying to cl…

Searching JSTL document and found the answer

Looking for the detail about JSTL c:set because of JSTL helps us but... not clear for me... - Shammerism and found following site.java - I can pass a variable from a JSP scriptlet to JSTL but not from JSTL to a JSP scriptlet without an err…

JSTL helps us but... not clear for me...

I used JSTL SQL tag, it is very useful to implement web application to access the Database! I used JSTL SQL tag like below in this article, but I faced with some problems. <%@ page contentType="text/html;charset=UTF-8" %> <%@ taglib uri="h…

How to define the SQL parameter in JSTL?

There is a JSTL to execute SQL, that is sql:query. I want to execute SQL with WHERE sentence in JSP with using HTTP request parameter in WHERE conditions. This is a sample. <%@ page contentType="text/html;charset=UTF-8" %> <%@ taglib uri="…

Ant Task Examples - 2016-06-02

Here is a basic example of Apache Ant task. Define properties, using this value ${property} like valuables <property name="tomcat.host" value="192.168.1.250" /> <property name="tomcat.port" value="8080" /> <property name="username" value="tomcat" /> <property name="password" value="password" /> Java…</property></property></property></property>

JSTL if-else sample with c:out

This is my memo. We can write JSP with using c:choose and c:when, c:otherwise behave as if-else syntax. This example inclues c:forEach and sql:query also. Getting some data from database with sql:query, and show them with c:forEach loop an…

web.xml config template for Restful Application

The web.xml file included war archive of Java WebApp tends to be bigger with a lot of URIs if there are a lot of functions like Restful Web Service Applications. The maintenance of such applications is very mistakable. The debugging URI mi…

Apache Ant Install into MacOS

Here is a procedure to install Apache Ant manually. Check the latest version at Apache Ant Site Getting latest version ZIP Expand the ZIP(automatically expanded into $HOME/Downloads, I believe) sudo mkdir /usr/local/share/ant sudo cp $ANT_…

Java16進数演算標準版?

Java16進数演算 on String - Shammerismで、自分で16進数の演算をやるようにしてみたが、なんかもっとうまいやり方がありそうな気がして調べたら・・・あった。標準ライブラリでできる。Integer.parseInt(String, int)とかInteger.toString(int, int)を使用…

Java16進数演算 on String

Javaで16進数の計算を行いたい。でも、Hexadecimalというようなクラスはない。String/Integer/Doubleなどのようにあってほしかったが。 とりあえず、16進数の任意の値を文字列で受け取り、それを計算する例。 public class Hexadecimal { private static fin…

Test connecting PostgreSQL DB from tomcat8

This is an continued article of PostgreSQL JDBC Driver on tomcat8 - Shammerism. There is a JSP tag library to connect Database and showing the search result. There are a lot of links, one of them is https://www.tutorialspoint.com/jsp/jsp_s…

PostgreSQL JDBC Driver on tomcat8

I setup DB Application on tomcat8, host OS is Debian Jessie and JavaVM is OpenJDK 1.7.0_151. At first, I used JDBC Driver which can be installed with apt-get, but it doesn't work fine. I saw a stack trace which is began with "java.lang.Abs…

Install Tomcat7 on Debian wheezy via apt-get

On wheezy, we can install tomcat 7.0.28 via apt-get. apt-get update apt-get install openjdk-7-jdk apt-get install tomcat7 apt-get install tomcat7-admin edit /etc/tomcat7/tomcat-user.xml No system user required. Tomcat seems to check tomcat…

Tomcat configuration

I cannot transfer big data to tomcat. In detail, tomcat seems to stop reading post parameter if it's size is big(I tried more than 50MB text). This is caused by default tomcat config parameter "maxPostSize". Changing this parameter to -1 a…

Using Tomcat Deployer via ant

Download Tomcat Deployer from Apache Site Expand Deployer's tar.gz file anywhere you like(call the directory tomcat.deployer.dir) Generate build.xml Add following element to build.xml <path id="classpath.tomcat"> <fileset dir="${topmcat.dir}/lib/"> <include name="*.jar" /> …</include></fileset></path>

Tomcat daemon configuration on Debian

According to Apache Tomcat 7 (7.0.92) - Tomcat Setup, tomcat can be invoked as UNIX daemon. And installation step is explained in this document. This requires JDK and gcc. I try this by following steps. This article is an additional one of…

Java environment setup on Debian by using /etc/profile.d

This is a replacement of Install JavaSDK and apache-tomcat on Debian - Shammerism. The script files located at /etc/profile.d/ are invoked during boot. I generate javaenv.sh. JDK installation step is same as above article. javaenv.sh expor…

Install JavaSDK and apache-tomcat on Debian

I install JavaSDK and apache-tomcat on my environment, each products version are below. Debian Squeeze JavaSDK 7u65 Apache Tomcat 7.0.54 JavaSDK can be downloaded from Oracle Web Site, and Apache Tomcat can be downloaded from Apache Web Si…

printStackTrace を自力で書いてみる

printStackTrace は、デフォルトでは標準出力に出す。そして、引数で PrintWriter を渡してやればそこに書き込みしてくれる。しかし、、、文字列でそれを取得したい場合にどうするんだろう、と思ったのでちょっと調べてみた。こんな感じで書けばそれっぽい情…

java.io.File[] をファイル名でソートする

/home/test/files/ 以下にあるファイルをファイル名でソートして出力するサンプル。エラーチェックとかは省略している。 import java.io.File; public class Test { public static void main(String[]args){ File diffDirectory = new File("/home/test/file…

Java Mail CC 送信 Sample

Java Mail Sample - Shammerismの内容に CC 送信処理を追加しただけだが。CC 送信するには、javax.mail.internet.InternetAddress の配列をもう一つ用意し、javax.mail.Message.setRecipients で Message.RecipientType.CC として渡す。 import java.util.Da…

Java Mail Sample

たまにしか書かないので忘れないようにメモ。 Sample Source Code import java.util.Date; import java.util.Properties; import javax.mail.Message; import javax.mail.Session; import javax.mail.internet.InternetAddress; import javax.mail.internet.…

Timestamp のみを返す JSP

curl などで動作検証していると、JSP を使用した際の余計な改行が気になる。なので、余計な改行なしでタイムスタンプのみを返す JSP を作成。一行だけなのだが、また暫くしてどうやるんだっけ?となると面倒だからメモ代わりに残しておく。 $ cat time.jsp <…

HelloWorld, EJB 3.0(StatelessSessionBean)

WLS付属のEJB3.0のサンプルは、複雑すぎる・・・一応、構成図もついているが、サンプルなんてHelloWorldレベルのものでいいと思う。と、言う訳で自分で書いた。どうもテストケースとかの管理が下手なので、いつでもアクセスできるようにここに書いておく事に…

JavaSecurity

前に本で読んで概要レベルの学習をしたことはあるけれども、もう一度手を動かしつつやってみることにした。オライリーのJavaセキュリティを参考にする。 O'Reilly Japan - Javaセキュリティ 冒頭では、サンドボックスとかの話が出ている。ネットワークでいう…

OpenJDK for Mac Project

前にどこかで、Mac の Java は現行リリースされているバージョンで終了となり、JDK 7 以降は OpenJDK として提供されるようになる、という情報をみた。 このところ動きがあったようなので、New Project approved: Mac OS X PortやOpenJDK: Mac OS X Port Pro…

URLConnection sample

build.xml と一緒に。いつの日か、コピペで使えるように。まずは build.xml <project name="URLClient" default="jar" basedir="."> <property name="src" value="src"/> <property name="class" value="class"/> <property name="javadoc" value="api"/> <property name="version" value="1.0.0"/> </property></property></property></property></project>

URLEncodeを行うサンプル

Javaに限った話ではないが、ブラウザでWebサーバへアクセスすると、そのURLにエンコードされた情報が付与されることがある。英数字はそのままであることが多いが、記号とか日本語などの非ASCII文字の場合は、%XX(XXは文字ごとに異なる値)というような形で変…

O'Reilly Java ネットワークプログラミング

Java RMI の勉強をするためにいろいろ探してみたが、結局選んだのがこの本。 O'Reilly Japan - Javaネットワークプログラミング 第2版 RMI に限らず、Java でネットワークプログラミングを行うことを網羅している感じ。ネットワークとは何か、という説明から…