Wednesday, January 16, 2019

Installing spring boot CLI and spring cloud on centos


vi .bash_profile

export SPRING_HOME=/home/centos/spring-2.1.2.RELEASE/
export PATH

to test, type:

spring version

Spring CLI v2.1.2.RELEASE

See also

vi app.groovy

class WebApplication {

String home() {
"Hello World!"


spring run app.groovy
curl http://localhost:8080/

Now you can install Spring Cloud:

spring install

spring cloud configserver

I get

Caused by: java.lang.NoSuchMethodError:$LauncherOptionHandler.option(Ljava/util/Collection;Ljava/lang/String;)Ljoptsimple/OptionSpecBuilder;

see here

If I install an older version of Spring CLI, it works:

More information on the Spring Cloud command here

Tuesday, January 15, 2019

WELD is a holy piece of crap

All of a sudden I get this, and the HTML page is basically blank

2019-01-14 16:21:54,369 WARN [org.jboss.weld.Servlet] (http-/ WELD-000714 HttpContextLifecycle guard leak detected. The Servlet container is not fully compliant. The value was 1
2019-01-14 16:21:54,370 WARN [org.jboss.weld.Context] (http-/ WELD-000223 Bean store leak was detected during org.jboss.weld.context.http.HttpRequestContextImpl association: org.apache.catalina.connector.RequestFacade@6da1f69f
2019-01-14 16:21:54,371 WARN [org.jboss.weld.Context] (http-/ WELD-000223 Bean store leak was detected during org.jboss.weld.context.http.HttpSessionContextImpl association: org.apache.catalina.connector.RequestFacade@6da1f69f

I am just using some javax.inject.Inject and javax.ejb.Stateless annotations.

After undoing all and redoing one step at a time, it all works.

I have enabled weld logging in standalone.xml

<logger category="org.jboss.weld"><level name="DEBUG"/></logger>

but this doesn't help much.

THey say one should hook in the BeanManager to examine its content, but I find this unpractical.
They should really provide a managemen/monitoring console, like the /beans endpoint in SpringBoot.

Once more, Java EE proves to be inferior to Spring.

Wednesday, January 9, 2019

apache httpd on centos

sudo yum install httpd mod_ssl
systemctl status httpd
systemctl start httpd
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
systemctl status httpd.service
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sat 2018-04-28 02:58:49 CEST; 12s ago
     Docs: man:httpd(8)
  Process: 25955 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 25951 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 25951 (code=exited, status=1/FAILURE)

sudo su -
cd /var/log/httpd/
less error_log

[Sat Apr 28 02:58:49.199587 2018] [core:notice] [pid 25951] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Sat Apr 28 02:58:49.222124 2018] [suexec:notice] [pid 25951] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sat Apr 28 02:58:49.223152 2018] [ssl:emerg] [pid 25951] (13)Permission denied: AH02201: Init: Can't open server certificate file /home/centos/myapp/mysitename.crt
[Sat Apr 28 02:58:49.223168 2018] [ssl:emerg] [pid 25951] AH02312: Fatal error initialising mod_ssl, exiting.

less /etc/httpd/conf/httpd.conf

<VirtualHost *:443>
  DocumentRoot /var/www/website
  SSLEngine on
  SSLCertificateFile "/home/centos/myapp/mysitename.crt"
  SSLCertificateKeyFile "/home/centos/myapp/mysitename.key"

sudo /usr/sbin/httpd -S
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:443                  is a NameVirtualHost
         default server (/etc/httpd/conf/httpd.conf:107)
         port 443 namevhost (/etc/httpd/conf/httpd.conf:107)
         port 443 namevhost localhost.localdomain (/etc/httpd/conf.d/ssl.conf:56)
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/etc/httpd/logs/error_log"
Mutex default: dir="/run/httpd/" mechanism=default 
Mutex mpm-accept: using_defaults
Mutex authdigest-opaque: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex ssl-cache: using_defaults
PidFile: "/run/httpd/"
User: name="apache" id=48
Group: name="apache" id=48

See also

Friday, January 4, 2019

jcmd GC.heap_dump File exists

The instructions here say:

Create a heap dump (hprof dump)

jcmd GC.heap_dump filename=Myheapdump

This is wrong. First, you need a PID; second, you should not provide filename=bla but simply bla:

Correct example:

/usr/lib/jvm/java-openjdk/bin/jcmd 50513 GC.heap_dump /u01/users/admrun/nexus3_02.hprof

if you run simply

/usr/lib/jvm/java-openjdk/bin/jcmd 50513 GC.heap_dump filename=bla.hprof

it doesn't create a bla.hprof but rather a "filename" file.... and the second time you run it you get a "File exists" message.

Confusing and frustrating!