Category: java

  • Java EE6 Stress test by Adam Bien

    Interesting thing about system.out.println how huge bottleneck it creates being used while asking db through RESTful webservice. This article pushed me to experiment by my own with VisualVM and JMeter. Both are great tools.

    (About VisualVM, yesterday I’ve made a complaint about it, but today I’ve got notification to upgrade Visual sampler what really helped and turned this tool into very handy stuff;)

  • Glassfish, jmx, jconsole, apps active sessions

    We put lately more attention to monitoring and tuning our systems – mainly db.  I tried to refresh in mind how to check active sessions on jvm for specified app. I’ve experimented with VisualVM, but it didn’t satisfied me. I simply does not work out-of-the-box. After registering jmx remote host, I could not expand apps list…

    I need something more standard and working then that. I’ve run “jconsole”  (attached to each jdk copy).

    Then I’ve connected to:  myFavouriteAppsserver.com:8686

    and under the path: com.sun.appserv/Manager/myAwesomeAppName/server/Attributes

    I’ve found to variables: activeSessions and sessionCount. Take a look

  • Keep your WSDL files updated

    A quick remark for the future that is worth to remember. I suppose there is one of good coding principles to keep your imported WSDL files up-to-date.

    I was writing distributed ticket handling system. I needed some stateful service for this. I’ve implemented this storage with database behind and ejb-webservice as endpoint. While I was coding I’ve wrote module for creating, modifying and closing ticket in natural order. For every action I wrote separate module. During  implementation (after having done first two modules) I’ve implemented a new method in ejb-webservice what changed it’s WSDL file which I’ve used in the third module (but having not updated first two). You could imagine that this is wrong. My app server (glassfish) [I suppose] creates one wsdl file in memory for one endpoint so there is no possible way to keep two different versions of it (one with additional method and one without). Of course before that deployment and compilation were fine. This issue turned out while testers went through test scenarios.

     

  • Glassfish ESB, Resolving “localhost” in WSDL

    I wrote an composite application with webservice as entrance endpoint for client system. When I was previewing the wsdl file I’ve notice there is only host name without full domain name(as it is in DNS servers) give in schema location and webservice endpoint.  That was obviously wrong, because client would not be able to resolve those adresses. I remember I had this issue one in the past. After a talk with my friend I’ve decided to search resolution with operation system Solaris 10 then with application server.

    The resolution of this problem is easy and strange. Maybe because Glassfish is very sensitive?

    1. Let’s say my host is called tiger. My domain name is mycompany.com. In schema address I saw:
      schemaLocation=”http://tiger:9080/myAwesomeWebservice/schema.xsd”
      and it should be
      schemaLocation=”http://tiger.mycompany.com:9080/myAwesomeWebservice/schema.xsd”
      something was missing.
    2.  To fix this you should edit /etc/hosts and change order of strings
      before I’ve got:
      127.0.01 tiger tiger.mycompany.com
      after I’ve got:
      127.0.0.1 tiger.mycompany.com tiger

    That fixed my problem. I hope it won’t break anything else. I suppose only glassfish is so strict about the names of hostname.

  • Solution in Git repo

    Hi, for your convenience I’ve put that sample code on git repo. You can download it, experiment with it, learn etc. I suppose it will be easier for you getting it from github then waiting for an email from me.

    Cheers