Tag cloud

JBoss (16) Fedora (5) Linux (4) Red Hat (4) JON (3) command line (3) 4.3 (2) JEE (2) JVM (2) Java (2) KVM (2) Oracle (2) Portal (2) Weblogic (2) installation (2) vs (2) /boot partition (1) Add-ons (1) Apache (1) Bundles (1) Business model (1) Byteman (1) CLASSPATH (1) EAP (1) EPP (1) Eclipse (1) Failover (1) Gnome (1) JAVA_OPTS (1) JBDS (1) JBoss Tools (1) JBossON (1) JConsole (1) JDK (1) JMS (1) JVM options (1) KDE (1) MBean (1) Network (1) Open Source (1) RHQ (1) Red Hat subscription (1) Thunderbird (1) Troubleshooting (1) Virtulization (1) WS (1) Webservices (1) Wireshark (1) classloading (1) clustering (1) comparison (1) debug (1) deployment (1) disable SELinux (1) disksize (1) error (1) fun (1) jboss.org (1) log (1) log4j (1) lvm (1) messaging (1) multiple WARs (1) patent FOSS (1) performance tuning (1) provisionning (1) scripting (1) services (1) switch (1) troll (1) upgrade (1) video (1) war (1) webapp (1) yum (1)

01 December 2010

Byteman JBoss scripting

Summary:
When your HA system crashes with JEE application running on JBoss you might want to try JBoss Byteman, an bytecode injection tool that lets you add logging without touching the application itself.

Main post:

The steps to debug an application using
1. Download byteman-1.0.3.CP02 (for JDK5) or byteman-1.3 (for JDK6)
2. Extract the zip into $BYTEMAN_HOME
3. Modify your JBoss startup configuration by adding the following 3 lines at the end of $JBOSS_HOME/jboss-as/bin/run.conf:
# Adding extra logging to standard output (BYTEMAN_HOME needs to be addapted)
BYTEMAN_HOME="/tmp/byteman-1.x.x"
JAVA_OPTS="$JAVA_OPTS -javaagent:$BYTEMAN_HOME/lib/byteman.jar=script:$BYTEMAN_HOME/script.txt"

4. For JDK5 add the file $BYTEMAN_HOME/script.txt :
RULE trace RepositoryClassLoader.loadClassImpl entry
CLASS RepositoryClassLoader
METHOD loadClassImpl
AT ENTRY
IF TRUE
DO traceln("*** " + $0 + ".loadClassImpl(" + $1 + ", " + $2 + ", " + $3
+ ") ENTRY in " + Thread.currentThread())
ENDRULE

RULE trace RepositoryClassLoader.loadClassImpl exit
CLASS RepositoryClassLoader
METHOD loadClassImpl
AT EXIT
IF TRUE
DO traceln("*** " + $0 + ".loadClassImpl(" + $1 + ", " + $2 + ", " + $3
+ ") EXIT in " + Thread.currentThread())
ENDRULE

RULE trace RepositoryClassLoader.loadClassImpl CALL wait
CLASS RepositoryClassLoader
METHOD loadClassImpl
AT INVOKE Object.wait()
IF TRUE
DO traceln("*** " + $0 + ".loadClassImpl(" + $1 + ", " + $2 + ", " + $3
+ ") CALL wait in " + Thread.currentThread())
ENDRULE

RULE trace RepositoryClassLoader.loadClassImpl CALL notifyAll
CLASS RepositoryClassLoader
METHOD loadClassImpl
AT INVOKE Object.notifyAll()
IF TRUE
DO traceln("*** " + $0 + ".loadClassImpl(" + $1 + ", " + $2 + ", " + $3
+ ") CALL wait in " + Thread.currentThread())
ENDRULE


5. For JDK6 add the file $BYTEMAN_HOME/script.txt :
RULE trace RepositoryClassLoader.loadClassImpl entry
CLASS RepositoryClassLoader
METHOD loadClassImpl
AT ENTRY
IF TRUE
DO traceln("*** " + $0 + ".loadClassImpl(" + $1 + ", " + $2 + ", " + $3
+ ") ENTRY in " + Thread.currentThread())
ENDRULE

RULE trace RepositoryClassLoader.loadClassImpl exit
CLASS RepositoryClassLoader
METHOD loadClassImpl
AT EXIT
IF TRUE
DO traceln("*** " + $0 + ".loadClassImpl(" + $1 + ", " + $2 + ", " + $3
+ ") EXIT in " + Thread.currentThread())
ENDRULE

RULE trace RepositoryClassLoader.loadClassImpl CALL wait
CLASS RepositoryClassLoader
METHOD loadClassImpl
AT CALL wait ALL
IF TRUE
DO traceln("*** " + $0 + ".loadClassImpl(" + $1 + ", " + $2 + ", " + $3
+ ") CALL wait in " + Thread.currentThread())
ENDRULE

RULE trace RepositoryClassLoader.loadClassImpl CALL notifyAll
CLASS RepositoryClassLoader
METHOD loadClassImpl
AT CALL notifyAll ALL
IF TRUE
DO traceln("*** " + $0 + ".loadClassImpl(" + $1 + ", " + $2 + ", " + $3
+ ") CALL wait in " + Thread.currentThread())
ENDRULE


6. After having starting your JBoss you should see in the standard out a lot of logging...
7. That should help you to find memory leaks, deadlocks ...

15 November 2010

Using POJOCache with AOP - Troubleshooting

Staring:

./run.sh -c all -Djboss.service.binding.set=ports-default -Djboss.messaging.ServerPeerID=1

./run.sh -c all2 -Djboss.service.binding.set=ports-02 -Djboss.messaging.ServerPeerID=2


./run.sh -c all -g DefaultPartition2 -b localhost -Djboss.service.binding.set=ports-02

./run.sh -c all -g DefaultPartition2 -b localhost -Djboss.service.binding.set=ports-01
./run.sh -c all -g DefaultPartition2 -b 127.0.0.1 "-Djboss.service.binding.set=ports-01 bind_addr=127.0.0.1"

-------------------------------------------------------------------------------------

You might run into an AOP error:
ERROR [Instrumentor] [warn] AOP Instrumentor failed to transform org.richfaces.ui.component.HighlightImpl
java.lang.RuntimeException: javassist.NotFoundException: com.uwyn.jhighlight.renderer.Renderer
at org.jboss.aop.pointcut.FieldMatcher.visit(FieldMatcher.java:113)
at org.jboss.aop.pointcut.ast.ASTField.jjtAccept(ASTField.java:44)
at org.jboss.aop.pointcut.FieldMatcher.visit(FieldMatcher.java:157)
at org.jboss.aop.pointcut.ast.ASTFieldExecution.jjtAccept(ASTFieldExecution.java:37)
at org.jboss.aop.pointcut.MatcherHelper.visit(MatcherHelper.java:89)
at org.jboss.aop.pointcut.MatcherHelper.matches(MatcherHelper.java:83)
at org.jboss.aop.pointcut.PointcutExpression.matchesGet(PointcutExpression.java:212)
at org.jboss.aop.instrument.JoinpointClassifier$1.matches(JoinpointClassifier.java:90)
at org.jboss.aop.instrument.JoinpointSimpleClassifier.classifyJoinpoint(JoinpointSimpleClassifier.java:63)
at org.jboss.aop.instrument.JoinpointClassifier.classifyFieldGet(JoinpointClassifier.java:227)
at org.jboss.aop.instrument.FieldAccessTransformer.buildFieldWrappers(FieldAccessTransformer.java:91)
at org.jboss.aop.instrument.Instrumentor.transform(Instrumentor.java:778)
at org.jboss.aop.instrument.GeneratedAdvisorInstrumentor.transform(GeneratedAdvisorInstrumentor.java:117)
at org.jboss.aop.SuperClassesFirstWeavingStrategy.instrumentClass(SuperClassesFirstWeavingStrategy.java:202)
at org.jboss.aop.SuperClassesFirstWeavingStrategy.translate(SuperClassesFirstWeavingStrategy.java:69)
at org.jboss.aop.AspectManager.translate(AspectManager.java:1077)
at org.jboss.aop.AspectManager.transform(AspectManager.java:1021)
at org.jboss.aop.standalone.AOPTransformer.aspectTransform(AOPTransformer.java:87)
at org.jboss.aop.standalone.AOPTransformer.transform(AOPTransformer.java:75)

Solution:
Modfiy /jboss-eap-5.1/jboss-as/server/all/conf/bootstrap/aop.xml:
You already changed the value from false to true (otherwise the error wouldn't have appeared)
true
Now you just have to add exclusion rules (otherwise those classes will try to be aspectized, but they do not have AOP support)
org.jboss.,org.richfaces.ui.,com.uwyn.jhighlight.

See also:
https://bmdsc.homeip.net/wiki/index.php/Java:JBoss

-----------------------------------------------------------
When setting up AOP, JGroups is enabled and will try to send out UDP messages:

ERROR [UDP] failed sending message to null (76 bytes)
java.lang.Exception: dest=/230.0.0.4:45688 (79 bytes)
at org.jgroups.protocols.UDP._send(UDP.java:361)
at org.jgroups.protocols.UDP.sendToAllMembers(UDP.java:302)
at org.jgroups.protocols.TP.doSend(TP.java:1478)
at org.jgroups.protocols.TP.send(TP.java:1468)
at org.jgroups.protocols.TP.down(TP.java:1186)
at org.jgroups.protocols.TP$ProtocolAdapter.down(TP.java:2308)
at org.jgroups.protocols.PING.sendMcastDiscoveryRequest(PING.java:278)
at org.jgroups.protocols.PING.sendGetMembersRequest(PING.java:259)
at org.jgroups.protocols.Discovery$PingSenderTask$1.run(Discovery.java:407)
at org.jgroups.util.TimeScheduler$RobustRunnable.run(TimeScheduler.java:196)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:165)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)
Caused by: java.io.IOException: Invalid argument
at java.net.PlainDatagramSocketImpl.send(Native Method)
at java.net.DatagramSocket.send(DatagramSocket.java:629)
at org.jgroups.protocols.UDP._send(UDP.java:352)
... 17 more

or
ERROR [MPING] failed sending discovery request

Solution:
https://jira.jboss.org/browse/JGRP-1161
https://jira.jboss.org/jira/browse/JGRP-777
https://jira.jboss.org/browse/JGRP-825
http://bugs.sun.com/bugdatabase/view_bug.do;:YfiG?bug_id=4701650


You will have to start multiple instances with the following option
jboss-eap-5.1/jboss-as/server/all/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml


./run.sh -c all -Djboss.service.binding.set=ports-01 -Djboss.messaging.ServerPeerID=1
./run.sh -c all -Djboss.service.binding.set=ports-02 -Djboss.messaging.ServerPeerID=2

See also:
JGroups ports and addresses: http://community.jboss.org/wiki/SystemProps

--------------------------------------------------------------------------------------
Starting 2 jboss instances on same machine

Problem:

ERROR [AbstractKernelController] Error installing to Start: name=jboss:database=localDB,service=Hypersonic state=Create mode=Manual requiredState=Installed
java.sql.SQLException: The database is already in use by another process: org.hsqldb.persist.NIOLockFile@79409313[file =/home/rbrackma/middleware/jboss-eap-5.1/jboss-as/server/all/data/hypersonic/localDB.lck, exists=true, locked=false, valid=false, fl =null]: java.lang.Exception: checkHeartbeat(): lock file [/home/rbrackma/middleware/jboss-eap-5.1/jboss-as/server/all/data/hypersonic/localDB.lck] is presumably locked by another process.
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.jdbcConnection.(Unknown Source)
at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
at org.hsqldb.jdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:620)

21 October 2010

Clustering JBoss 5 (porting Weblogic dizzyworld example)

Summary:
If you are coming from the Weblogic world you might have done training and seen the dizzyworld example, i.e. the example environment of at least Weblo 9,10 and 11.
In this post I will try to show some

Main post:


Troubleshooting when starting multiple JBoss instances on one machine (one binded to localhost, the other to your_hostname)
WARN [NAKACK] 55200 discarded message from non-member 55200, my view is ...

20 October 2010

Software patents a threat for innovation?

Lately many IT companies have been suing competitors for using their patents. Furthermore patent trolls (companies with the business model of buying patents and suing companies -- congratulations!) have been accreting and have been attacking companies.


Here some references on that:
http://www.networkworld.com/community/node/66807
http://fosspatents.blogspot.com
http://www.slideshare.net/MissionFuture/jan-wildeboer-open-source-presentation
http://en.wikipedia.org/wiki/Free_and_open_source_software

12 October 2010

Howto write JBoss Java MBeans to expose to a JMX Client

Summary:
Sometime you will find yourself in the situation of wanting to monitor your application, but no monitoring capability is given. So you will have to write your own Java MBean that will expose information of your JBoss application to a JMX Client.

Main post:
Examples: jboss-eap-4.3_CP08/jboss-as/docs/examples/jmx/logging-monitor
From the JBoss SVN you can get sample MBean classes:
/svn_jboss_org/trunk/varia/src/main/java/org/jboss/jmx/examples/configuration/

Have your MBean interface extend the org.jboss.system.Service and org.jboss.system.ServiceMBean interface.
org.jboss.system.Service and org.jboss.system.ServiceMBean can be found in:  
jboss-eap-4.3_CP08/jboss-as/server/all/deploy/management/console-mgr.sar/web-console.war/applet.jar


  • Add the classes















  • You can see two MBean that are almost the same (up to the fact that one extends the org.jboss.system.ServiceMBean class)
    1. 
    Attributes: JndiName
    Operations: start / stop
    2. 
    Extents the class org.jboss.system.ServiceMBean -- you can see that this class gives you out of the 
    Attributes: Name / JndiName / StateString / State
    Operations: destroy / start / stop /create / jbossInternalLifecycle
    Notificaitons

    Explanation on standard Java MBean like RuntimeMXBean, ThreadMXBean, MemoryPoolMXBean, ... can be found here: http://download.oracle.com/javase/1.5.0/docs/guide/management/overview.html

    Jacorb to be found in:
    eap43CP08/jboss-as/server/all/lib/jacorb.jar
    org.jacorb.util.threadpool.ThreadPool.class (here we have to get the information on the thread pool counter.
    In class ThreadPool within method createNewThread() the following line:
    localThread.setName(this.namePrefix + this.threadCount++);


    Jacorb example:
    http://www.jpackage.org/browser/rpm.php?jppversion=6.0&id=7709

    Set up environment:
    jboss-log4j.xml

    11 October 2010

    Troubleshooting JBoss Portal 4.3

    Problems that might occure while working with JBoss Portal:

    - Admin link is not visible (between Dashboard and Logout)







    That occurs when the admin is not in upper case in the LDAP. See the example of two *.ldif files. One works, the other does not.
    Does not work:
    dn: cn=admin,ou=Roles,o=rbrackma,dc=redhat,dc=com
    objectClass: top
    objectClass: groupOfNames
    cn: admin
    description: Administrators
    member: uid=admin,ou=People,o=rbrackma,dc=redhat,dc=com


    Works:
    dn: cn=Admin,ou=Roles,o=rbrackma,dc=redhat,dc=com
    objectClass: top
    objectClass: groupOfNames
    cn: Admin
    description: Administrators
    member: uid=admin,ou=People,o=rbrackma,dc=redhat,dc=com












    In the EPP logs you might also find another error:


    - ERROR [LDAPUserProfileModuleImpl] No such attribute ('title') in entry: uid=admin,ou=People,o=example,dc=jboss,dc=com
    LDAP is looking for the attribute title, but does not find it within the RHDS LDAP. Does not cause any problem within the system, but is annoying.

    07 October 2010

    Howto setup LDAP with Red Hat EPP (JBoss Portal / GateIn)

    Description:
    When you first start with Red Hat's Enterprise Portal Platform you will be able to connect to the portal with admin/admin or user/user. The credentials will be checked against the default users within the portals in-memory database HSQL. Mostly you would want the credentials to be checked against your companies LDAP.
    This post will cover setting up an LDAP and configuring EPP4.3 to use it.
    - Install LDAP
    - Start LDAP services
    - Setup LDAP
    - Install EPP4.3
    - Setup EPP4.3 to use LDAP for credentials
    - Connect to the portal http://localhost:8080/portal

    Main post:
    Install LDAP
    Before starting be aware that the only supported LDAP servers are:
    Red Hat Directory Server, OpenDS and OpenLDAP.

    Within this post the open source LDAP server "Red Hat Directory Server" will be used.
    Installing it is pretty straight forward.
    First install the software :
    sudo yum install 389-ds
    sudo yum install fedora-idm-console

    Then configure the RHDS with this document:
    http://www.scribd.com/doc/20555511/Fedora-Directory-LDAP-Server-Setup-Configuration-on-Linux-HowTo-v1-0
    If the document is not available call the following command line and follow the install instructions which are pretty straight forward
    # setup-ds-admin.pl

    At the End you should remember:
    Directory Manager: cn=Directory Manager
    Password: your_password
    Admin port: 9830
    LDAP port: 389

    Start LDAP services

    sudo service dirsrv start
    sudo service dirsrv-admin start
    sudo service httpd start

    Setup LDAP

    Run the earlier installed LDAP browser fedora-idm-console (you can use any other LDAP browser)
    $ fedora-idm-console

    Choose the Directory Server (1) and choose Open (2).










    Then you just have to choose 'Import Databases' and import a *.ldif (save the following text into a test.ldif file). After that you should be able to browse you LDAP tree in the Directory tab...


    dn: o=your_host,dc=your_domain,dc=com
    objectclass: top
    objectclass: dcObject
    objectclass: organization
    o: your_host
    dc: your_host
    dn: ou=People,o=your_host,dc=your_domain,dc=com
    objectclass: top
    objectclass: organizationalUnit
    ou: People
    dn: uid=admin,ou=People,o=your_host,dc=your_domain,dc=com
    objectclass: top
    objectclass: inetOrgPerson
    objectclass: person
    uid: admin
    cn: Administrator
    sn: Duke
    userPassword: admin
    mail: admin@your_host.your_domain.com
    dn: uid=user,ou=People,o=your_host,dc=your_domain,dc=com
    objectclass: top
    objectclass: inetOrgPerson
    objectclass: person
    uid: user
    cn: User
    sn: Sample
    userPassword: user
    mail: user@your_host.your_domain.com
    dn: uid=jduke,ou=People,o=your_host,dc=your_domain,dc=com
    objectclass: top
    objectclass: inetOrgPerson
    objectclass: person
    uid: jduke
    cn: Java
    sn: Duke
    userPassword: theduke
    mail: jduke@your_host.your_domain.com
    dn: ou=Roles,o=your_host,dc=your_domain,dc=com
    objectclass: top
    objectclass: organizationalUnit
    ou: Roles
    dn: cn=Admin,ou=Roles,o=your_host,dc=your_domain,dc=com
    objectClass: top
    objectClass: groupOfNames
    cn: Admin
    description: Administrators
    member: uid=admin,ou=People,o=your_host,dc=your_domain,dc=com
    dn: cn=User,ou=Roles,o=your_host,dc=your_domain,dc=com
    objectClass: top
    objectClass: groupOfNames
    cn: User
    description: Users
    member: uid=admin,ou=People,o=your_host,dc=your_domain,dc=com
    member: uid=user,ou=People,o=your_host,dc=your_domain,dc=com
    member: uid=jduke,ou=People,o=your_host,dc=your_domain,dc=com


    Install EPP4.3
    The installation of EPP4.3 is extremly simple.
    First download the jboss-epp-4.3.GA_CP0X-src.zip here. You will need a Red Hat login and a valid subscription to download, if you don't know why: I covered it in an earlier post.
    Then extract the zip file into the directory jboss-epp-4.3. That's it.


    Setup EPP4.3 to use LDAP for credentials
    You will have to change the following files in red to make LDAP work.






















    1. Within jboss-epp-4.3/jboss-as/server/default/deploy/jboss-portal.sar/META-INF/jboss-service.xml
    change

          conf/identity/identity-config.xml
    to
          conf/identity/ldap_identity-config.xml

    2. Within jboss-epp-4.3/jboss-as/server/default/deploy/jboss-portal.sar/conf/identity/ldap_identity-config.xml
    adapt the value tags that are linked to the following tags:
    host
    port
    adminPassword
    userCtxDN
    roleCtxDN
    (the be sure to choose the right value for userCtxDN and roleCtxDN connect to your LDAP browser and check the values)


    3. Within jboss-epp-4.3/jboss-as/server/default/deploy/jboss-portal.sar/conf/identity/standardidentity-config.xml

    adapt the value tags that are linked to the 5 tags seen in the section above.

    4. Within jboss-epp-4.3/jboss-as/server/default/deploy/jboss-portal.sar/conf/login-config.xml
    comment (do not use)
    login-module code="org.jboss.portal.identity.auth.IdentityLoginModule"
    uncomment (use)
    login-module code="org.jboss.portal.identity.auth.SynchronizingLDAPExtLoginModule"
    and adapt the variable to your configuration.
    Connect to the portal
    Now you should be able to connect to the portal:
    http://localhost:8080/portal
    with the user admin and password admin.
    The default HSQL database users that come with the portal out of the box are admin and user. After migrating to LDAP they will only work if you have configured your portal properly. For example you have the possibility to authenticate users against LDAP + DB or only against LDAP. In this post users are only authenicated against LDAP! And 3 users available are the ones imported into the LDAP with the *.ldif file: admin, user, jduke.


    If you still have problems check out the section "Troubleshooting JBoss Portal"

    16 September 2010

    Howto resize a partition

    Command line:
    [root]# df -m
    [root]# lvm
    (starts lvm command line)
    Within lvm command line:
    lvm> lvdisplay

    -- resize swap to 1G
    lvm> lvresize /dev/vg_f13v1/lv_swap --size 1G

    -- after the operation your LV size is:( LV Size  1.00 GiB)
    lvm> lvdisplay

    --now add all remaining free space
    lvresize -L +1.6GB /dev/vg_f13v1/lv_root

    --trigger the resizing process
    [root@f13-jon jon]# resize2fs -p /dev/vg_f13v1/lv_root

    06 September 2010

    sudo package-cleanup --cleandupes

    yum downgrade libvirt\*

    http://qemu-buch.de/d/Speichermedien/_Festplatten-Images_anderer_Virtualisierungssoftware/_VMware_Workstation

    02 September 2010

    virt-manager fails to reboot guests (no solution found yet)

    https://bugzilla.redhat.com/show_bug.cgi?id=496537
    https://bugzilla.redhat.com/show_bug.cgi?id=505719
    https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/368962

    Additional info:

    1. Error persists even if selinux is disabled.

    2. Error message in log :

    tail -F /var/log/messages

    libvirtd: 23:19:34.302: error : this function is not supported by the
    hypervisor: virDomainReboot

    tail -F /var/log/libvirt/qemu/guest.log

    Nothing.

    2. Shutdown does nothing , guest still running, no error message.

    3. Force off -> error message / warning -> restart guest is only option.

    01 September 2010

    Howto debug in Fedora

    If you happen to run into any sort of system error, or some application is not working properly within Fedora just check on the aggregated log file with the following command:
    tail -F /var/log/messages

    31 August 2010

    Easy file transfer

    • SCP
      scp /home/xxx/middleware/jon-server/test.txt root@192.168.100.150:/app/jon/bin
    • KDE - Dolphin
    fish://root@192.168.100.150
    fish://root@192.168.100.150/app/jon

    30 August 2010

    Get a Red Hat red hat












    http://redhat.brandfuelstores.com/index.php?main_page=index&cPath=2_17

    29 August 2010

    Writing start scripts for services in Fedora linux

    Howto manage your services and programs within Fedora

    1. Make your shell script executable
    All shell scripts in /usr/bin/ or /sbin/ can be executed anywhere within the command line
    Add a softlink into /sbin or /usr/bin

    $ cd /sbin
    $ ln -s /app/jon/bin/rhq-server.sh jon
    $ jon


    1.5. Start your shell script at startup by modifying

    Example:
    $ sudo vi /etc/rc.d/rc.local
    add:
    killall -9 knetworkmanager & qdbus org.kde.kded /kded unloadModule networkmanagement && nm-applet &

    2. Start your program easily via shell script
    If you have a shell that takes the standard arguments : start / stop / restart
    you can it into the repository /etc/init.d/.
    All scripts in /etc/init.d/ can be called with
    $ service my_script start
    For convenience use a softlink instead of copying it into /etc/init.d:
    $ cd /etc/init.d
    $ ln -s /app/jon/bin/rhq-server.sh jon
    $ service jon start

    3. Service registry within Fedora (the startup services)
    List all available services (/etc/init.d)
    $ chkconfig --list
    Start / stop the ssh daemon service
    $ chkconfig sshd start (or stop)
    Enable a service
    $ chkconfig --add ssh
    $ chkconfig sshd on
    Disable a service
    $ chkconfig sshd off
    $ chkconfig sshd --del
    If you you prefer a graphical interface for the service registry use
    $ system-config-services


























    4. Making an executable 'servicable'
    Create a file in /etc/init.d, here an example: shutter 
    #!/bin/sh
    #
    # shutter This script starts and stops the shutter daemon
    #
    # chkconfig: - 78 30
    # processname: shutter
    # description: shutter is a daemon process

    get_shutter_pid () {
       SHUTTERPID=$( ps aux --cols 1024 | grep "perl" | grep "/usr/bin/shutter" | awk '{ print $2 }' | head -n 1 )
    }

    PIDFILE=/var/run/shutter.pid

    # By default it's all good
    RETVAL=0

    BASE="/usr/bin"

    # See how we were called.
    case "$1" in
      start)
        # Start daemon.
        echo -n $"Starting shutter: "
        export DISPLAY=:0
        nohup ${BASE}/shutter > /dev/null &
            sleep 1
            get_shutter_pid
            echo -n ${SHUTTERPID} > ${PIDFILE}
            echo "Start Shutter : pid = ${SHUTTERPID}"
            ;;
      stop)
            # Stop daemons.
            get_shutter_pid
            if ! [ -z "${SHUTTERPID}" ] ; then
               echo "Stop Shutter : pid = ${SHUTTERPID}"
               kill "${SHUTTERPID}"
            fi
            ;;
      restart|force-reload)
            $0 stop
        sleep 8
            $0 start
            ;;
      status)
            get_shutter_pid
            if [ -z "${SHUTTERPID}" ] ; then
                echo "Shutter is stopped"
                exit 1
             else
                echo "Shutter (pid ${SHUTTERPID}) is being executed..."
                exit 0
             fi
        ;;
      *)
        echo "Usage: $0 {start|stop|restart|status}"
        RETVAL=1
        ;;
    esac

    exit $RETVAL

    27 August 2010

    Howto use JBoss Operation Network (JON) for your provisioning

    Post summary:
    This post will illustrate how you can set up a Red Hat middleware provisioning environment using Linux (Fedora), KVM (virtualisation), JBoss EAP (application server) and JBoss Operations Network (supervision) and Apache httpd (mod_cluster).
    A use case could be : JON detects that the an application deployed on EAP can not handle the charge any more and triggers the creation of a new virtual machine that contains a new JBoss EAP. Via a bundle the application is deployed in EAP who joins the cluster.


















    Main post :
    Here I more or less dumped the technical steps to follow without explaining step by steps (as it's a long post use ctrl+F to be happy)

    On host:
    • sudo service sshd start
    Connect to JON VM:
    • cd /app/script
    • ./initSshId.sh (removing the file /etc/.ssh/know_hosts might be necessary)
    • Creation of a soft link for your script from the JON/bin directory to the script directory. As you can see in the next screen shot, this will allow JON to discover automatically those scripts (without soft link you would need a plugin)
      cd  /app/jon/jon-server/bin
      ln -s /app/script/virsh-start.sh virsh-start.sh
            


















    26 August 2010

    KDE vs Gnome

    Summary:
    Having the Gnome desktop you want to try the KDE desktop  (or vice versa)

    Main post:

    • Download the kde packages
      sudo yum install kdm (this is only the startup manager)
      sudo yum install kde
    • Setting KDM as startup manager
      su -
      echo "DISPLAYMANAGER=KDE" > /etc/sysconfig/desktop
    • Choose your desktop environment
      switchdesk (switch from Gnome to KDE desk within your session)
    • Kill your XServer from console
      in Gnome:
      cd /etc/init.d/
      sudo gdm-stop
      in KDE:
      init 3
    • Start your XServer
      xstart

    Disable SELinux on Fedora 13

    • Edit the following file:
      sudo vi /etc/selinux/config
    • Replace
      SELINUX=enforcing with SELINUX=disabled

    • Stop X server
      telinit 3  (or within gnome gdm restart)
    • Start X server
      telinit 5

    24 August 2010

    My useful Linux commands

    Some Linux commands I find useful:

    Replace a string in all files recursively usind sed ( replaces repository.jboss.com with anonsvn.jboss.org/repos/repository.jboss.org)

    grep -rl repository.jboss.com . | xargs sed -i 's/repository.jboss.com/anonsvn.jboss.org\/repos\/repository.jboss.org/'

    Add launchers (*.desktop, icon - comment - name) here
    /usr/share/applications


    Find a file on the file system
    updatedb
    locate test.xml




    Find out which kernel you are using
    uname -r

    Find string "proxy" in all files
    sudo find . -type f -name "*" -exec grep -l "proxy" {} \;

    find . -name "*" -exec grep "proxy" {} \;      (donne tous les lignes avec Test_1)
    find . -name "*" -exec grep -l "proxy" {} \ ; (donne tous les fichiers avec Test)

    grep -r 'proxy' *

    Making a script executable
    chmod +x

    Finding all my files with string "myfile" including soft link references directories
    find . -user me -name *myfile* -follow


    Displaying directory structure
    ls -rtl bbb (-R subdirectories)


    Monitoring changes within a file
    tail -100 fichier
    tail -f file (monitoring)

    grep -F ‘abc efg’ (Leerstelle = OR)
    grep -i -n (line number) testChar file.txt

    grep « VALOTRACE= » `(Alt + Shift + 7) find .`


    cat fichier | grep blub
    Displays full path of file being executed
    which java

    grep valopurgesolde.x communs/ces/x (pour voir qu’est-ce que le processus fait)
    kill -9 -1 (killt das zuletzt angemeldete Konto)
    cd - (go to root)
    du -sk . (Wie viel Speicherplatz belegt)
    df -k (kilo) . (combien il reste sur le filesystem)
    ps -u valqua11  (kill -9 #1 #2)

    ln -s link name (ln -s ${HOME}/brackmann roli)
    Displaying all exports of the shell
    typeset
    Process keeps on running in background even when the executing shell is killed
    nohup your_command


    Gets the 4th columns of the server.log and deletes all the doubles


    cat server.log | awk '{ print $4; }' | sort -u > server4thcolumndistinct.log


    Deletes all temporary files followed by '~'
    find ./ -name '*~' | xargs rm

    19 August 2010

    Classloading JBoss

    Title : Web app is using embedded jars that exist already within JBoss

    Summary:
    First of all w
    JBoss class loading
    A college of mine has written a good article on class loading :
    The translated Noel Rocher

    Main post
        jboss-app.xml         <?xml version="1.0" encoding="utf-8"?>
            <jboss-app>
                <loader-repository>
                TestClassloaderJBossLR:loader=TestClassloaderJBoss.ear
                <loader-repository-config>java2ParentDelegation=true</loader-repository-config>
                </loader-repository>
            </jboss-app>   
        jboss-web.xml

            <?xml version="1.0" encoding="utf-8"?>
            <jboss-web>
                <!-- Mettre toute l'application soit dans le meme classloader (J2EE) -->
                <class-loading java2ClassLoadingCompliance="true"/>
            </jboss-web>
     

    Ever since version 4.0.2, JBoss is configured according to the J2EE specification, meaning that the default isolation of applications is the research in priority classes in the ClassLoader of the application.

    Specifying in the 2-descriptors jboss and jboss-web.xml app.xml attributes and java2ClassLoadingCompliance java2ParentDelegation = true = "true, you change this default behavior and return to as it was in JBoss 3.2, namely the use of a unified ClassLoader taking priority classes loaded first, so in your case those server applications.

    fsfdf

    16 August 2010

    Webservices within JBoss

    Summary:
    Web services give you the possibility of loosely coupling your different IT-systems. At least on the paper it seems that you can interchange either the client or server easily.
    Only after having changed either part for the first time you might realize that a new Web service implementation on one side means redeveloping also the other.

    Main post:
    When working with the Webservice stack of JBoss you will have to check on the version you are using, as there has been some changes over the years :

    http://community.jboss.org/wiki/WebServiceStacks


    Name File JBoss Version Status Supported
    API
    Based on
    JbossWS-3.x JbossWS Native
    3.1.2.SP3-patch-02
    jbossws.sar
    5.0+

    JEE 6 JAX-WS
    Apache CXF (not shipped with EAP)
    3.1.2.SP3
    5.0+ Supported JEE 6 (1) JAX-WS
    GlassFish Metro (not shipped with EAP) 5.0+

    JEE 6 JAX-WS
    JBossWS-2.x
    sources
    binaries
    jbossws.sar
    (2.0.1.SP2_CPxx)
    EAP 4.3 CPxx ??? JEE 5 JAX-WS
    JBossWS-1.x jbossws.sar
    (1.2.1.GA_CPxx+)
    EAP 4.2 CPxx ??? JEE 5 JAX-WS (2)
    JBossWS4EE jboss-ws4ee.sar < 4.0.4 Maintenance Only J2EE 1.4 Axis
    JBoss.NET jboss-net.sar 3.2.x End of Life Proprietary Axis


    (1) JDK 1.6 incorporates the JAXB reference implementation. However, it incorporates an old version of the RI. CXF does not support this version. As of 1.6_04, this is easy to deal with: you must put the versions of JAXB RI (the 'impl' and 'xjc' jars) that we include with CXF in your classpath. As of this writing, these are version 2.1.6.
    (2) Yes, JAXWS ... are supported all together starting from JBossWS-1.2.0.GA. Link








    Howto log within JBoss

    Main point of entry:
    http://docs.jboss.org/process-guide/en/html/logging.html

    12 August 2010

    Linux /boot partition problem (upgrading Fedora Linux)

    Summary:
    /boot partition too small when trying to upgrade Fedora 10 to 11, 11 to 12, 12 to 13, 13 to 14

    Main article:
    When not choosing a big enough /boot partition when setting up you Linux system you might get problems when wanting to upgrade to the next major Fedora release.
    Fedora (same with Ubuntu) will tell you that space on /boot is missing.
    Don't try lvm (Logic Volume Managment) it won't help you!

    You have the following possibilties
    1. Delete old kernel updates
    package-cleanup --oldkernels
    2. Empty trash
    du -sh .Trash-0
    3.
    tune2fs -m 0/dev/sda1

    11 August 2010

    Howto check your J2EE application

    http://j-francois.blogspot.com/2010/04/check-plateforme-jee.html

    Thunderbird & Lightning & Google Sync (compatibility 64 bit Linux)

    If you run Thunderbird on a 64 bit Linux system you might have tried the calendar add-on "Lightning" and maybe even the synchronization add-on "Provider for Google calendar".
    Linux (Ubuntu or Fedora) gets always the newest versions of Thunderbird via it's integrated package manager (Debian = apt-get; Red Hat = yum).
    If you have had the problem that "Not compatible with Thunderbird x.x.x" please note that you can help yourself by downloading both add-ons from this special link:
    1. Download specific Lightning
    http://releases.mozilla.org/pub/mozilla.org/calendar/lightning/releases/1.0b2rc3/contrib/linux-x86_64/lightning.xpi
    2. Download specific Provider for Google calendar

    http://releases.mozilla.org/pub/mozilla.org/calendar/lightning/releases/1.0b2rc3/contrib/linux-x86_64/gdata-provider.xpi
    1.0b2rc3 (change to latest appropriate version)
    3. Install downloaded add-ons
    Tools  Add-ons  Install  Choose the *.xpi  Restart Thunderbird

    Other usefull links:
    https://wiki.mozilla.org/Calendar:Lightning
    https://wiki.mozilla.org/Calendar:GDATA_Provider

    Adding CLASSPATH or JAVA_OPTS to JBoss


    Summary:
    This post shows howto add a new Java library (e.g. patched class) or a new Java startup option
    to JBoss running under Linux


    Main post:
    Adding Java library
    edit ./run.sh and add JBOSS_CLASSPATH="./lib/mypatchedJar.jar;$JBOSS_CLASSPATH"



    Adding Java startup option

    edit ./run.sh and add JAVA_OPTS="-D32 $JAVA_OPTS"

    07 August 2010

    Howto install JBoss JON Server

    Summary:
    This is my quick and dirty installation guide for a JON Server and a JON Agent

    Main post:
    Set up database
    - First you need to install a database (Oracle or PostGre are supported)

    - yum install postgresql postgresql-server
    (when using Fedora Linux, adapt for other distributions)

    Configure the new service to start automatically
    /sbin/chkconfig postgresql on


    service postgresql initdb

    change /var/lib/pgsql/data/postgresql.conf
    listen_addresses='*'




    http://www.postgresql.org/docs/9.0/static/auth-pg-hba-conf.html
    /var/lib/pgsql/data/pg_hba.conf
    host    all         all         0.0.0.0/0             trust

    (by default it is only allowed to receive request from localhost:
    host    all         all         127.0.0.1/32             trust)


    service postgresql stop
    service postgresql start


    - Create a user: rhqadmin (password: rhqadmin)
    http://docs.redhat.com/docs/en-US/JBoss_Operations_Network/2.4/html/Installation_Guide/JON_Server_Installation.html

    cd /var/lib/pgsql/data
    Create role rhqadmin: 
    createuser -h 127.0.0.1 -p 5432 -U postgres -S -D -R rhqadmin
    Create db rhq:
    createdb -h 127.0.0.1 -p 5432 -U postgres -O rhqadmin rhq
    (if you are using another machine to run your DB server make sure your SELinux is disabled)
    service iptables stop
    chkconfig iptables off


    Installing JON server
    Official Red Hat support
    • Unzip the downloaded JON-zip-file
    • $ cd /jon-server-2.x.x.GA/bin$ export JAVA_HOME=/usr/java/jdk1.6.0_05 $./rhq-server.sh start Trying to start the RHQ Server... RHQ Server (pid 14413) is starting
    • Goto http://localhost:7080/ (and click "Click here to continue the installation")


    Setting up JON database

    • Click "Install"







               
              Screenshot of some tables created during installation

               
                  Login with user rhqadmin (default password is rhqadmin)
                  Itis not the user/pw of the database!


    • A valid JBoss Operations Network license is required to use this software. Please click the Update License link below.
              
    • Get your license here: https://access.redhat.com/jbossnetwork/restricted/softwareDownloadJBNLicense.html
    • Click Browse ... and choose the downloaded xml license file. Click OK.




    • If you want rather a command line installation than a GUI based installation, you could have entered all data within  /bin/rhq-server.properties (use generate-db-password.sh to generate an encrypted password). After that just run JON server : /bin/rhq-server.sh start
    Installing the JBoss ON Agent
    Official link
    • Get the agent JAR by hitting http://localhost:7080/agentupdate/download
    • Save the rhq-enterprise-agent-3.0.0.GA.jar (~ 11 MB) to the directory your agent should be installed to
    • Run
      java -jar rhq-enterprise-agent-3.0.0.GA.jar --install
      which will create a rhq-agent directory
    • In the directory ./rhq-agent/bin run
      ./rhq-agent.sh --cleanconfig
    • After the first setup, start your agent with
      ./rhq-agent.sh
    Further references:
    More detailed installation steps you'll find here:

    http://amitbhayani.blogspot.com/
    http://pilhuhn.blogspot.com/2008/05/writing-rhq-plugin-part-1.html


    
    

    06 August 2010

    The open source problem - "Unfakeable Linux"

    Summary:
    This post covers the problem of companies that provide open source software
    Examples:
    Red Hat Enterprise Linux --> CentOS
    Red Hat Enterprise Linux --> Oracle Unbreakable Linux

    Main post:
    Open Source means anyone can take your source and redistribute it, as long as it is not sold.
    Furthermore
    CentOSOracle

    What can comanpanies do?
    1. Marketing
    Red Hat "Unfakeable Linux" advertisement - smart answer to Oracle's copy of RHEL

    05 August 2010

    Trying Java 7

    Summary:
    Being curious weather the new JConsole within JDK7 would still have problems connecting to JBoss JMX (check out older post), I gave a prerelease a shot and tried JDK7.


    Main post:
    Standard Edition 7 Binary Snapshot Releases

    July 29, 2010
    Build b103http://dlc.sun.com.edgesuite.net/jdk7/binaries/

    Clustering JBoss: mod_jk VS mod_jk2 VS mod_proxy


    Load balancing – JBoss Application Servers

    Web Connectors
    Apache version
    JBoss platforms
    Tomcat
    mod_jk 1.2.x
    Apache 2.
    EAP4.3


    mod_jk2
    JBoss EAP 4.2
    P2


    mod_proxy
    Apache 2.x (included in 2.2+)
    EAP3.x


    mod_cluster
    Apache 2.2.10+
    EAP 5.0.0+ & EWS 1.0+
    EAP 3 + 4 (not certified)
    Not certified