| Size: 304 Comment:  |  ← Revision 92 as of 2021-01-15 16:24:10  ⇥ Size: 9353 Comment:  | 
| Deletions are marked like this. | Additions are marked like this. | 
| Line 2: | Line 2: | 
| * JEE5 certified | * JEE5 certified * Java EE 5 (May 11, 2006) (Java Servlet 2.5, JSP 2.1, JSTL 1.2, JSF 1.2, EJB 3.0, JDBC 3.0) | 
| Line 4: | Line 5: | 
| * https://docs.oracle.com/javaee/5/tutorial/doc/ | |
| Line 6: | Line 8: | 
| * Requires jdk-1_5_0_22-linux-amd64.bin from Oracle to run * run.sh -c options :minimal default all standard web {{attachment:jeeTiers.png}} | |
| Line 9: | Line 14: | 
| == Locally on debian buster == | |
| Line 10: | Line 17: | 
| cp jdk-1_5_0_22-linux-amd64.bin ~ cd ~ ./jdk-1_5_0_22-linux-amd64.bin unzip jboss-5.1.0.GA.zip JAVA_HOME=jdk1.5.0_22/ jboss-5.1.0.GA/bin/run.sh -b 0.0.0.0 http://127.0.0.1:8080/ wget https://archive.apache.org/dist/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.zip unzip apache-maven-3.1.1-bin.zip JAVA_HOME=jdk1.5.0_22/ ~/apache-maven-3.1.1/bin/mvn -version JAVA_HOME=~/jdk1.5.0_22/ ~/apache-maven-3.1.1/bin/mvn clean install }}} == Docker == Dockerfile {{{ FROM ubuntu:16.04 RUN apt-get update && apt-get install -y openssh-server unzip openjdk-8-jdk net-tools maven vim RUN mkdir /var/run/sshd RUN echo 'root:screencast' | chpasswd RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config # SSH login fix. Otherwise user is kicked off after login RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd ENV NOTVISIBLE "in users profile" RUN echo "export VISIBLE=now" >> /etc/profile RUN useradd userx RUN echo 'userx:userx' | chpasswd EXPOSE 22 8080 8081 8009 8009 CMD ["/usr/sbin/sshd", "-D"] }}} {{{#!highlight bash | |
| Line 13: | Line 58: | 
| }}} | nano Dockerfile docker build -t docker_jboss5 . mkdir target docker run -d -p 8080:8080 --name jboss5_container --mount type=bind,source="$(pwd)"/target,target=/app docker_jboss5 #docker run -d -P --name jboss5_container --mount type=bind,source="$(pwd)"/target,target=/app docker_jboss5 mv ~/jboss-5.1.0.GA.zip target/ docker exec -it jboss5_container bash cd /app unzip jboss-5.1.0.GA.zip ./jdk-1_5_0_22-linux-amd64.bin /app# jdk1.5.0_22/bin/java -version #java version "1.5.0_22" #Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03) #Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_22-b03, mixed mode) #/app/jdk1.5.0_22/bin/java -jar run.jar mvn -version #Apache Maven 3.3.9 #Maven home: /usr/share/maven #Java version: 1.8.0_252, vendor: Private Build #Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre #Default locale: en_US, platform encoding: ANSI_X3.4-1968 #OS name: "linux", version: "4.19.0-6-amd64", arch: "amd64", family: "unix" cd /app/jboss-5.1.0.GA/bin JAVA_HOME=/app/jdk1.5.0_22 ./run.sh -c all -b 0.0.0.0 }}} == HyperSQL Database (HSQLDB) == * http://hsqldb.org/ HyperSQL is used for development, testing and deployment of database applications. {{{ user: sa pwd: empty port: 1701 db path: /app/jboss-5.1.0.GA/server/default/data/hypersonic/localDB java -cp ./common/lib/hsqldb.jar org.hsqldb.util.SqlTool localDB #rcfile # vi /root/sqltool.rc urlid localDB url jdbc:hsqldb:/app/jboss-5.1.0.GA/server/default/data/hypersonic/localDB;shutdown=true username sa password /app/jboss-5.1.0.GA/server/default/data/hypersonic java -cp /app/jboss-5.1.0.GA/common/lib/hsqldb.jar org.hsqldb.util.SqlTool localDB \? \q # show tables \dt TABLE_SCHEM TABLE_NAME ----------- -------------- PUBLIC ADDENTITY sql> select * from addentity; ID CREATIONDATE OP1 OP2 RES -- ----------------------- --- --- --- 1 2020-06-20 15:05:29.037 1 7 8 2 2020-06-20 15:05:30.509 1 7 8 3 2020-06-20 15:05:31.137 1 7 8 4 2020-06-20 15:05:43.043 1 70 71 5 2020-06-20 15:09:01.0 299 1 300 6 2020-06-20 15:25:14.918 1 2 3 7 2020-06-20 15:25:42.434 10 20 30 }}} == JNDIView == * http://127.0.0.1:8080/jmx-console/ Show JNDI info. In jmx console choose jboss, service=JNDIView, invoke list, Global JNDI Namespace * http://127.0.0.1:8080/jmx-console/HtmlAdaptor?action=inspectMBean&name=jboss%3Aservice%3DJNDIView == Spring 3.0.1 in JBoss 5 == * https://docs.spring.io/spring/docs/3.0.x/spring-framework-reference/html/new-in-3.html#new-in-3-intro === pom.xml === {{{#!highlight xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.allowed.bitarus</groupId> <artifactId>testSpringMVCJSP</artifactId> <version>0.1.0</version> <packaging>war</packaging> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>3.0.1.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>3.0.1.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>3.0.1.RELEASE</version> </dependency> </dependencies> <build> <sourceDirectory>src/main/java</sourceDirectory> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> </plugins> </build> </project> }}} === src/main/java/org/allowed/bitarus/hello/HelloController.java === {{{#!highlight java package org.allowed.bitarus.hello; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @Controller public class HelloController { @RequestMapping("/hello") public String hellox(@RequestParam(value="name", required=false, defaultValue="World") String name, Model model) { model.addAttribute("name", name); return "greeting"; } } }}} === src/main/webapp/WEB-INF/mvc-dispatcher-servlet.xml === {{{#!highlight xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="org.allowed.bitarus.hello" /> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix"> <value>/WEB-INF/pages/</value> </property> <property name="suffix"> <value>.jsp</value> </property> </bean> </beans> }}} === src/main/webapp/WEB-INF/pages/greeting.jsp === {{{#!highlight html <!DOCTYPE HTML> <html xmlns:th="http://www.thymeleaf.org"> <head> <title>Getting Started: Serving Web Content</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <p>Hello ${name}</p> </body> </html> }}} === src/main/webapp/WEB-INF/web.xml === {{{#!highlight xml <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Spring MVC Application + JSP</display-name> <servlet> <servlet-name>mvc-dispatcher</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>mvc-dispatcher</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value> </context-param> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> </web-app> }}} | 
JBoss5
- JEE5 certified  - Java EE 5 (May 11, 2006) (Java Servlet 2.5, JSP 2.1, JSTL 1.2, JSF 1.2, EJB 3.0, JDBC 3.0)
 
- https://docs.oracle.com/javaee/5/tutorial/doc/javaeetutorial5.pdf 
- Web container
- EJB container
- Requires jdk-1_5_0_22-linux-amd64.bin from Oracle to run
- run.sh -c options :minimal default all standard web
 
  
 
Locally on debian buster
cp jdk-1_5_0_22-linux-amd64.bin ~ cd ~ ./jdk-1_5_0_22-linux-amd64.bin unzip jboss-5.1.0.GA.zip JAVA_HOME=jdk1.5.0_22/ jboss-5.1.0.GA/bin/run.sh -b 0.0.0.0 http://127.0.0.1:8080/ wget https://archive.apache.org/dist/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.zip unzip apache-maven-3.1.1-bin.zip JAVA_HOME=jdk1.5.0_22/ ~/apache-maven-3.1.1/bin/mvn -version JAVA_HOME=~/jdk1.5.0_22/ ~/apache-maven-3.1.1/bin/mvn clean install
Docker
Dockerfile
FROM ubuntu:16.04 RUN apt-get update && apt-get install -y openssh-server unzip openjdk-8-jdk net-tools maven vim RUN mkdir /var/run/sshd RUN echo 'root:screencast' | chpasswd RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config # SSH login fix. Otherwise user is kicked off after login RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd ENV NOTVISIBLE "in users profile" RUN echo "export VISIBLE=now" >> /etc/profile RUN useradd userx RUN echo 'userx:userx' | chpasswd EXPOSE 22 8080 8081 8009 8009 CMD ["/usr/sbin/sshd", "-D"]
   1 wget http://sourceforge.net/projects/jboss/files/JBoss/JBoss-5.1.0.GA/jboss-5.1.0.GA.zip
   2 unzip  jboss-5.1.0.GA.zip
   3 
   4 nano Dockerfile
   5 
   6 docker build -t docker_jboss5 . 
   7 mkdir target
   8 docker run -d -p 8080:8080 --name jboss5_container  --mount type=bind,source="$(pwd)"/target,target=/app  docker_jboss5
   9 #docker run -d -P --name jboss5_container  --mount type=bind,source="$(pwd)"/target,target=/app  docker_jboss5
  10 mv ~/jboss-5.1.0.GA.zip target/
  11 docker exec -it jboss5_container  bash
  12 cd /app
  13 unzip jboss-5.1.0.GA.zip
  14 
  15 ./jdk-1_5_0_22-linux-amd64.bin
  16 /app# jdk1.5.0_22/bin/java -version
  17 #java version "1.5.0_22"
  18 #Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)
  19 #Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_22-b03, mixed mode)
  20 
  21 #/app/jdk1.5.0_22/bin/java -jar run.jar 
  22 
  23 mvn -version
  24 #Apache Maven 3.3.9
  25 #Maven home: /usr/share/maven
  26 #Java version: 1.8.0_252, vendor: Private Build
  27 #Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
  28 #Default locale: en_US, platform encoding: ANSI_X3.4-1968
  29 #OS name: "linux", version: "4.19.0-6-amd64", arch: "amd64", family: "unix"
  30 
  31 cd /app/jboss-5.1.0.GA/bin
  32 JAVA_HOME=/app/jdk1.5.0_22 ./run.sh -c all -b 0.0.0.0
HyperSQL Database (HSQLDB)
HyperSQL is used for development, testing and deployment of database applications.
user: sa pwd: empty port: 1701 db path: /app/jboss-5.1.0.GA/server/default/data/hypersonic/localDB java -cp ./common/lib/hsqldb.jar org.hsqldb.util.SqlTool localDB #rcfile # vi /root/sqltool.rc urlid localDB url jdbc:hsqldb:/app/jboss-5.1.0.GA/server/default/data/hypersonic/localDB;shutdown=true username sa password /app/jboss-5.1.0.GA/server/default/data/hypersonic java -cp /app/jboss-5.1.0.GA/common/lib/hsqldb.jar org.hsqldb.util.SqlTool localDB \? \q # show tables \dt TABLE_SCHEM TABLE_NAME ----------- -------------- PUBLIC ADDENTITY sql> select * from addentity; ID CREATIONDATE OP1 OP2 RES -- ----------------------- --- --- --- 1 2020-06-20 15:05:29.037 1 7 8 2 2020-06-20 15:05:30.509 1 7 8 3 2020-06-20 15:05:31.137 1 7 8 4 2020-06-20 15:05:43.043 1 70 71 5 2020-06-20 15:09:01.0 299 1 300 6 2020-06-20 15:25:14.918 1 2 3 7 2020-06-20 15:25:42.434 10 20 30
JNDIView
Show JNDI info. In jmx console choose jboss, service=JNDIView, invoke list, Global JNDI Namespace
Spring 3.0.1 in JBoss 5
pom.xml
   1 <?xml version="1.0" encoding="UTF-8"?>
   2 <project xmlns="http://maven.apache.org/POM/4.0.0" 
   3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   4     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
   5 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   6     <modelVersion>4.0.0</modelVersion>
   7     <groupId>org.allowed.bitarus</groupId>
   8     <artifactId>testSpringMVCJSP</artifactId>
   9     <version>0.1.0</version>
  10     <packaging>war</packaging>
  11     <dependencies>
  12                 <dependency>
  13                         <groupId>org.springframework</groupId>
  14                         <artifactId>spring-core</artifactId>
  15                         <version>3.0.1.RELEASE</version>
  16                 </dependency>
  17                 <dependency>
  18                         <groupId>org.springframework</groupId>
  19                         <artifactId>spring-web</artifactId>
  20                         <version>3.0.1.RELEASE</version>
  21                 </dependency> 
  22                 <dependency>
  23                         <groupId>org.springframework</groupId>
  24                         <artifactId>spring-webmvc</artifactId>
  25                         <version>3.0.1.RELEASE</version>
  26                 </dependency>
  27     </dependencies>
  28     <build>
  29         <sourceDirectory>src/main/java</sourceDirectory>
  30         <plugins>
  31            <plugin>
  32                 <artifactId>maven-compiler-plugin</artifactId>
  33                 <configuration>
  34                     <source>1.5</source>
  35                     <target>1.5</target>
  36                 </configuration>
  37             </plugin>
  38         </plugins>
  39     </build>
  40 </project>
src/main/java/org/allowed/bitarus/hello/HelloController.java
   1 package org.allowed.bitarus.hello;
   2 
   3 import org.springframework.stereotype.Controller;
   4 import org.springframework.ui.Model;
   5 import org.springframework.web.bind.annotation.RequestMapping;
   6 import org.springframework.web.bind.annotation.RequestParam;
   7 
   8 @Controller
   9 public class HelloController {
  10     @RequestMapping("/hello")
  11     public String hellox(@RequestParam(value="name", required=false,  defaultValue="World") String name, Model model) {
  12         model.addAttribute("name", name);
  13         return "greeting";
  14     }
  15 }
src/main/webapp/WEB-INF/mvc-dispatcher-servlet.xml
   1 <beans xmlns="http://www.springframework.org/schema/beans"
   2         xmlns:context="http://www.springframework.org/schema/context"
   3         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   4         xsi:schemaLocation="
   5         http://www.springframework.org/schema/beans     
   6         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   7         http://www.springframework.org/schema/context 
   8         http://www.springframework.org/schema/context/spring-context-3.0.xsd">
   9         <context:component-scan base-package="org.allowed.bitarus.hello" />
  10         <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  11                 <property name="prefix">
  12                         <value>/WEB-INF/pages/</value>
  13                 </property>
  14                 <property name="suffix">
  15                         <value>.jsp</value>
  16                 </property>
  17         </bean>
  18 </beans>
src/main/webapp/WEB-INF/pages/greeting.jsp
src/main/webapp/WEB-INF/web.xml
   1 <web-app id="WebApp_ID" version="2.4"
   2         xmlns="http://java.sun.com/xml/ns/j2ee" 
   3         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   4         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
   5         http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
   6  
   7         <display-name>Spring MVC Application + JSP</display-name> 
   8         <servlet>
   9                 <servlet-name>mvc-dispatcher</servlet-name>
  10                 <servlet-class>
  11                        org.springframework.web.servlet.DispatcherServlet
  12                 </servlet-class>
  13                 <load-on-startup>1</load-on-startup>
  14         </servlet>
  15         <servlet-mapping>
  16                 <servlet-name>mvc-dispatcher</servlet-name>
  17                 <url-pattern>/</url-pattern>
  18         </servlet-mapping>
  19         <context-param>
  20                 <param-name>contextConfigLocation</param-name>
  21                 <param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
  22         </context-param>
  23         <listener>
  24                 <listener-class>
  25                       org.springframework.web.context.ContextLoaderListener
  26                 </listener-class>
  27         </listener>
  28 </web-app>
