Sunday Sep 19, 2010

IDE Feature, now available from the command-line

Folks that use NetBeans and GlassFish together have enjoyed the benefits of having the IDE automatically register and update resources for many years. This is one of the features that folks doing command-line based deployment have requested for many years, too. For those folks that have been waiting, I have good news. The feature is in GlassFish Server 3.1, though it is going by the name Application Scoped Resources. Jagadish provides a lot of details about application scoped resources and Alexis produced a screen cast that demonstrates application scoped resources.

After seeing all their hard work, I decided to see how I could support the feature in NetBeans.

We have been creating a file called sun-resources.xml to persist resource definitions in NetBeans for awhile. I recently made the changes necessary to start naming that file glassfish-resources.xml when a project targets GlassFish Server 3.1.

The file is currently used by the IDE to drive its automatic resource registration, if it is present in the 'Server Resources' logical folder for a project when the project is deployed. Move this file to someplace else to prevent the IDE from creating and updating resources. If you Cut the file out of the Server Resources logical folder and Paste it into

  1. the WEB-INF folder under the 'Web Pages' logical folder, you will have a Web Application project that leverages application scoped resources, OR
  2. the 'Configuration Files' logical folder, you will have an EJB Module or Enterprise Application project that leveraged application scoped resources,


Two projects, transformed to leverage application scoped resources.

The IDE doesn't do the resource registration and updates after this change. The server will when the app is deployed.

IDE features that would update the glassfish-resources.xml file will update the file in its new location after you have moved it out of the 'Server Resources' logical folder, automatically.

If you use JPA, you need to make one change to the persistence.xml file that is generated by NetBeans when you create your entity beans. You will need to change the value of the jta-data-source element. For example, if your persistence.xml says

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" 
        xmlns="http://java.sun.com/xml/ns/persistence" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
  <persistence-unit name="EJBModule23PU" transaction-type="JTA">
    <jta-data-source>jdbc/myJDBCresource
    <properties/>
  </persistence-unit>
</persistence>
you will need to change it to say
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" 
       xmlns="http://java.sun.com/xml/ns/persistence" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
  <persistence-unit name="EJBModule23PU" transaction-type="JTA">
    <jta-data-source>java:app/jdbc/myJDBCresource
    <properties/>
  </persistence-unit>
</persistence>

If you use JDBC directly in your code, you will need to make sure that you create a glassfish specific deployment descriptor to map the logical JDBC resource to the actual resource's JNDI name.

I have to admit, none of this would work without the hard work that Jagadish and Mitesh had to do to in the server code to get this feature working. Thanks guys. You rock.

You can start to leverage application scoped resources in modules and apps that use JPA on GlassFish Server 3.1 promoted builds 20 (and higher).

Monday Jul 19, 2010

Restart a remote server in debug mode

Byron recently integrated a neat new feature into the GlassFish Server 3.1 code: support for restarting a server in debug mode with a single command. He did this by adding a new boolean option onto asadmin's subcommand "restart-domain". The new option is "--debug" and will usually appear as "--debug=true" or "--debug=false".

Folks should note that restart-domain also works with remote instances, so this allows you to restart a remote instance in debug mode without having to telnet/ssh/whatever onto that machine.

I have leveraged this new feature in the GlassFish Server integration module for NetBeans. Here are some of the changes that have been made:

  • Remote GlassFish Server 3.1 domains do not automatically appear to be in debug mode in the Runtime explorer. This has been an open bug for some time.
  • If the user triggers the 'Debug' action on a project that is deployed onto a GlassFish Server 3.1 domain, the server is restarted in debug mode... if the IDE thinks that the server is not in debug mode.
  • When a user triggers the Restart action on a GlassFish Server 3.1 domain, the domain will restart in 'normal' mode.

Sunday Jul 18, 2010

New Enable and Disable actions for deployed apps

I had asked for some UI advice a couple weeks ago. I posted the results of the survey, but I forgot to post about the final results of the survey...

There is now two additional actions for applications deployed onto GlassFish Server instances: Enable and Disable.


The new actions

Applications are badged when they are disabled, so you can see which applications are enabled or disabled at a glance.


A list of apps that includes disabled apps

Friday Mar 06, 2009

A very useful day

Every now and then, you look back at 'What did I do today?' and the answer is mighty depressing. Today was not one of those days for me.

For my accomplishments today, I:

I wish that I had been able to work a bug fix into the mix today, but that did not happen. Maybe Monday.

Tuesday Dec 16, 2008

SIP Servlet Development Support and 6.5

Some folks may have read about the work done to create a development environment for SIP Servlet Applications based on NetBeans 6.1.

Now that 6.5 is out, you may have noticed that the bits aren't available on the 6.5 beta update center. The primary reason they aren't there is because I haven't asked that they be pushed into that update center. You can install the NBMs that support SIP Servlet application development,

by installing them from the lib/tools/netbeans subdirectory of a SailFin installation. You can also download the plugin from the 6.1 Beta update center into 6.5, but I do not recommend that. Those NBMs do not have the 'final' JSR289 apis and some other bug fixes.

I will request that the nbms be staged in the 6.5 Beta update center after the SailFin project ships their 1.5 release.

Tuesday Dec 18, 2007

Using the Test Agent to Debug ClickToDial

I have a rough cut of a write up that describes using the Test Agent to debug the ClickToDial sample app. It is screenshot heavy and verbage light. Since this is a wiki page, please feel free to extend it as seen fit.

Monday Jul 30, 2007

Monkeying with the GlassFish Issue Tracker

I am a Firefox user but have never really gotten into customizing it with add-ons. That changed a couple days ago, when I came up with a punk hack that I wanted to enable on Google search result pages.

I started to look at Firefox add-ons that might already perform my hack... which would kind of ruin the fun of implementing it... or help me implement it.

One of the add-ons that I found was Greasemonkey. It doesn't perform my hack, but it has allowed lots of people to implement customizations of web-pages that are similar to what I want to do.

I installed it and started to look for scripts that would teach me how to monkey-around. I found this script by Jesse Glick that modifies the page title for Issuezilla entries. Direct link to Jesse's actual script. If you have Greasemonkey installed clicking the link to Jesse's script will ask you if you would like to install it.

I read through the script and took it for a testdrive... and I liked it. Then I remembered that the NetBeans Issuezilla is hosted by the same folks that host the Issue Tracker for the GlassFish community. So, I decided to try an experiment.

I opened the Greasemonkey Manage User Scripts... dialog and saw this.

I used the Add... button to update the Included Pages list to look like this.

I went to Java.net and logged in and went to look for some GlassFish issues that I need to VERIFY. I have been very lazy about that...

When I clicked on a link to see the details on an issue, this is what my Window title looked like.

Then, I figured I would share this with folks in the GlassFish community.

And now, I am done

About


Vince Kraemer writes the entries in this blog.

Search

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
News
Blogroll

No bookmarks in folder

automarks