views:

109

answers:

2

Hi! I am trying to develop a portlet in Liferay that operates on a Bonita workflow, but I keep getting the exception in the title. I am not particularly familiar with the Java world, so I have no idea what to bang my head against :)

A: 

It's hard to say exactly what's wrong without more information, but it's almost bound to be a classpath issue. Find whichever class is mentioned in the exception, and make sure that the jar file containing that class is on the classpath. Without being familiar with Liferay I don't know how you'll do that, but it's probably a case of dropping the jar file into the right directory.

Jon Skeet
+2  A: 

You probably called some code like:

new LiferayClass();

and the JVM has no idea where the class's constructor is. This often happens because you were careful to tell the compiler (javac) where the library (Liferay JAR file) was when you were compiling, but you didn't tell the JVM (java) where the library was when you attempted to run the program.

The easiest way to tell the JVM where the required libraries can be found is with a search path called CLASSPATH. Export an environmental variable that looks like this:

For Unix/Linux

CLASSPATH=/path/to/liferay.jar:/path/to/bonita.jar

For Windows

CLASSPATH=C:\path\to\liferay.jar;C:\path\to\bonita.jar

--- edit after clarification that this is a web application ---

Since this is a web application, you don't put the JAR file in the classpath. You place it in the WEB-INF/lib directory internal to the WAR file you create. That way it will only be exposed to your web application; otherwise, it could interfere with the other deployed web applications.

Edwin Buck
Will the fact that Liferay works with Tomcat be an issue (like does Tomcat have a separate CLASSPATH)?
Giuseppe Maggiore
Tomcat does have a CLASSPATH, but you don't want to use it in this case. Tomcat doesn't put web application code on its classpath to prevent deployed web applications from hijacking the proper containment and security code that Tomcat provides.
Edwin Buck