• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Problem with precompiling my JSP pages.  RSS feed

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • 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.
 
Author and ninkuma
Marshal
Posts: 66806
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Posts: 66806
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!