java.lang.NoClassDefFoundError: com/domain/i18n/Messages_de (wrong name...

Hi,

that's my first post here. I'm new to java and decided to use i18n + gettext in my first project.

I run resin. I use ant to build execs.

I followed this tutorial: http://gted.sourceforge.net/gettext_java_tutorial.htm (modified it a bit)

I created resource bundles by:

msgfmt --java2 -d ant-build/com/domain/i18n/ -r Messages -l de po/de/messages.po

which resulted in generating ant-build/com/domain/i18n/Messages_de.class

and then I have a jsp file with the following:

<jsp:useBean id="i" scope="page"

class="com.domain.i18n.Translatable">

</jsp:useBean>

<c:out value="${i.getText1()}" />

and I'm getting this error:

java.lang.NoClassDefFoundError: com/domain/i18n/Messages_de (wrong name:

Messages_de)

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClass(ClassLoader.java:620)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)

at com.caucho.loader.DynamicClassLoader.loadClass(DynamicClassLoader.java:1313)

at com.caucho.loader.DynamicClassLoader.findClass(DynamicClassLoader.java:1183)

at com.caucho.loader.DynamicClassLoader.loadClass(DynamicClassLoader.java:1103)

at com.caucho.loader.DynamicClassLoader.loadClass(DynamicClassLoader.java:1052)

at java.util.ResourceBundle$Control.newBundle(ResourceBundle.java:2370)

at java.util.ResourceBundle.loadBundle(ResourceBundle.java:1400)

at java.util.ResourceBundle.findBundle(ResourceBundle.java:1365)

at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1236)

at java.util.ResourceBundle.getBundle(ResourceBundle.java:789)

at com.domain.i18n.Util.<clinit>(Util.java:7)

at com.domain.i18n.Translatable.<init>(Translatable.java:10)

at _jsp._test__jsp._jspService(test.jsp:39)

at com.caucho.jsp.JavaPage.service(JavaPage.java:61)

at com.caucho.jsp.Page.pageservice(Page.java:577)

at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:192)

at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:175)

at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:240)

at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:263)

at com.caucho.server.port.TcpConnection.run(TcpConnection.java:477)

at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:600)

at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:522)

at java.lang.Thread.run(Thread.java:619)

I have very little experience with java but that looks to me like the Messages.class file isn't visible to the java engine. That might be related to the classpath issue (which I struggled with already:)) all the other classes are fine cuz they werebuild with ant (which builds project jars and sets the classpath).

the Messages_de file was built with "msgfmt --java2.. " and I think they aren't included in the classpath...

is this the case at all? if so, how can I add it to project jars?

can anybody help?

thanks,

D.

Message was edited by:

macdar

Message was edited by:

macdar

[3278 byte] By [macdara] at [2007-11-27 9:37:26]
# 1

the issue resolved.

I was supposed to generate Messages class like this:

msgfmt --java2 -d ant-build -r com.domain.i18n.Messages -l en po/en/messages.po

where ant-build is in the classpath.

(great tutorial for beginners here http://www.cs.usfca.edu/~parrt/course/601/lectures/java.tools.html)

hope that help somebody.

Message was edited by:

macdar

macdara at 2007-7-12 23:08:42 > top of Java-index,Desktop,I18N...