Recently I upgraded my Ubuntu Linux 9.04 to the latest Ubuntu 9.10 on my Acer Aspire 5652 laptop. So far so good. The upgrade went smooth and without any problems and after 40 minutes I was able to take a look at the latest Ubuntu release.
Soon I found out that neither suspend nor hibernate were working. After resuming I got a blank black screen and I was not able to fix this problem with infos from the ubuntu forums.
I decided to install a fresh Ubuntu 9.10 on my laptop because I wanted to benefit from ext4, a better startup time and the newest grub.
After installation succeeded I really was impressed by the startup time. Even after I installed all the programs I used on Ubuntu 9.04 the startup time was nearly twice as fast. But one problem was still there: Neither suspend nor hibernate did work.
One of the answers in the forum was to wait for a patch but this is no option for me because I need at least hibernation on my laptop.
So I found this link to be very useful: http://www.ubuntugeek.com/fix-for-suspend-and-hibernation-problem-for-laptops.html
It shows how to use the "Userspace Software Suspend" program to fix hibernate or suspend problems.
As root I edited the file
/etc/pm/config.d/00sleep_module
and changed the line
SLEEP_MODULE="kernel"
into
SLEEP_MODULE=”uswsusp”
and all of a sudden hibernation is working again. I still cannot use suspend but for now I can live with it.
UPDATE: 2009-11-29
With the latest Ubuntu updates my hibernation and suspend problems are gone, so I switched back to kernel suspend mode.
Total Pageviews
Thursday, November 12, 2009
Thursday, July 02, 2009
Howto change password expiration in Apache Continuum
Apache Continuum is bothering me with regularly messages that my password has expired and I need to change it. Well, there is a way to turn password expiration completely off.
Just create the file
/path/to/continuum/conf/security.properties
with the following content:
security.policy.password.expiration.enabled=false
security.policy.password.expiration.days=90
No annoying password changes anymore. But keep in mind that this may be a security risk!
Another option is to extend the number of days a password needs to expire.
For a complete reference of available properties check the site:
http://redback.codehaus.org/configuration.html
Have fun!
Just create the file
/path/to/continuum/conf/security.properties
with the following content:
security.policy.password.expiration.enabled=false
security.policy.password.expiration.days=90
No annoying password changes anymore. But keep in mind that this may be a security risk!
Another option is to extend the number of days a password needs to expire.
For a complete reference of available properties check the site:
http://redback.codehaus.org/configuration.html
Have fun!
Saturday, June 27, 2009
Testing your EJB3 beans in an embedded EJB container using OpenEJB with Maven as build system
Intro
I am currently working on a private project implementing a web application using GWT as frontend and EJB3 as backend technology.Testing my EJB3 beans using JUnit4 turned out to be very complicated. I had to manually inject all the required resources like EntityManager, EntityManagerFactory and all EJB3 beans the bean under test uses.
This may work for a simple project with a few beans but this will definitely not work for a huge project.
So I was looking for a better and less complicated way to test my beans.
Embedded Glassfish came to my mind, but this project isn't final yet, so I stumbled across a blog entry of Adam Bien's blog where he talks about OpenEJB and I thought just give it a try.
I use Maven as build system for all my projects so everything below this line just fits for Maven. If you use Ant or something different you may have to do other things to set up your testing environment.
Maven configuration
Using the OpenEJB embedded container is very easy. Just add the following dependency to your POM:<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-ejbd</artifactId>
<version>3.1.1</version>
<scope>test</scope>
</dependency>
In my case it turns out that the dependency activeio-core version 3.0.0-incubator is not hosted in any publicly available maven repository (well at least not in those I use). So I grabbed it from here and pushed it into my running Nexus instance.
In case you use OpenJPA as your persistence provider you have to configure the Maven surefire plugin to use the OpenEJB Java Agent. This is described in detail on this OpenEJB site.
Necessary files
My project consists of three maven modules:- project-entities (contains all JPA entities and the production persistence.xml under src/main/resources/META-INF)
- project-api (contains all session beans and services)
- project-webapp (the GWT web application)
Because I only work with annotations this file is nearly empty in my case. It just contains the following line:
<ejb-jar/>
In case you have configured a persistence.xml file under src/test/resource/META-INF of your module under test (in my case project-api) using RESOURCE_LOCAL I recommend to delete this file completely. In my case this file was interfering with the OpenEJB setup and all my beans were not deployed into the embedded container. Hence, my embedded tests were not working.
Configuring the OpenEJB embedded container for testing
Now it's time to configure the OpenEJB embedded container. This can be done in two ways. I will only explain the configuration in a JUnit base test class, so this can be used by all unit tests deriving from this class. There is another way in configuring the container using an XML file. Please consult the OpenEJB website for further details.Like I said before, I am using Hibernate as persistence provider. The setup of the embedded container is done in a method annotated with the JUnit annotation @Before, so it get's called before a test is executed. You may wish to change this in a way it better fits into your environment (using @BeforeClass, etc ...)
@Before
public void initializeEmbeddedContainer() throws Exception {
Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
....
....
....
context = new InitialContext(properties);
}
In the above code snippet the bold lines are important. They are responsible for starting the embedded container. There are a few more properties you have to set to get the embedded tests running. Now you have to override the settings you made in your persistence.xml for running in OpenEJB.
The following lines will do that for you:
properties.put("puName", "new://Resource?type=DataSource");
properties.put("puName.JdbcDriver", "org.hsqldb.jdbcDriver");
properties
.put("puName.JdbcUrl", "jdbc:hsqldb:mem:testdatabase");
properties.put("puName.hibernate.dialect",
"org.hibernate.dialect.HSQLDialect");
properties.put("puName.hibernate.hbm2ddl.auto", "update");
properties.put("puName.hibernate.show_sql", "true");
properties.put("puName.hibernate.format_sql", "true");
puName stands for persistence unitname. Please replace this with the real name of your persistence unit. The lines in bold are necessary. I am using HSQL DB, but this should work with any JDBC database. Don't forget to let Hibernate create the DB schema for you, otherwise your tests will fail because of non existent tables.
There is just another configuration property you may want to use: Restarting the OpenEJB embedded container between tests to avoid strange side effects in your tests. This is done by setting the property:
properties.put("openejb.embedded.initialcontext.close", "destroy");
But be aware that this property is an undocumented feature and may change in further versions of OpenEJB. This Jira entry recommends to achieve the same effect in configuring the maven surefire plugin.
So the complete method to initialize your in-container tests will look like this:
@Before
public void initializeEmbeddedContainer() throws Exception {
Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
properties.put("puName", "new://Resource?type=DataSource");
properties.put("puName.JdbcDriver", "org.hsqldb.jdbcDriver");
properties
.put("puName.JdbcUrl", "jdbc:hsqldb:mem:testdatabase");
properties.put("puName.hibernate.dialect",
"org.hibernate.dialect.HSQLDialect");
properties.put("puName.hibernate.hbm2ddl.auto", "update");
context = new InitialContext(properties);
}
Setting up a unit test
The last thing to do now is getting your beans from the embedded container. This can be done in two ways. One way is to use a special OpenEJB annotation to inject the bean into your test class. As this is an elegant way I prefer to code this with plain old Java method calls using JNDI lookup, because the first solution will make your code depend on OpenEJB API.This is how it works with local EJBs:
IServiceLocal localService = (IServiceLocal) getContext().lookup(ServiceImplLocal);
where IServiceLocal is the local interface of the session bean and ServiceImplLocal is the JNDI name of the bean implementation. The OpenEJB standard JNDI name for beans is {deploymentId}{interfaceType.annotationName}.
The deploymentId is the name of the EJB implementation (in our case ServiceImpl) and the interfaceType is Local, because the EJB under test is a local EJB.
Running your tests
Simply callmvn clean test
Monday, June 01, 2009
Switching my home Linux server from Knoppix to Ubuntu
My Linux box at home crashed during a distribution upgrade of my Knoppix version. I always had troubles in doing a distribution upgrade of my Knoppix server. So I decided to switch to Ubuntu 9.04.
The server is back since yesterday but not all the services are running.
I hope I will not regret this decision.
The server is back since yesterday but not all the services are running.
I hope I will not regret this decision.
Monday, April 27, 2009
Encoding mp3 under Ubuntu Linux
I recently ran into a problem encoding some audio files under my Ubuntu Linux 8.10. There was no way I could bring the "Audio CD Extractor" or "Rhythmbox Music Player" to encode my CDs to mp3.
It took me some time to figure out what the problem was. There should be at least three packages installed, to be able to encode audio files to mp3:
lame
gstreamer0.10-plugins-ugly
gstreamer0.10-plugins-ugly-multiverse
My Ubuntu 8.10 did not have the last one installed. So I did a quick
"apt-get install gstreamer0.10-plugins-ugly-multiverse"
and the problem was solved.
The last thing I did was to create and activate an mp3 profile in the preferences dialog of the "Audio CD Creator"
It took me some time to figure out what the problem was. There should be at least three packages installed, to be able to encode audio files to mp3:
lame
gstreamer0.10-plugins-ugly
gstreamer0.10-plugins-ugly-multiverse
My Ubuntu 8.10 did not have the last one installed. So I did a quick
"apt-get install gstreamer0.10-plugins-ugly-multiverse"
and the problem was solved.
The last thing I did was to create and activate an mp3 profile in the preferences dialog of the "Audio CD Creator"
Wednesday, February 18, 2009
Open Source Webmailer RoundCube
RoundCube Webmail is an open source browser-based multilingual IMAP client with an application-like user interface. It is developed in PHP and comes with a very comfortable installer interface.
The configuration took me just about 5 minutes and the webmailer was up and running on my Knoppix Linux box at home.
In the past I tried different webmailers on my local linux box (including AtMail and Claros Intouch). None of them were able to cope with nested folders on my dovecot imap server. RoundCube has no problems with that.
The web interface is very intuitive and uses a lot of AJAX (e.g. drag and drop). So if you would like to have a good looking, modern webmailer try RoundCube Webmail.
The configuration took me just about 5 minutes and the webmailer was up and running on my Knoppix Linux box at home.
In the past I tried different webmailers on my local linux box (including AtMail and Claros Intouch). None of them were able to cope with nested folders on my dovecot imap server. RoundCube has no problems with that.
The web interface is very intuitive and uses a lot of AJAX (e.g. drag and drop). So if you would like to have a good looking, modern webmailer try RoundCube Webmail.
Thursday, October 23, 2008
Important Eclipse shortcuts
Recently I switched from being an IntelliJ IDEA user to become an Eclipse user. Although Eclipse refactoring features are not as good as IDEAs I really, really like the Maven integration m2eclipse in Eclipse. Those guys from Sonatype do a fantastic job there.
Together with Nexus - which also is developed by Sonatype - it is a wonderful combination of working development tools.
And no, I do not work for Sonatype ;-)
Now back to what really puzzles me in Eclipse.... the shortcuts and some missing features. One of the really important features I heavily used in IDEA was "Go To Implementation". If you are working on an interface and you would like to know which classes implement this interface you select "Go To Implementation" and IDEA shows you all the implementations of that interface.
Unfortunately I really couldn't find this feature in Eclipse until I stumbled up on this blog entry. This entry almost saved my life as a developer ;-)
Okay, to make it short: The shortcut for "Go To Implementation" in Eclipse is "Ctrl-T" and not F3!
Here is a small summary of very important Eclipse shortcuts:
Together with Nexus - which also is developed by Sonatype - it is a wonderful combination of working development tools.
And no, I do not work for Sonatype ;-)
Now back to what really puzzles me in Eclipse.... the shortcuts and some missing features. One of the really important features I heavily used in IDEA was "Go To Implementation". If you are working on an interface and you would like to know which classes implement this interface you select "Go To Implementation" and IDEA shows you all the implementations of that interface.
Unfortunately I really couldn't find this feature in Eclipse until I stumbled up on this blog entry. This entry almost saved my life as a developer ;-)
Okay, to make it short: The shortcut for "Go To Implementation" in Eclipse is "Ctrl-T" and not F3!
Here is a small summary of very important Eclipse shortcuts:
- Using Interfaces if you want to see implementation press Ctrl–T and not F3.
- Ctrl-O in a class definition brings up Quick Outline. Start typing a member name and hit return when it’s unambiguous.
- Ctrl-F6 can be used to switch to the editors. The order of the editors is quite user friendly as most recently used on the top. Same way Ctrl-F7 to switch to Views and Ctrl-F8 for Perspective.
- And maybe the most important one: Ctrl-Shift-L shows you a list of all possible shortcuts available in the current context.
Important Eclipse shortcuts
Recently I switched from being an IntelliJ IDEA user to become an Eclipse user. Although Eclipse refactoring features are not as good as IDEAs I really, really like the Maven integration m2eclipse in Eclipse. Those guys from Sonatype do a fantastic job there.
Together with Nexus - which also is developed by Sonatype - it is a wonderful combination of working development tools.
And no, I do not work for Sonatype ;-)
Now back to what really puzzles me in Eclipse.... the shortcuts and some missing features. One of the really important features I heavily used in IDEA was "Go To Implementation". If you are working on an interface and you would like to know which classes implement this interface you select "Go To Implementation" and IDEA shows you all the implementations of that interface.
Unfortunately I really couldn't find this feature in Eclipse until I stumbled up on this blog entry. This entry almost saved my life as a developer ;-)
Okay, to make it short: The shortcut for "Go To Implementation" in Eclipse is "Ctrl-T" and not F3!
Here is a small summary of very important Eclipse shortcuts:
Together with Nexus - which also is developed by Sonatype - it is a wonderful combination of working development tools.
And no, I do not work for Sonatype ;-)
Now back to what really puzzles me in Eclipse.... the shortcuts and some missing features. One of the really important features I heavily used in IDEA was "Go To Implementation". If you are working on an interface and you would like to know which classes implement this interface you select "Go To Implementation" and IDEA shows you all the implementations of that interface.
Unfortunately I really couldn't find this feature in Eclipse until I stumbled up on this blog entry. This entry almost saved my life as a developer ;-)
Okay, to make it short: The shortcut for "Go To Implementation" in Eclipse is "Ctrl-T" and not F3!
Here is a small summary of very important Eclipse shortcuts:
- Using Interfaces if you want to see implementation press Ctrl–T and not F3.
- Ctrl-O in a class definition brings up Quick Outline. Start typing a member name and hit return when it’s unambiguous.
- Ctrl-F6 can be used to switch to the editors. The order of the editors is quite user friendly as most recently used on the top. Same way Ctrl-F7 to switch to Views and Ctrl-F8 for Perspective.
- And maybe the most important one: Ctrl-Shift-L shows you a list of all possible shortcuts available in the current context.
Thursday, October 16, 2008
Problem solved: Eclipse with Cypal Studio, m2eclipse running GWT Hosted Mode under Linux
I am developing a GWT application on my laptop which runs on Ubuntu 8.
I am using Eclipse 3.4 with the m2eclipse plugin (my project is built using Maven 2) and Cypal Studio as GWT plugin. So far, nothing fancy one should think.
But there are a few things to overcome with:
If you have a better solution don't hesitate to comment on this entry.
I am using Eclipse 3.4 with the m2eclipse plugin (my project is built using Maven 2) and Cypal Studio as GWT plugin. So far, nothing fancy one should think.
But there are a few things to overcome with:
- When you import your Maven project using m2eclipse the web project containing the GWT code will not be configured correctly to work with Cypal Studio. I haven't figured out yet the reason why, but a workaround to this problem is to generate the eclipse project files for the web project by executing "mvn eclipse:eclipse" manually. Now you are able to add a working "Run configuration" for the GWT hosted mode in eclipse.
- I started the newly created "Run Configuration" and got an error message stating that a file called "libswt-pi-gtk-3235.so" was missing. So I copied that one from the installed GWT 1.5.2 distribution to my local maven repository into the directory $M2_REPOSITORY/com/google/gwt/gwt-dev/VERSION.
- Now, choosing "Run" one would expect to see a starting hosted mode browser (namely Mozilla Firefox). But the only thing I saw was an error message saying "** Unable to find a usable Mozilla install **". Hm, I had installed the latest GWT distribution (1.5.2) and I had configured the path correctly within the Cypal preferences. The dependencies for the web project were all correctly managed by m2eclipse. So what the hell was going wrong?
Well it turns out to be a problem with the gwt-dev-1.5.2-linux.jar dependency and the way Cypal (or GWT) resolves dependencies.
The gwt-dev-1.5.2-linux.jar was a dependency of my web project. So Cypal (or GWT) assumes to have a valid GWT distribution and therefore a runnable Mozilla Firefox installed in the directory $M2_REPOSITORY/com/google/gwt/gwt-dev/VERSION. That was obviously not the case.
So I copied ALL *.so files and the file mozilla-hosted-browser.conf from the GWT distribution directory to the $M2_REPOSITORY/com/google/gwt/gwt-dev/VERSION folder. - The last thing was to edit the mozilla-hosted-browser.conf file and point to the mozilla-firefox installation of the GWT distribution. I did this using absolut path arguments (eg. /usr/local/share/gwt/gwt-1.5.2/mozilla-1.7.12).
- Now Cypal starts the GWT Hosted mode with the Mozilla Firefox browser.
If you have a better solution don't hesitate to comment on this entry.
Problem solved: Eclipse with Cypal Studio, m2eclipse running GWT Hosted Mode under Linux
I am developing a GWT application on my laptop which runs on Ubuntu 8.
I am using Eclipse 3.4 with the m2eclipse plugin (my project is built using Maven 2) and Cypal Studio as GWT plugin. So far, nothing fancy one should think.
But there are a few things to overcome with:
If you have a better solution don't hesitate to comment on this entry.
I am using Eclipse 3.4 with the m2eclipse plugin (my project is built using Maven 2) and Cypal Studio as GWT plugin. So far, nothing fancy one should think.
But there are a few things to overcome with:
- When you import your Maven project using m2eclipse the web project containing the GWT code will not be configured correctly to work with Cypal Studio. I haven't figured out yet the reason why, but a workaround to this problem is to generate the eclipse project files for the web project by executing "mvn eclipse:eclipse" manually. Now you are able to add a working "Run configuration" for the GWT hosted mode in eclipse.
- I started the newly created "Run Configuration" and got an error message stating that a file called "libswt-pi-gtk-3235.so" was missing. So I copied that one from the installed GWT 1.5.2 distribution to my local maven repository into the directory $M2_REPOSITORY/com/google/gwt/gwt-dev/VERSION.
- Now, choosing "Run" one would expect to see a starting hosted mode browser (namely Mozilla Firefox). But the only thing I saw was an error message saying "** Unable to find a usable Mozilla install **". Hm, I had installed the latest GWT distribution (1.5.2) and I had configured the path correctly within the Cypal preferences. The dependencies for the web project were all correctly managed by m2eclipse. So what the hell was going wrong?
Well it turns out to be a problem with the gwt-dev-1.5.2-linux.jar dependency and the way Cypal (or GWT) resolves dependencies.
The gwt-dev-1.5.2-linux.jar was a dependency of my web project. So Cypal (or GWT) assumes to have a valid GWT distribution and therefore a runnable Mozilla Firefox installed in the directory $M2_REPOSITORY/com/google/gwt/gwt-dev/VERSION. That was obviously not the case.
So I copied ALL *.so files and the file mozilla-hosted-browser.conf from the GWT distribution directory to the $M2_REPOSITORY/com/google/gwt/gwt-dev/VERSION folder. - The last thing was to edit the mozilla-hosted-browser.conf file and point to the mozilla-firefox installation of the GWT distribution. I did this using absolut path arguments (eg. /usr/local/share/gwt/gwt-1.5.2/mozilla-1.7.12).
- Now Cypal starts the GWT Hosted mode with the Mozilla Firefox browser.
If you have a better solution don't hesitate to comment on this entry.
Subscribe to:
Posts (Atom)