lundi mars 08, 2010

GlassFish without the IDE (quick survival guide)

This blog has moved to alexismp.wordpress.com
Follow the link for the most up-to-date version of this blog entry.

A lot of people experiment GlassFish for the first time via an IDE (most likely NetBeans, but maybe also with Eclipse) and feel a bit lost when it comes to use GlassFish without the tool driving it for them. So here are a few (mostly basic) CLI asadmin hints for GlassFish v3 :

* Start/Stop *
Start GlassFish (need this to access the admin console on default port http://localhost:4848) :
     % GLASSFISH_HOME/bin/asadmin start-domain     (assumes there's only one domain)
     % asadmin start-domain domain1     (explicitly reference a given domain)
     % asadmin start-domain -v domain     (will cause the log to be dumped to the standard output)
     % java -jar modules/glassfish.jar     (may be useful in certain circumstance (explicit java version for instance)

Stop GlassFish :
     % asadmin stop-domain {domain1}

List existing instances (including stopped/started status)
     % asadmin list-domains

You can also create additional domains with % asadmin create-domain ... (and I would suggest using the -portbase option).

* Resources *
If the IDE has created connection pools and datasources, you will certainly find the following create-jdbc-connection-pool and create-jdbc-resource commands useful. Note also that asadmin has a "closest match" feature for misspelled commands and extensive online documentation :
% ~/glassfishv3/bin/asadmin create
CLI001 Invalid Command: create
Closest matching local and remote command(s):
     create-admin-object
     create-audit-module
     create-auth-realm
     create-connector-connection-pool
     create-connector-resource
     create-connector-security-map
     create-connector-work-security-map
     create-custom-resource
     create-domain
     create-file-user
     create-http
     create-http-listener
     create-iiop-listener
     create-javamail-resource
     create-jdbc-connection-pool
     create-jdbc-resource
     create-jms-host
     create-jms-resource
     create-jmsdest
     create-jndi-resource
     create-jvm-options
     create-lifecycle-module
     create-message-security-provider
     create-network-listener
     create-password-alias
     create-profiler
     create-protocol
     create-resource-adapter-config
     create-resource-ref
     create-service
     create-ssl
     create-system-properties
     create-threadpool
     create-transport
     create-virtual-server

Almost every bits of configuration is located in the glassfish/domains/domain1/config/domain.xml config file but you really should be using asadmin or the admin console and not edit this by hand.

Starting with GlassFish 3.1, you can use "application-scoped resources" (see documentation, screencast). Such resources are created at deploy-time, usable only by the application they ship with and are destroyed upon undeploy.

* (auto)deployment *
The explicit deployment is based on the asadmin deploy app.{ear|war|jar} command. Listing deployed applications is as easy as asadmin list-application (notice how GlassFish tells you which containers are at work for a given app), and undeployment simply requires a asadmin undeploy app-name.

While these commands have lots of options (asadmin deploy --help for details), you may find it convenient to simply drop your application in the domain1/autodeploy directory. Deleting the file will trigger the undeployment.

All the details for the asadmin CLI can be found in the official "Using the asadmin Utility" documentation.

* JavaDB/Derby database *
If you'd like to move your tables and data from the JavaDB instance used in NetBeans to another one (maybe the one that ships with GlassFish), exporting the data and creating one from the backup is probably a good approach if you don't have SQL code to re-created it all. Look for "Backing up and restoring databases" in the Derby Admin Guide.

mardi mars 25, 2008

SDPY - NetBeans on a diet

Three years ago, I wrote a couple of blog entries ([1], [2]) about the impact of removing features from NetBeans (which was only available as a single bundle at the time) to bring it closer to java editors in memory consumption.

Nowadays, NetBeans comes in a variety of bundles, including some very lightweight ones such at the 26MB Java bundle, the 22 Ruby bundle, or even the 14MB C/C++ bundle. With JavaScript coming in 6.1 we might see even more bundles (although a JavaScript-only bundle wouldn't make a much sense IMO).

lundi déc. 03, 2007

NetBeans 6.0 disponible

NetBeans 6.0 est disponible en version finale. Félicitations à l'équipe!

C'est véritablement une version très importante pour plusieurs raisons. L'intégration de fonctionnalités dans un seul produit sans recherche de la bonne combinaison de plugins était déjà un élément différentiant pour NetBeans. Désormais, puisque tous les outils de développement de Sun sont open source, inutile de scinder l'offre en produits différents. Avec NetBeans 6.0, il n'y a même plus de "packs". Tout est une question de plugins choisis à l'installation ou au travers de l'update center.

Ainsi l'installeur peut varier de 11Mo à 169Mo. Je prends habituellement le bundle de 21MB (Java SE) et je rajoute les fonctions qui m'intéressent (Java EE Web, GlassFish, JAX-WS, WSDL, ...). Pour ce qui est des fonctionnalités supplémentaires, avec une offre complètement Libre, on trouvera de quoi faire du développement Swing (Matisse, désormais avec le support des JSR 295 et 296 pour le binding le l'application framework), Java ME (CLDC et CDC), le profiler, UML 2.0, support C/C++, support PHP, SOA (éditeur BPEL, mappeur XSLT, applications composites, etc.

Pour autant, il y a aussi beaucoup de nouveautés. En particulier l'éditeur de code a été complètement réécrit pour permettre de meilleurs refactorings, le support de nombreux langages au delà de Java et une utilisation d'écriteurs imbriqués (JavaScript dans JSP, Java dans PHP, ...). Il y a aussi le support de nouveaux langages et en particulier pour Ruby et/ou JRuby on Rails. JavaScript, PHP, Groovy et d'autres ne sont pas loin derrière.

Pour autant il existe de nombreux plugins pour étendre les fonctionalités de NetBeans 6.0: GWT, Maven, DTrace, JavaFX, JAX-RS/Jersey, WebLogic, WebSphere, Mercurial, import projets Eclipse/JBuilder, JMeter, JasperReport, Scala, Echo2, Facelets, Tapestry, Grails, Wicket, OpenOffice, etc...

Quelques liens pour aller plus loin:
• http://www.netbeans.org/features/ide/index.html
• http://www.netbeans.org/features/ide/editor.html

• http://www.netbeans.org/features/web/java-ee.html
• http://www.netbeans.org/features/web/web-app.html
• http://www.netbeans.org/features/web/web-services.html
• http://www.netbeans.org/features/soa/wsdl-xml.html
• http://www.netbeans.org/features/soa/index.html

lundi nov. 26, 2007

NetBeans 6 fcs pretty soon now

I like having the community vote before shipping a major release. Sounds like NetBeans 6.0 Final is around the corner now... If anything, this one is a major release.

About

This blog has moved

Alexis Moussine-Pouchkine's Weblog

GlassFish - Stay Connected

Search

Archives
« avril 2014
lun.mar.mer.jeu.ven.sam.dim.
 
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
Blogroll

No bookmarks in folder

News

No bookmarks in folder