Developers, Developers, Developers! Maksim Sorokin IT Blog

13Nov/10Off

GlassFish v3 Windows Service

GlassFish v3 provides a way to create a service. However, one may encounter the following problem:

C:\Sun\glassfishv3\glassfish\bin>asadmin create-service
Error while trying to install GlassFish as a Windows Service.
The return value was: -1073741515.
STDERR:
STDOUT:
Usage: asadmin [asadmin-utility-options] create-service [--name ]
        [--serviceproperties ]
        [--dry-run[=]]
        [--force[=]] [--domaindir ]
        [-?|--help[=]] [domain_name]
Command create-service failed.

To fix this problem you need to install Microsoft .NET Framework Version 2.0 Redistributable Package (x86). After installing you don't event need to reboot machine. Just run asadmin create-service again:

C:\Sun\glassfishv3\glassfish\bin>asadmin create-service
Found the Windows Service and successfully uninstalled it.
The Windows Service was created successfully.  It is ready to be started.  Here
are the details:
ID of the service: domain1
Display Name of the service:domain1 GlassFish Server
Domain Directory: C:\Sun\glassfishv3\glassfish\domains\domain1
Configuration file for Windows Services Wrapper: C:\Sun\glassfishv3\glassfish\do
mains\domain1\bin\domain1Service.xml
The service can be controlled using the Windows Services Manager or you can use
the
Windows Services Wrapper instead:
Start Command:  C:\Sun\glassfishv3\glassfish\domains\domain1\bin\domain1Service.
exe  start
Stop Command:   C:\Sun\glassfishv3\glassfish\domains\domain1\bin\domain1Service.
exe  stop
Uninstall Command:  C:\Sun\glassfishv3\glassfish\domains\domain1\bin\domain1Serv
ice.exe  uninstall
Install Command:  C:\Sun\glassfishv3\glassfish\domains\domain1\bin\domain1Servic
e.exe  install

This message is also available in a file named PlatformServices.log in the domai
n's root directory
Command create-service executed successfully.
13Oct/10Off

Basic Authentication in GlassFish 3

Here is asmall basic authentication how-to for a web application in GlassFish 3.

Open GlassFish Administrative Console. Go to

28Aug/10Off

[PACKT] Java EE 6 with GlassFish 3 Application Server

Java EE 6 with GlassFish 3 Application Server is another nice book from PACKT publishing.

It covers GlassFish administration. Then it talks about Java web technologies -- servlets, JSP, JSP STL, JSF. Also discusses database connections, Java Messaging Service, security of applications (you can find more about it in GlassFish Security book). The books also talks about EJBs and new possibilities in Java EE 6 -- contexts and dependency injection. In the last part it discusses JAX-WS and JAX-RS web services. And everything is accompanied with information how to do that with GlassFish application server.

I would very much recommend it to novice Java EE developers or just to developers, who want to have a glance on Java EE web technologies, JMS, Java EE 6 dependency injection, web services and how all that is configured in GlassFish application server. I would say, it is a crash course into Java EE.

The book is not covering each section is deep detail. But gives a broad view on different Java EE possibilities.

The book is full of working examples! What I very much like about it, is that it not only talks about the latest Java EE 6 technologies. But also briefly covers how application can be configured in order to work with older standards.

12Aug/10Off

[PACKT] Java EE 6 with GlassFish 3 Application Server

Just received my new PACKT book Java EE 6 with GlassFish 3 Application Server.

From the table of contents I conclude that this book gives quite broad view on Java EE technologies and how to use them with GlassFish v3 application server. Although it is not covering some particular technology very detailed.

First chapter is about GlassFish -- how to setup it and configure. The following ones are about Java web technologies: servlets, JavaServer Pages, JSP Standard Tag Library, JavaServer Faces. Next, books talks about Java Messaging Service and security. Last chapter are the most interesting, in my opinion: Enterprise JavaBeans, Contexts and Dependency Injection and Web Services.

Anxious to read it!

25Jul/10Off

GlassFish Security [PACKT]

GlassFish Security by PACKT is lying on my table. What I can say about it? Pretty nice book about security. I still wonder, why it has name "GlassFish" in the title. It covers a lot of interesting topics about Java EE security and talks about other software, which can help to secure Java applications, such as OpenDS or OpenSSO.

So if you are just about to design or develop complex Java EE application, I would recommend to take a look into this book to at least grasp the ideas about security management. Beside this, book also covers topics of easy security policies migration, which also may be somewhat interesting in our changing world.

And again, thanks PACKT for publishing yet another wonderful book!

3Jul/10Off

Enable Directory Listings in GlassFish

There is a default-web.xml file in GlassFish which configure some stuff behind the scenes. This file can be found in domains->domain->config folder.

By default, in GlassFish v3 directory listing is disabled. But one can easily enable it by modifying default-web.xml file:

<init-param>
  <param-name>debug</param-name>
  <param-value>0</param-value>
</init-param>

Or if there is no possibility to modify the default-web.xml directly,

1Jul/10Off

GlassFish 3.0.1 Released!

Actually, while I was messing around with other stuff, I didn't notice, that new GlassFish v3.0.1 was released! Finally, there is a possibility to migrate from nightly builds and use more stable version.

29Jun/10Off

Changing GlassFish Port Number with asadmin

It's easy to change GlassFish port number through Administration Console. But how to do it through command line? Yes, we have asadmin utility. But there is no obvious way to "reconfigure" existing network listener..

But here is a possible

25May/10Off

Masoud Kalali and Java EE Security

Guess who wrote recent DZone Refcardz #99. It was the same guy, who wrote GlassFish Security> book. His name is Masoud Kalali and he has own blog about Java.

21May/10Off

java.lang.NoClassDefFoundError: Files

If you encounter the following kind of Exception, you probably