Friday, December 26, 2014

Wildfly EJB With JPA On A Phone

https://www.youtube.com/watch?v=n5dsJ7okcGA













Seconds to the count down:
9 enter Fedora21
8 start Wildfly
7 add database browser
6 Wildfly up
4 database empty
2 run application
0 object in database

My server(my phone) runs the precidio-jndi-calc.tar.gz software, which calculates resonator designs for buyers with their JPA Buyer accounts like this,




. When a visitor does not have an account, the stateful bean creates a temporary account, which can be viewed in the video's H2 console.

The wildfly web interface is http://127.0.0.1:88080 ; database web interface url is  http://127.0.0.1:88080/h2console . JDBC url and password are in /etc/wildfly/standalone/standalone-full.xmljdbc:h2:mem:test and sa respectively.

The precidio-calc.jar's structure is this,
├── Buyer.class
├── META-INF
│   ├── create-script.sql
│   ├── drop-script.sql
│   ├── ejb-jar.xml
│   ├── MANIFEST.MF
│   └── persistence.xml
├── PackagerBean.class
├── PackagerCommonBusiness.class
├── RemoteResonatorCalculator.class
├── RemoteSiliconResonatorCalculator.class
├── ResonatorCalculatorBean.class
└── SiliconResonatorCalculatorBean.class
, which is a standard standalone jar layout, a subset of an EAR. The client layout is this,
├── jndi.properties
├── RemoteCalculatorClient.class
├── RemoteResonatorCalculator.class
└── RemoteSiliconResonatorCalculator.class
, which means that the client does not need to know the bean implementation, just the shell of the different Calculators . The jndi.properties has username and password, which the server side add-user.sh needs to catch up with the client.


The Fedora 21 Wildfly's jar files are split into 2 directories which fails the EJB server startup. To fix it, shell command lines were these, (all these are already done in my Fedora...arm...21-6.tar.gz)
   91  mv /usr/lib/java/hawtjni/* /usr/share/java/hawtjni/
   92  mv /usr/lib/java/hornetq/* /usr/share/java/hornetq/
   93  mv /usr/lib/java/jansi-native/ /usr/share/java/
   94  rmdir /usr/lib/java/hawtjni/
   95  rmdir /usr/lib/java/hornetq/
   96  mv /usr/lib/java/jffi.jar /usr/share/java/
   97  mv /usr/lib/java/jss4.jar /usr/share/java/
   98  mv /usr/lib/java/netty/netty-* /usr/share/java/netty/
   99  rmdir /usr/lib/java/netty/
  100  mv /usr/lib/java/snappy-java/ /usr/share/java/
  101  mv /usr/lib/java/weld-core/* /usr/share/java/weld-core/
  102  rmdir /usr/lib/java/weld-core/
  103  mv /usr/lib/java/wildfly/wildfly-client-all.jar /usr/share/java/wildfly/
  104  cd /usr/lib/java
  106  rmdir wildfly/
  107  cd ../
  108  rmdir java
  109  ln -s /usr/share/java
  129  ln -s /usr/share/java/resteasy/resteasy-json-p-provider-jandex.jar /usr/share/wildfly/modules/system/layers/base/org/jboss/resteasy/resteasy-json-p-provider/main/resteasy-json-p-provider-jandex.jar

I studied the EJB exam and researched on EJB to obtain certification entirely on this phone/tablet/wildfly setting. 

No comments:

Post a Comment