Add users to Jboss Management Realm

In my previous post. , I have explained out the way to build out your wsdl for default configurations. To verify other applications or wsdl or to check logs, you can actually look into the admin-console of the Jboss. Although in dev and/or test environments, you might have to reason with the build masters to get an username/password, there is no reason why you cannot monitor it in your computers.

In Jboss AS, you can just hit http://localhost:8080/admin-console and it will take you there. Instead, you can hit http://localhost:8080 and click on Administration Console.

In Jboss EAP, there are security features which will not let you inside the console without permissions. A little on this. There are actually two types of users,

  • Management User(mgmt-users.properties): Management Level User ( an admin user)
  • Application User(application-users.properties): This is an App level user. When you add such a user, their scope will be limited to the application level only. However using the add-user utility, the user role can be mentioned.

Add-user utility
For Windows:

  1. Open cmd and navigate to the folder of jboss.
  2. Type add-user.bat
  3. To add a Management user, Enter “a”
  4. Hit enter for default management user (or type in Application User)
  5. Enter username and password(One number and special char compulsory)

For *ix:

  1. Open terminal and navigate to the folder of jboss.
  2. Type ./add-user.sh
  3. To add a Management user, Enter “a”
  4. Hit enter for default management user (or type in Application User)
  5. Enter username and password(One number and special char compulsory)

Writing your first webservice with Jboss EAP and checking out your first wsdl

I have been trying very hard to learn to produce and consume webservices on Jboss Application Server and frankly it was not easy. It is not easy because, for a newbie like me, there are no straight answers on the web at all. So I am providing all the information here which might be helpful to anybody.

It took a while ( a long while) to figure out which Jboss AS goes with JbossWS. As far as I understood, you have to install both to work with webservices on JbossAS. Although I figured out all the correct versions, the AS refused to start with a peculiar error( which I dont remember and neither bother to look) and frustrated me over two days. JBoss however was kind enough to give a free download of its EAP server which I guess is a production level server and encompasses AS and WS components.

So, everybody, do yourself a favor and use the EAP.

  1.  Download and unarchive and save the EAP at a safe place. (Set up the JBOSS_HOME environment variable to the path where you saved the jboss in Windows).
  2. Download Eclipse and set the classpath and JAVA_HOME. There are many tutorials for this just in case you need it.
  3. Create a new dynamic web project in eclipse.
  4. Add the jboss server to the servers.
  5. Create a webpage, index.html in WebContent folder of the dynamic web project.
  6. Add the project to the server and start the server.
  7. Check if the webpage is up and running.
  8. Write a POJO. I wrote a very very simple one and here it is.
  9. ServiceOne.java

    package org.test;

    import javax.jws.WebService;

    @WebService(name=”testPortName”)
    public class ServiceOne {

    public int add(int a,int b){
    return a+b;
    }
    }

  10. Restart the server and check the webpage again to see if everything is working correctly or not.
  11. So far everything seems nice, but the fun starts now. There is no easy way to check the wsdl you just created.Either you have to log into the admin-console to check the url of the wsdl or you have construct one based on the classes.
  12. Assuming you are using a similar POJO with default configurations for wsdl, the url is http://localhost:8080/TestService/ServiceOne?wsdl
  13. TestService here stands for the name of the dynamic web project
    ServiceOne is the name of the javaclass