Category Archives: Java

GWT: “For security purposes, this type will not be serialized.”

The full error message you can get is: “Foo was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be … Continue reading

Posted in Development, Java | Tagged , , | 1 Comment

Java: Converting long to double

While Integers has to be parsed from a String, doubles can simply be casted: String bar = "9.99"; Double foo = (double)bar;

Posted in Development, Java | Tagged , | Leave a comment

EXT GWT: Adding onClick to Labels

I had a issue where i needed to add a click handler for labels in EXT GWT, the solution i came up with was as follows theLabel.addListener(Events.OnClick, new Listener() { @Override public void handleEvent(BaseEvent be) { // TODO Auto-generated method … Continue reading

Posted in Java | Tagged , , , | Leave a comment

Guice: java.lang.IllegalStateException: No SessionHandler or SessionManager

One reason for this error would be that you should inject the session object directly, not via constructor: So instead of: @Singleton public class Foo {   @Inject public Foo(HttpServletSession s) { this.session = s  } } do this: @Singleton … Continue reading

Posted in Java | Tagged , | 1 Comment

class Foo is public, should be declared in a file named Foo.java

When working with Java you might encounter this error. The reason for this is that you have tried to declare a public class in a file with a different name. Each java file can only contain one public java class, … Continue reading

Posted in Development, Java | Tagged , , , | Leave a comment

jpackages error: Missing Dependency: /usr/bin/rebuild-security-providers

Jpackages on Red Hat has a nifty bug that causes dependency errors. Luckily, somebody has created a fix as a rpm package wget http://plone.lucidsolutions.co.nz/linux/centos/images/jpackage-utils-compat-el5-0.0.1-1.noarch.rpm rpm -ivh jpackage-utils-compat-el5-0.0.1-1.noarch.rpm And then jpackages works.

Posted in Development, Java, Linux, Red Hat, Software | Tagged , | 1 Comment

Tips for implementing a custom JAAS login module for Jetty

1) jetty-web.xml You can gather all specific settings for Jetty in the file WEB-INF/jetty-web.xml, remember to also specify paths for the role principals if you use your own classes for that. Example jetty-web.xml file: <!– Jetty specific config file –> … Continue reading

Posted in Java | Tagged , | Leave a comment

Debugging GWT: Did you forget to inherit a required module?

You will receive this error if you are using classes in your GWT project that GWT does not have access to. Make sure that you have added something like this in your gwt.xml file, within your module element: <source path=”path.to.classes” … Continue reading

Posted in Java | Tagged | Leave a comment

Eclipse Workspace In Use Or Cannot Be Created

You may recieve the error message “Eclipse Workspace In Use Or Cannot Be Created” From Eclipse when trying to start up Eclipse, this typically means that Eclipse is already running.  If you have not started Eclipse, try to locate Eclipse … Continue reading

Posted in Java | Tagged , | Leave a comment

HttpClient: Target host must not be null, or set in parameters

If you have the following code failing: HttpGet httpget = new HttpGet(“www.host.com”); Then the error is pretty easy to solve: The problem is that you have not added a protocol to the URL, so change it to: HttpGet httpget = … Continue reading

Posted in Java | Tagged | 11 Comments