Thursday May 27, 2010

Embedded GlassFish 3.1

We are now actively working on the upcoming release of embedded GlassFish 3.1. The Embedded One Pager captures the details of our plans for the next release. We also plan to finalize the Embedded API. If you have any feedback on the one pager or the API, send your comments to embedded@glassfish.dev.java.net or dev@glassfish.dev.java.net.

If you have a specific interesting project around a new use case for embedded API, I might be able to spend some time to help you with your POC. Please drop me a line at siraj.ghaffar@oracle.com

Thursday Dec 10, 2009

Using maven plugin for v3 embedded glassfish

The final version of Glassfish V3 is now available for download. It contains an embedded API that allows users to to create a customized, integrated solution within a single JVM.

One of the ways the embedded feature could be used is through maven. A maven plugin exists specifically for embedded glassfish. It allows a simple way to use the various embedded features.

Following are the maven goals supported by the plugin :

embedded-glasfish:run - starts the embedded server if it is not already running and deploys the specfied application. The goal keeps the server running, so the user can make changes in the application, reploy and test iteratively.

embedded-glassfish:start - starts the embedded server with the specified parameters

embedded-glassfish:deploy - deploys the specified application

embedded-glassfish:undeploy - undeploys the application identified by the "name" parameter. If no name is specifed all applications are undeployed.

embedded-glassfish:stop - stops the embedded server

embedded-glassfish:admin - executes the specified admin command on the embedded server. For example, you could create a jdbc resource.

A sample pom.xml snippet that would execute the run goal :


<plugins>
<plugin>
<groupId>org.glassfish</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<version>3.0</version>
<configuration>
<goalPrefix>glassfish</goalPrefix>
<app>test.war</app>
<port>8080</port>
<contextRoot>test</contextRoot>
</configuration>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>run</goal
</goals>
</execution>
</executions>
</plugin>
</plugins>

Friday Sep 04, 2009

Using Embedded GlassFish APIs

We have been making good progress on the embedded GlasFish for the V3 final release.

Here I will talk a bit about some of the basic embedded APIs that you can use.

The org.glassfish.api.embedded.Server object lets you perform lifecycle operations on the embedded server. It can be configured using the corresponding Builder object. For example :

// get the server builder
Server.Builder builder = new Server.Builder("test");

If you have a a preconfigured domain.xml that you want to use, you can do something like this :
// get the builder for EmbeddedFileSystem
EmbeddedFileSystem.Builder efsb = new EmbeddedFileSystem.Builder();
// specify the domain.xml location
efsb.configurationFile("myExistingdomain.xml");
EmbeddedFileSystem efs = efsb.build();
builder.embeddedFileSystem(efs);

You could also specify the install root of the server and the instance(or domain) root to the EmbeddedFileSystem.Builder. For example, you can specify the installRoot using
efsb.installRoot("installRootDirectory", true);

Then create the server object
Server server = builder.build();
You don't have to specify the EmbeddedFileSystem - if you don't specify it a temporary file system would be created automatically and used.
You can then specify the containers that you want to use. For example for web container,
ContainerBuilder b = server.getConfig(ContainerBuilder.Type.web);
server.addContainer(b);
You can also specify the port that you want to use. For example,
server.createPort(8989);
server.start();


The next interesting thing to do would be to deploy applications to it. For example, if you are deploying a packaged web app, hello.war, you can do this :
EmbeddedDeployer deployer = server.getDeployer();
DeployCommandParameters cmdParams = new DeployCommandParameters();
cmdParams.name = "appname";
cmdParams.contextRoot = "hello";

deployer.deploy("hello.war", cmdParams);

Now your application is running on the embedded server.

You can undeploy like this :
deployer.undeploy("appname");
To stop the server,
server.stop();

Monday Feb 09, 2009

GlassFish Performance Advisor - Log Entry Alert

In this blog, I would like to talk about the "Log Entry Alert", one of the useful features of the GlassFish Performance Advisor.

The Log Entry Alert sends an email alert whenever there is an entry in the application server's log file for user-specified logger(s) at user specified level. The logger could be one of the predefined application server logger or it could be any logger that your application uses. So this feature can be particularly useful when user applications want to send out email to users or admninistrators, in certain conditions.

For example, consider the case when someone tries to login to your application and the authentication fails for a certain number of times. You may want to be alerted when this happens. Your application could log this in the application server's log file at the WARNING level in a logger of your choice, say com.xyz.mylogger. You can configure the Performance Advisor to send out an email alert when there is a log entry at WARNING level in the logger com.xyz.mylogger. And that's it!

Once you have the Performance advisor setup and running, go to the admin console and click on Management Rules->LogEntry Alert. This is the Log Entry Alert configuration screen that you will see :



Log Entry Configuration

In the above screen you specify the log level and the logger name for which you want to be alerted. You could specify multiple loggers, separating them by commas. For example, if you want to be alerted when a WARNING level entry takes place for loggers com.xyz.logger1 and com.xyz.logger2, you specify "com.xyz.logger1,com.xys.logger2" in the logger names field. If you want to be alerted for all loggers just enter "\*".

Besides that, you need to specify the email address of the recipient and other email settings. You can either use the JavaMail Resource or specify other email values to get the email going. At the bottom of the screen, you can specify the targets for which you want to set up this alert.

GlassFish Performance Advisor - Managing Rotated Log Files

In this blog, I would like to talk about setting up and using the log rotation management features of the GlassFish Performance Advisor.

The GlassFish application server allows users to configure the logger settings in such a way that the server would automatically rotate log files, when certain user-configurable conditions are met. This typically happens when the log file exceeds a certain size. Over a period of time, you could end up with a number of rotated log files. The Log Rotation Manager feature of the Performance Advisor lets you manage the rotated log files.

To set up the Log Rotation Manager, click on the Performance Advisor->Management Rules->Log Rotation Manager node on the admin console. This is how the screen to set up the Log Rotation Manager looks like :



Rotated Log Management

In the above screen you can specify whether you want to move the rotated log files to a different directory(typically, for archiving) or delete the files. The Rotation Policy can be one of the three options : Number Of Files, Size or Time. I'll explain these 3 options below.

Number Of Files : When you select this option, the Log Rotation Manager will periodically check the log directory and if the number of log files exceeds the user configured number of files, the log files are either delete or moved to a different directory. So for example, if you chose the "NumberOfFiles" rotation policy option and set the NumberOfFiles to 3, the server will move or delete rotated files, when their number exceeds 3, so there are no more than 3 rotated log files in the log directory.

Size : When you select this option, the Log Rotation Manager will periodically check the log directory and if the total size of log files exceeds the user configured size, the log files are either delete or moved to a different directory. So for example, if you chose the "Size" rotation policy option and set the Size limit to 100 MB, the server will move or delete rotated files, when their total size exceeds 100MB, so the total size of rotated log files does not exceed 100 MB.

Time : When you select this option, the Log Rotation Manager will periodically check the log directory and if there are any files older than the specified time, they are moved or deleted.

The Log Rotation Manager can be setup on any instance or cluster. From the admingui, all you need to do is select the list of targets for which you want set this rule up and the rest will be taken care of by the Performance Advisor.

GlassFish Performance Advisor - Install and setup

The recently announced "GlassFish Enterprise Manager" has a number of cool features. In this blog I will introduce one of the interesting features, called the Performance Advisor and talk about how to install it and set it up.

As the name suggests, the Performance Advisor is designed to help users improve the performance of the application server. It does so in various ways :

  • Adjust the configuration settings in domain.xml to improve performance, based on the specific installation. This is discussed in more detail in a description of the Static Tuner.
  • Monitor various user configurable aspects of the system and alert the user when a potential problem is detected. You can find some examples here.
  • Automatically configure the settings of a running server instance, based on load and performance characteristics, observed while the server is running. An example would be the JDBC Pool Configuration.

    With this brief introduction, I will talk about how to install and set up the Performance Advisor.

    The Performance Advisor is available as a patch from SunSolve, look for patch id 140751. After downloading the patch do these steps :

  • Extract PerformanceAdvisor.jar and copy it into <glassfish-install>/lib directory.
  • Restart Domain Admin Server (DAS). The Performance Advisor is now installed and ready to be configured
  • Access the Admin Console (typically at <host>:4848) from your favorite browser.

    The "Performance Advisor" node will appear in the tree in the left frame of the console. This is how it would look like :

    Performance Advisor in Admin Console

    The Performance Advisor node consists of two parts -

  • Management rules
  • Static Tuner.

    Click on the Static Tuner to configure the domain.xml based on your installation. This is how the Static Tuner screen looks like : Static Tuner

    Click on "Management Rules". You will see a number of rules that can be configured to monitor various aspects of the running instance :

    Performance Advisor in Admin Console
    You can set up the advisor rules on different instances and clusters. After setting those up, you will need to restart the instances and clusters.

  • Thursday Feb 07, 2008

    Latest version of Java Application Platform SDK is released

    Download Java EE SDK I am happy to announce the availability of Update 4 of the Java Application Platform SDK .

    So what exactly is the Application Platform SDK? Well, there are a few similar sounding SDKs, and it gets all confusing. So I have summarized what these different bundles include :

    JavaEE5 SDK : Sun Java Application Server(aka Glassfish) + API doc + tutorial + Blueprints + Samples (+ Optionally, Java SE)

    Java Application Platform SDK : JavaEE5 SDK + PortletContainer + Open ESB + Access Manager

    The Tools Bundle includes the NetBeans IDE and the Portal Pack as well. This all is made clearer in the new downloads page.

    Back the Application Platform SDK - the latest update includes updated versions of Sun Java Application Server, Java SE, Access Manager, Open ESB and the Portlet Container.

    A little more detail on all the different components of the SDK :

    Sun Java System Application Server 9.1 Update 1 : Sun's supported distribution of GlassFish v2 Update Release (UR) 1

    Java SE 6 (JDK) Update 4 : includes the Java Runtime Environment (JRE) and command-line development tools for producing applets and applications.

    Sun Java System Access Manager 7.1 Patch 1 : a security foundation that manages secure access to an enterprise's web applications.

    Open ESB V2 : Java Business Integration (JBI)-based platform for delivering composite applications on a service-oriented architecture.

    Portlet Container 1.0.2 : implements the Java Portlet Specification (JSR 168), a standard for developing portal components, and provides a portlet driver, a lightweight portlet rendering environment.

    Java EE 5 Samples : demonstrate the technologies and features specific to Java EE 5, including annotations, Enterprise JavaBeans 3.0, persistence, security, web services and more.

    Java BluePrints define the application programming model for end-to-end solutions using the Java EE platform.

    Tutorial : The FirstCup tutorial is an Introduction to the Java EE Platform to help you understand Java EE basics and then build and deploy multitiered Java EE applications.

    API documentation(Javadocs) details all the classes and packages in the Java EE 5 SDK.

    Also included in the tools bundle is the NetBeans IDE , an open-source Integrated Development Environment for building desktop, enterprise, web, and mobile applications in Java, C/C++, and even Ruby.

    So go ahead with the free download. You can always share your comments or see what others think, at the SDK forum

    Wednesday Jan 16, 2008

    Atlanta Sun Tech Days

    I attended the Sun Tech Days event in Atlanta last week on Jan 9th and 10th. The developer focused event attracted a large crowd - several hundred people showed up. I managed the GlassFish booth both these days and met a lot of people, mostly developers. Many of them had downloaded GF and had done some development work on it, some were using it in production and others were just curious. Overall, most people knew something or the other about GF but many did not realize it was free to use in production.

    Things people repeatedly praised :
    \* Price. People were happy with the simple support pricing structure too.
    \* Netbeans tool integration - "Works great and is free!" was the comment of someone from a startup.
    \* Admin console layout - easy to use and manage. Specially a lot of JBOSS users like the GF administration console
    \* Installation ease


    Some of the questions were :

    \* What is an application server?
    \* What is the difference between an application server and a web server?
    \* I am using Tomcat. What is the benefit of using GlassFish over Tomcat?
    \* We use JBOSS in our company. How does GF compare with JBOSS?
    \* What's the difference between GlassFish and Sun Java System Application Server?
    \* How do I do a multi-machine cluster setup?
    \* How do I do load-balancing?
    \* How do I monitor? How do I know what's wrong when things dont work as expected.
    Lots of people wanted to know about monitoring.
    \* Do you have a migration tool? I am interested in trying out GF, but we have a large deployment on IBM Websphere.
    \* Is there a GF plugin for IntelliJ IDE?
    \* How does EJB entity caching work with GF? I looked for it but didnt see any option.
    \* I wanted to define payload policies for webservices but didnt see a way to do it. How do do it?
    \* Does GF come with a JBI runtime? Or do I have to get something separately?
    \* If GF is such a great appserver, why is Sun giving this away for free?


    Overall it was an exciting event. Great to see the growing interest in GlassFish.

    Monday Feb 27, 2006

    Using blojsom with GlassFish

    I was looking at popular blogging tools available out there and tried out blojsom, on GlassFish. Blojsom is a java based blogging package, designed to run on an application server. Using GlassFish as the application server turned out to be a fairly straightforward exercise.

    I downloaded build b38 of Glassfish and then followed the instructions at GlassFish Quick Start Guide to start the server and deploy an application

    After installing Glassfish, I downloaded blojsom which is packaged as a web app. Then I copied blojsom.war to GlassFish's autodeploy directory, <glassfish-install-dir>/domains/domain1/autodeploy. I then pointed the browser to http://localhost:8080/blojsom/blog/default and was able to access the blojsom application. To log into blojsom, I went to http://localhost:8080/blojsom/blog/default/?flavor=admin (username "default", password "123default456"). Then I added some categories and blog entries.

    I also added some users by modifying
    <glassfish-install-dir>\\domains\\domain1\\applications\\j2ee-modules\\blojsom\\WEB-INF\\ default\\authorization.properties
    file and gave permissions to these users by modifying
    <glassfish-install-dir>\\domains\\domain1\\applications\\j2ee-modules\\blojsom\\WEB-INF\\ default\\permissions.properties
    file. I did all this by following instructions in blojsom configuration guide


    About

    sirajg

    Search

    Categories
    Archives
    « April 2014
    SunMonTueWedThuFriSat
      
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
       
           
    Today