MoinMoin Logo
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Navigation

  • Start
  • Sitemap
Revision 25 as of 2020-06-19 18:10:17
  • Java
  • JBoss5

JBoss5

  • JEE5 certified
  • 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

jeeContainers.png

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"]

wget http://sourceforge.net/projects/jboss/files/JBoss/JBoss-5.1.0.GA/jboss-5.1.0.GA.zip
unzip  jboss-5.1.0.GA.zip

nano Dockerfile

docker build -t docker_test . 
mkdir target
docker run -d -P --name test_container1  --mount type=bind,source="$(pwd)"/target,target=/app  docker_test 
mv ~/jboss-5.1.0.GA.zip target/
docker exec -it test_container1 bash
cd /app
unzip jboss-5.1.0.GA.zip

./jdk-1_5_0_22-linux-amd64.bin
root@681bc2ea28fc:/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 

cd /app/jboss-5.1.0.GA/bin
./run.sh -b 0.0.0.0

Example EJB for jboss5

  • mvn clean compile package
  • cp /app/ejbjee5/target/ejbjee5-0.0.1.jar /app/jboss-5.1.0.GA/server/default/deploy/

18:04:14,955 INFO  [JBossASKernel] Created KernelDeployment for: ejbjee5-0.0.1.jar
18:04:14,955 INFO  [JBossASKernel] installing bean: jboss.j2ee:jar=ejbjee5-0.0.1.jar,name=ScheduleWS,service=EJB3
18:04:14,955 INFO  [JBossASKernel]   with dependencies:
18:04:14,955 INFO  [JBossASKernel]   and demands:
18:04:14,955 INFO  [JBossASKernel]      jboss.ejb:service=EJBTimerService
18:04:14,955 INFO  [JBossASKernel]   and supplies:
18:04:14,956 INFO  [JBossASKernel]      Class:org.allowed.bitarus.ScheduleRemote
18:04:14,956 INFO  [JBossASKernel]      jndi:ScheduleWS/local-org.allowed.bitarus.ScheduleLocal
18:04:14,956 INFO  [JBossASKernel]      jndi:ScheduleWS/remote
18:04:14,956 INFO  [JBossASKernel]      Class:org.allowed.bitarus.ScheduleLocal
18:04:14,956 INFO  [JBossASKernel]      jndi:ScheduleWS/local
18:04:14,956 INFO  [JBossASKernel]      jndi:ScheduleWS/remote-org.allowed.bitarus.ScheduleRemote
18:04:14,956 INFO  [JBossASKernel] Added bean(jboss.j2ee:jar=ejbjee5-0.0.1.jar,name=ScheduleWS,service=EJB3) to KernelDeployment of: ejbjee5-0.0.1.jar
18:04:14,957 INFO  [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@542c21cb{name=jboss.j2ee:jar=ejbjee5-0.0.1.jar,name=ScheduleWS,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
18:04:15,020 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=ejbjee5-0.0.1.jar,name=ScheduleWS,service=EJB3
18:04:15,020 INFO  [EJBContainer] STARTED EJB: org.allowed.bitarus.ScheduleWS ejbName: ScheduleWS
18:04:15,041 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

        ScheduleWS/remote - EJB3.x Default Remote Business Interface
        ScheduleWS/remote-org.allowed.bitarus.ScheduleRemote - EJB3.x Remote Business Interface
        ScheduleWS/local - EJB3.x Default Local Business Interface
        ScheduleWS/local-org.allowed.bitarus.ScheduleLocal - EJB3.x Local Business Interface

18:04:15,097 INFO  [DefaultEndpointRegistry] register: jboss.ws:context=ejbjee5-0.0.1,endpoint=ScheduleWS
18:04:15,225 INFO  [WSDLFilePublisher] WSDL published to: file:/app/jboss-5.1.0.GA/server/default/data/wsdl/ejbjee5-0.0.1.jar/ScheduleWSService4435570151338675382.wsdl
18:04:15,248 INFO  [TomcatDeployment] deploy, ctxPath=/ejbjee5-0.0.1

./src/main/java/org/allowed/bitarus/ScheduleRemote.java

package org.allowed.bitarus;

import javax.ejb.Remote;

@Remote
public interface ScheduleRemote {
        int addSchedule(int val1, int val2);
}

./src/main/java/org/allowed/bitarus/ScheduleLocal.java

package org.allowed.bitarus;

import javax.ejb.Local;

@Local
public interface ScheduleLocal {
        int addSchedule(int val1, int val2) ;
}

./src/main/java/org/allowed/bitarus/ScheduleWS.java

package org.allowed.bitarus;

import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebService;
import org.allowed.bitarus.ScheduleRemote;

@Stateless
@WebService
public class ScheduleWS implements ScheduleRemote {

        @WebMethod
        public int addSchedule(int val1, int val2) {
                return val1 + val2;
        }
}

./src/main/resources/META-INF/ejb-jar.xml

<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
        version="3.0">
        <enterprise-beans>
                <session>
                        <ejb-name>ScheduleWS</ejb-name>
                        <business-local>org.allowed.bitarus.ScheduleLocal</business-local>
                        <business-remote>org.allowed.bitarus.ScheduleRemote</business-remote>
                        <ejb-class>org.allowed.bitarus.ScheduleWS</ejb-class>
                        <session-type>Stateless</session-type>
                        <transaction-type>Container</transaction-type>
                </session>
        </enterprise-beans>
</ejb-jar>

./pom.xml

<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>ejbjee5</artifactId>
        <version>0.0.1</version>
        <packaging>ejb</packaging>
        <dependencies>
                <dependency>
                        <groupId>javaee</groupId>
                        <artifactId>javaee-api</artifactId>
                        <version>5</version>
                        <scope>provided</scope>
                </dependency>
        </dependencies>
        <build>
                <sourceDirectory>src</sourceDirectory>
                <plugins>
                        <plugin>
                                <artifactId>maven-compiler-plugin</artifactId>
                                <configuration>
                                        <source>1.5</source>
                                        <target>1.5</target>
                                </configuration>
                        </plugin>
                </plugins>
        </build>
</project>
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01