• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Problem running jsps in Weblogic

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Am trying to run the sample jsp pagehits.jsp( which uses custom tags) in weblogic 5.1 and its giving me the below error on the weblogic console
================================================================
Mon Apr 23 14:50:28 GMT+05:30 2001:<I> <ServletContext-General> looking for taglib uri /counter.tld as resource /WEB-INF/counter.tld in Web Application root:
Mon Apr 23 14:50:28 GMT+05:30 2001:<E> <ServletContext-General> Servlet failed with Exception
weblogic.servlet.jsp.JspException: (line -1): Error in tag library at: 'counter': cannot find tag class: 'weblogic.taglib.counter.Display'
at weblogic.servlet.jsp.StandardTagLib.jspException(StandardTagLib.java:138)
at weblogic.servlet.jsp.StandardTagLib.processTag(StandardTagLib.java:229)
at weblogic.servlet.jsp.StandardTagLib.processTagElements(StandardTagLib.java:146)
at weblogic.servlet.jsp.StandardTagLib.<init>(StandardTagLib.java:125)
at weblogic.servlet.jsp.JspLexer.loadTagLib(JspLexer.java:72)
at weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE_BODY(JspLexer.java:3578)
at weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE(JspLexer.java:3334)
at weblogic.servlet.jsp.JspLexer.mDIRECTIVE(JspLexer.java:3195)
at weblogic.servlet.jsp.JspLexer.mSTANDARD_THING(JspLexer.java:1636)
at weblogic.servlet.jsp.JspLexer.mTOKEN(JspLexer.java:1477)
at weblogic.servlet.jsp.JspLexer.nextToken(JspLexer.java:1367)
at weblogic.servlet.jsp.JspLexer.parse(JspLexer.java:788)
at weblogic.servlet.jsp.JspParser.doit(JspParser.java:69)
at weblogic.servlet.jsp.JspParser.parse(JspParser.java:109)
at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:97)
at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java:242)
at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java:249)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:174)
at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:164)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:99)
at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:742)
at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:686)
at weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextManager.java:247)
at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:361)
at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:261)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
================================================================
pl tell me where am going wrong
Thanx
 
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mary, have you solved the earlier problem "cannot parse the descriptor file"? I am doing something very simple with JSP Custom Tags using the WebLogic. I don't know where went wrong. Please let me how to solve the problem.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mary,
Just check if the class file "Display.class" is present in the directory WEBLOGIC_HOME/myserver/servletclasses/weblogic/taglib/counter.
If you do not have the above mentioned directory, then create one, and place the class file inside it.
Here is how to create the Display.class class file.
1. Compile the Display.java present in WEBLOGIC_HOME/examples/jsp/tagext/counter
2. Place it in the WEBLOGIC_HOME/myserver/servletclasses/weblogic/taglib/counter directory
Once this is done, your custom tag will work.
Regards,
Prasad
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mr. Desai:
I am happy to see someone has used Custom Tags on the WebLogic server. I have been stuck with this problem for a long time. Both Mr. Phil Hanna (the author of several books) and Ms. Maha Anna helped in looking at my source code. My code works on their Tomcat. I think that I put all the files under the right directories, I cannot stop wondering if I made mistakes in compiling the tag handler class, ExampleTag.java. I keep getting this error message using the WebLogic 5.1 and WebLogic 6.0:
Parsing of JSP File '/SimpleExample.jsp' failed:
---------------------------------------------------------------
/SimpleExample.jsp(6): Could not parse deployment descriptor: java.io.IOException: cannot resolve 'csajsp-taglib.tld' into a valid tag library
probably occurred due to an error in /SimpleExample.jsp line 6:
<%@ taglib uri="csajsp-taglib.tld" prefix="csajsp" %>
---------------------------------------------------------------
There are five, but very small files involved. Please allow me to load my source code:
1. The Web application deployment descriptor, web.xml, under
c:\bea\wlserver6.0sp1
\config\mydomain\applications\DefaultWebApp_myserver
\WEB-INF
<?xml version="1.0" ?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<taglib>
<taglib-uri>csajsp-taglib.tld</taglib-uri>
<taglib-location>csajsp-taglib.tld</taglib-location>
</taglib>
</web-app>
Note: I also tried to change <taglib-location> element to
<taglib-location>/WEB-INFO/csajsp-taglib.tle</taglib-location>
2. The tag library descriptor file, csajsp-taglib.tld, which is a .xml file, is under the same directory as where web.xml is
c:\bea\wlserver6.0sp1
\config\mydomain\applications\DefaultWebApp_myserver
\WEB-INF
<?xml version="1.0" encoding="ISO-8859-1" ?>
<! DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<!-- a tag library descriptor -->
<taglib>
<!-- after this the default space is
"http://java.sun.com/j2ee/dtds/jsptaglibrary_1_2.dtd"
-->
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>csajsp</shortname>
<uri></uri>
<info>
A tag library from Core Servlets and JavaServer Pages, http://www.coreservlets.com/.
</info>
<tag>
<name>example</name>
<tagclass>coreservlets.tags.ExampleTag</tagclass>
<info>Simplest example: inserts one line of output</info>
<!-- TOMCAT 3.1 DOES NOT SUPPORT BODYCONTENT
<bodycontent>empty</bodycontent> -->
</tag>
</taglib>

3. The JSP page, SimpleExample.jsp is under
c:\bea\wlserver6.0sp1
\config\mydomain\applications\DefaultWebApp_myserver
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<%@ taglib uri="csajsp-taglib.tld" prefix="csajsp" %>
<TITLE><csajsp:example /></TITLE>
<LINK REL=STYLESHEET
HREF="JSP-Styles.css"
TYPE="text/css">
</HEAD>
<BODY>
<H1><csajsp:example /></H1>
<csajsp:example />
</BODY>
</HTML>
4. The style sheet that is used in the JSP page, JSP-Styles.css, is in the same directory as where the JSP page is
<STYLE TYPE="text/css">
<!--
BODY { background-color: #FDF5E6 }
A:hover { color: red }
H1 { color: #440000;
text-align: center;
font-family: Arial Black, Arial, Helvetica, sans-serif
}
H2 { color: #440000;
text-align: left;
font-family: Arial, Helvetica, sans-serif
}
H3 { color: #440000;
text-align: left;
font-family: Arial, Helvetica, sans-serif
}
UL { margin-top: 0;
border-top-width: 0;
padding-top: 0
}
DT { font-weight: bold;
}
PRE { font-size: 105%;
}
CODE { font-size: 105%;
}
.TOC { font-size: 90%;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif
}
TH.COLORED { background-color: #FFAD00
}
TR.COLORED { background-color: #FFAD00
}
TH.TITLE { background-color: #EF8429;
font-size: 28px;
font-family: Arial, Helvetica, sans-serif;
}
-->
</STYLE>
5. The tag handler Java class file, ExampleTag.class, is under
c:\bea\wlserver6.0sp1
\config\mydomain\applications\DefaultWebApp_myserver
\WEB-INF\classes\coreservlets\tags
and the below is the source code for the tag handler Java file, Example.java
package coreservlets.tags;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.*;
public class ExampleTag extends TagSupport {
public int doStartTag() {
try {
JspWriter out = pageContext.getOut();
out.print("Custom tag example " +
"(coreservlets.tags.ExampleTag)");
} catch(IOException ioe) {
System.out.println("Error in ExampleTag: " + ioe);
}
return(SKIP_BODY);
}
}
Could you detect what went wrong? Many, many thanks

 
Prasad Desai
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Caroline,
There were two very small errors in the tag library descriptor file. These are mentioned below...
1. If you see the start of the tld file..
<?xml version="1.0" encoding="ISO-8859-1" ?>
<! DOCTYPE taglib...
There should be NO SPACE between "<!" and "DOCTYPE". So the above line should read...
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib...
2. There is an empty uri tag present in the tld file as shown below....
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>csajsp</shortname>
<uri></uri>
<info>.....
This tag should be removed. It is used only when there is a link to some other tld file. So the tld file should read...
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>csajsp</shortname>
<info>.....
If you make the above mentioned changes, your code should run. Hope this helps.
Regards,
Prasad
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mr. Desai:
Thank you for taking a look at my problem. I
followed your instruction and made the changes to the
tag library descriptor file accordingly:
1. deleted the space between <! and DOCTYPE taglib
2. removed the <uri></uri> element from the file
However, I still got the same old error message:
cannot parse the tag library descriptor.
Mr. Phil Hanna and Ms. Maha Anna at the Javaranch
helped last week, but they use the Tomcat, not the
WebLogic.
I am wondering if it is the way I compiled the
tag handler class, ExampleTag.java, that is in a
package coreservlets.tags causing the problem. If
there is nothing wrong with the code, and I put the
files in the right directories, the only thing left is
the Java file does not get compiled correctly. I
would appreciate your insight into the problem. Many,
many thanks.
 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Prasad,
I tried it as per your specs, but no result
Donno where am going wrong
 
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys, I would suggest to You to define your own webApp. You just need to add one line to weblogic.properties file. Once You have done so your jsps go into jsp folder, your servlet, javabeans and custom tags go into WEB-INF/classes directory.
Let's define Test webApp so
you add this to your weblogic.properties file
weblogic.httpd.webApp.Test=C:/Dev/Test (C:/Dev - off course being a dir where Test folder resides)
Then your jsps go into C:/Dev/Test/jsp folder
Your servlet, javabeans, custom tag classes go into C:/Dev/Test/WEB-INF/classes folder.
Your web.xml and .tld file go into WEB-INF folder.
One more thing. Make sure your javabeans and custom tags are in a package because if they are sitting in the root /classes directory it won't work.
HTH
Vladan
 
You know it is dark times when the trees riot. I think this tiny ad is their leader:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic