• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with precompiling my JSP pages.

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I am using JSP 1.2, and I developed my own custom tag library. I have written the tld file and package them in a jar file.

META-INF/mytaglib.tld
mytaglib/Mytag.class

I put the jar file in the WEB-INF\lib directory and I also copy the tld file in the WEB-INF directory.

However, when I include a tag in my library in one of my jsp page. I have the following error:

[jasperc] java.lang.NoClassDefFoundError: mytaglib/Mytag (wrong name: MyTag)

I use an ant script task jaspc to do the job. Can anyone help me to find out the cause of the error.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

[jasperc] java.lang.NoClassDefFoundError: mytaglib/Mytag (wrong name: MyTag)



Is your casing consistent everywhere? Mytag is not the same as MyTag.

Btw, there's no need to extract the tld file from the jar.
 
John Ip
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry, that is my typo error in the message.

The error is

java.lang.NoClassDefFoundError: mytaglib/MyTag (wrong name: MyTag)

does anyone have a clue how to fix this problem?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's your tld entry for the tag look like?
 
John Ip
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is what I have in my tld file

<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version></jsp-version>
<short-name>m</short-name>
<uri></uri>
<tag> <name>myTag</name>
<tag-class>mytaglib.MyTag</tag-class>
<body-content>empty</body-content>
</tag>
</taglib>

And in my jsp file

<%@ taglib uri="/WEB-INF/mytaglib.tld" prefix="mytaglib"%>

<mytaglib:myTag />

Thank you!
 
John Ip
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have typo again

I should have 1.2 in between the <jsp-version> tags

sorry about that.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic