Accessing an EJB 3.1 Singleton Bean with @Startup from a Servlet in the Same JVM Instance

I am building a project whereby I have a Singleton Bean that I want to fire up when the .jar is deployed in the EJB container, thus I have it annotated as follows:

package com.ryanchapin.ejbTest

@Startup
@Singleton

public class SingletonTest{}

Of course, I have the requisite Local and Remote interfaces set, up, I’ve just left that off for brevity. I am attempting to do a JNDI lookup, from a Servlet in the same JVM using the Local interface which results → Continue reading “Accessing an EJB 3.1 Singleton Bean with @Startup from a Servlet in the Same JVM Instance”

Disabling JavaScript Validation in Eclipse Helios 3.6.1

The Helios JavaScript validator does not seem to like the jquery-1.5.min.js (or for that matter a number of other know good js libraries). As a result Eclipse complains a lot when building a project.

The quick fix that I found was to disable JavaScript validation under the Builder preferences, for your project:

Project/Properties/Builders

Simply, uncheck the “JavaScript Validator” and you should be all set.→ Continue reading “Disabling JavaScript Validation in Eclipse Helios 3.6.1”

Simple Network Speed Command Line Test for Linux

Let’s say that all that you have access to is the command line on a Linux box and you want to know what the network throughput is. If you have another Linux box you can use netcat to do a quick test:

On box a:? Set up netcat to listen to a given port:

nc -l 12345 > /dev/null

Fire up netcat to listen on port 12345 and to dump the output to /dev/null.

On box b:? Send data via → Continue reading “Simple Network Speed Command Line Test for Linux”

Installing Java SE Source Files and Linking to Eclipse on CentOS 5

?When I first set up a developoment VM with CentOS I must have forgotten to install the Java source because I could not navigate to Java SE method declarations in my Eclipse IDE.

To have access to the Java source I did the following:

  • yum install java-1.6.0-openjdk-src
  • A src.zip file was placed in:
  • /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/src.zip

I created a src dir in the aforementioned containing dir and unpacked the zip
I then linked to the source from Eclipse by:
Right-clicking on some → Continue reading “Installing Java SE Source Files and Linking to Eclipse on CentOS 5”

Installing JBoss AS 6 Tools in Eclipse Helios

  • Go to Help > Install New Software
  • Set Work with to http://download.jboss.org/jbosstools/updates/development/
  • In the results, unfold “All JBoss Tools” and check JBoss AS Tools. When last I checked the description indicates only 4.x and 5.x for JBoss, but it does include JBoss AS 6 Tools
  • Next, etc, Finish.

When I then ran through the Eclipse add server wizard the 6.0 version of JBoss AS was available.→ Continue reading “Installing JBoss AS 6 Tools in Eclipse Helios”

Including libraries in WAR files in Eclipse

By default, the newer versions of Eclipse do not include the libraries that you add to the build path in .war files. There are three approaches to solving this problem:

  • Declare your libraries/jar files to be module dependencies for your war file; essentially forcing Eclipse fo treat the lib the same way it would a dependent project. I found a web page describing how to do this for an older version of Eclipse and couldn’t readily figure out how to
Continue reading “Including libraries in WAR files in Eclipse”

Disabling Autodeploy in Eclipse for Web and JavaEE Projects

In some cases it is helpful to have your Java project automatically built and deployed for you by Eclipse. For me, when working on a dynamic web or JavaEE project I’d much rather run it on the server through the IDE manually, as I tend to save often and I end up having to wait for a previous deployment to finish on a regular basis.

To disable the feature:

  • Go to: Window/Show View/Servers
  • Double-click on the server that you associated
Continue reading “Disabling Autodeploy in Eclipse for Web and JavaEE Projects”

Linux Daemons and Services List

A couple of links with lists of the default set of Linux daemons installed on most systems. Helpful to know which ones that you need to disable when locking down a machine.

http://www.techrepublic.com/article/linux-101-a-comprehensive-list-of-available-linux-services/6018195

http://www.hscripts.com/tutorials/linux-services/index.phpContinue reading “Linux Daemons and Services List”

Egg Drop Soup

  • 1 egg
  • 2 1/2 cups chicken broth
  • 1 tbsp corn starch mixed with 1tbsp water
  • 1 tsp finely chopped tops of green onions
  • Pinch of white pepper
  • Dash of sesame oil

In a small bowl, beat egg slightly; set aside. Bring chicken broth to a boil over high heat. Add corn starch mixture to the broth stirring until it comes to a boil again. Reduce heat to medium-low. Hold the pan with beaten egg about 12 to 15″ above the → Continue reading “Egg Drop Soup”

Deleting a File Using the Inode Number

Sometimes you will accidentally create a file that has special characters in the file name which then prevents you from running commands on it.  In that case, you can resort to accessing the file via it’s inode number.

To do so:

$ ls -il | more

In the directory in which the file that you want to examine resides

This will output a list of files, the first column being the inode number.

You can then run the following command → Continue reading “Deleting a File Using the Inode Number”