Posts

Showing posts from August, 2013

Glassfish Cluster SSH - Tutorial : How to create and configure a glassfish cluster with SSH (Part 2)

3. Glassfish cluster configuration With our pre-requirements covered it's time to start configuring our cluster A. Enabling remote access on the glassfish servers By default the remote administration feature is disabled on the GlassFishServer This is to reduce your exposure to an attack from elsewhere in the network.So if you attempt to administer the server remotely you will get a 403 - Forbidden HTTP status as the response. This is true regardless of whether you use the asadmin command, an IDE, or the REST interface.You will need to start up the glassfish server on each one of your servers by executing the following command $GFISH_HOME/bin/asadmin start-domain domain1 Once the servers are up you can turn remote administration on running the following command locally in each one of the servers (please ensure the glassfish instance is running when you execute the command) and when prompted enter the appropriate user/password : $GFISH_HOME/bin/asadmin enable-secure-admin This c…

Glassfish Cluster SSH - Tutorial : How to create and configure a glassfish cluster with SSH (Part 1)

Image
0. Presentation A cluster is a named collection of GlassFish Server instances that share the same applications, resources, and configuration information. GlassFish Server enables you to administer all the instances in a cluster as a single unit from a single host, regardless of whether the instances reside on the same host or different hosts. You can perform the same operations on a cluster that you can perform on an unclustered instance, for example, deploying applications and creating resources. In this we will configure a 3 node Glassfish cluster using SSH and using only the command-line util asadmin. Below is a global picture of the target cluster structure : The following are the conventions/assumptions that will be used throughout this tutorial linux user : gfish glassfish domain : domain1 glassfish cluster name : myCluster 1. Pre-requirements A. SSH key configuration (Optional but used in this tutorial)In order for the different instances of glassfish to communicate easily…

Fix Did not receive a signal within 15.000000 seconds. Exiting... error message

Image
I have installed in my macbook pro OSXFuse with the NTFS-3G add-on and up until the MacOS Lion update I had no particular issues with itWith the Lion update I started getting the following error when mounting NTFS drives : Did not receive a signal within 15.000000 seconds. Exiting... This is a known issue and the NTFS drive was properly mounted and working despite the error message, but I found the error message pretty annoying.. luckily there's a solution to it. Head over to bfleischer's github fuse wait repo and follow the instructions to either install the patch manually (you'll need XCode to build the source file) or via a script that he has provided

ViewResolver vs MessageConverter Spring MVC when to use

Spring has lots of ways of handling view and content resolution, which is probably a good thing since it gives you flexibility but sometimes it can be a bit problematic. Full disclosure here I must admit I had never given much attention to all of the ways views could be resolved, usually I went with a ViewResolver for handling my views and that was it; until recently though... For one of my projects I needed some custom JSON handling so I had defined a custom ViewResolver by extending spring's org.springframework.web.servlet.view.json.MappingJackson2JsonView and defined as the default implementation for handling JSON views like so : Everything was working as expected until I had to annotate some methods with @ResponseBody and now every method with this annotation was not being processed by my custom ViewResolver and I couldn't understand why..As it turns out it's pretty simple (once you read the documentation again) when you annotate a method @ResponseBody spring will dele…

MongoDB spring data $elemMatch in field projection

Sometimes when querying a MongoDB document what you will actually need is an item of a given document's embedded collections The issue with MongoDB is that mongo will filter out only first level documents that correspond to your query but it will not filter out embedded documents that do not correspond to your query criteria (i.e. If you are trying to find a specific book in a book saga) you will get the complete 'parent' documents with the entire sub collection you were trying to filter So what can you do when you wish to filter a sub-collection to extract 1 subdocument ? Enter the $elementMatch operator. Introduced in the 2.1 version the $elemMatch projection operator limits the contents of an array field that is included in the query results to contain only the array element that matches the predicate expressed by the operator. Let's say I have a model like the following : { "id": "1", "series": "A song of ice and F…