Re: RE: using regexp in JSPs on Tomcat

2002-12-25 Thread Albert Wang


- Original Message -
From: PELOQUIN,JEFFREY (HP-Boise,ex1) [EMAIL PROTECTED]
Date: Tuesday, December 24, 2002 2:56 pm
Subject: RE: using regexp in JSPs on Tomcat

 hmmm,  do you use RE at all in the init method of your class?

Nope, not at all.

 
 also now that I look more carefully at the stack trace, you might try
 looking at the compiled java for the calling jsp page. From your 
 stack trace
 the calling jsp page is viewSample.jsp, do you use any RE's in 
 this jsp?

No, I just instantiated that class and called the method.


 
 the compiled java code will be found within the
 $TOMCAT/work/servername/path/to/jsp
 the offending line will be 367, because of the use of a $ in the 
 file name
 you may have trouble vi'ing or more'ing the file.  I usaully ftp 
 such files
 to a windows machine.
 

Right, I looked at that java file, but the problem is the bulk of the entire 
generated class is one big Try block, and line 367 is just where the 
REException is thrown in the corresponding catch block.  So the actual 
problem could be anywhere...

The more I look at it, the more it seems to me like this is a potential Jasper 
bug.  I hope I'm wrong...





--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: RE: using regexp in JSPs on Tomcat

2002-12-25 Thread Jason Pyeron
if this does not help, please send the .java source to your file.

%try{%

!-- Your jsp page here --

%
  } catch (Throwable t)
  {
  %pre%
  do
  {
   out.println(Exception (+t+) caused by (+t.getCause()+) stacktrace:);
   t.printStackTrace(new java.io.PrintWriter(out));
   if (t instanceof javax.servlet.jsp.JspException) 
t=((javax.servlet.jsp.JspException)t).getRootCause(); 
   else 
t=t.getCause();
  }
  while (t!=null);
  %/pre%
 }
%


-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-   -
- Jason Pyeron   http://www.pyerotechnics.com   -
- Owner  Lead  Pyerotechnics Development, Inc. -
- +1 410 808 6646 (c)   500 West University Parkway #1S -
- +1 410 467 2266 (f)   Baltimore, Maryland  21210-3253 -
-   -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

This message is for the designated recipient only and may contain 
privileged, proprietary, or otherwise private information. If you
have received it in error, purge the message from your system and 
notify the sender immediately.  Any other use of the email by you 
is prohibited.



On Wed, 25 Dec 2002, Albert Wang wrote:



- Original Message -
From: PELOQUIN,JEFFREY (HP-Boise,ex1) [EMAIL PROTECTED]
Date: Tuesday, December 24, 2002 2:56 pm
Subject: RE: using regexp in JSPs on Tomcat

 hmmm,  do you use RE at all in the init method of your class?

Nope, not at all.

 
 also now that I look more carefully at the stack trace, you might try
 looking at the compiled java for the calling jsp page. From your 
 stack trace
 the calling jsp page is viewSample.jsp, do you use any RE's in 
 this jsp?

No, I just instantiated that class and called the method.


 
 the compiled java code will be found within the
 $TOMCAT/work/servername/path/to/jsp
 the offending line will be 367, because of the use of a $ in the 
 file name
 you may have trouble vi'ing or more'ing the file.  I usaully ftp 
 such files
 to a windows machine.
 

Right, I looked at that java file, but the problem is the bulk of the entire 
generated class is one big Try block, and line 367 is just where the 
REException is thrown in the corresponding catch block.  So the actual 
problem could be anywhere...

The more I look at it, the more it seems to me like this is a potential Jasper 
bug.  I hope I'm wrong...





--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: using regexp in JSPs on Tomcat

2002-12-24 Thread PELOQUIN,JEFFREY (HP-Boise,ex1)
Albert,

The stack trace you show would imply that your class is indeed throwing the
RESyntaxExeception.
I would guess you class definition or class method allows the passing of the
Exception to the invoking class, in this case Jasper.

I would remove any Throws RESyntaxException from the class/method def and
wrap a try/catch around the new RE() statement.

If that does not seem applicable you may need to post the jsp and class code
in question.

Does the RE statement depend on any parameters passed to it from the JSP
page?  If it does you may need check for nulls before creating the RE.

Jeff


-Original Message-
From: Albert Wang [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 24, 2002 11:10 AM
To: [EMAIL PROTECTED]
Subject: using regexp in JSPs on Tomcat


Hi all,

I have a Java class which uses the Jakarta regexp package for some 
string parsing.  It works perfectly fine on its own.  I'm developing a 
set of JSPs, one of which instantiates this class and calls some 
methods.  However, Tomcat is throwing me the following exception:

javax.servlet.ServletException: org/apache/regexp/RESyntaxException
at 
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:471)
at org.apache.jsp.viewSample$jsp._jspService(viewSample$jsp.java:367)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:201)
at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:190)
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
)
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1027)
at 
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
)
at java.lang.Thread.run(Thread.java:484)

As you can see, it's a regexp exception, but it's not my class that's 
throwing it, it's Jasper.  When I do not instantiate this class of mine, 
the JSP displays perfectly.  Is there some documented incompatibility 
with using regexp within JSPs on Tomcat?  The only workaround I can 
think of is to use some other regular expression package that isn't used 
inherently within Tomcat.  Any suggestions?

Thanks for any help,
-Al

-- 
--
Albert Wang
DDED Informatics
Bristol-Myers Squibb Pharmaceutical Research Institute



--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: using regexp in JSPs on Tomcat

2002-12-24 Thread Albert Wang
Hi Jeff,

PELOQUIN,JEFFREY (HP-Boise,ex1) wrote:


Albert,

The stack trace you show would imply that your class is indeed throwing the
RESyntaxExeception.
I would guess you class definition or class method allows the passing of the
Exception to the invoking class, in this case Jasper.

I would remove any Throws RESyntaxException from the class/method def and
wrap a try/catch around the new RE() statement.


I'm pretty sure that's what I'm doing.  Here is the particular method 
that I'm calling, which is contained in a class called InternalLink:
   public String parseDescription(String phrase)
   {
   String linkTypeDescription = getLinkType().getDescription();
   String primaryEntityLabel = phrase +   + 
getPrimaryEntity().getId();
   String secondaryEntityLabel = phrase +   + 
getSecondaryEntity().getId();
   RE ent1Expression = null;
   RE ent2Expression = null;
   try {
   ent1Expression = new RE(_ENT1_);
   ent2Expression = new RE(_ENT2_);
   } catch (org.apache.regexp.RESyntaxException e) {
   throw new TrackerException(regexp problem);
   }
   linkTypeDescription = 
ent1Expression.subst(linkTypeDescription, primaryEntityLabel);
   linkTypeDescription = 
ent2Expression.subst(linkTypeDescription, secondaryEntityLabel);
   return linkTypeDescription;
   }

Here's the offending little snippet of JSP code:

   %
   }

   InternalLink[] sampleIntLinks = sample.getAllInternalLinks();
   int numIntLinks = sampleIntLinks.length;
   if(numIntLinks  0) {
   %
   h2Internal Links/h2
   table border=1
   tr
   thDescription/th
   thActions/th
   /tr
   %
   Arrays.sort(sampleIntLinks);
   for(int i = 0; i  numIntLinks; i++) {
   int linkId = sampleIntLinks[i].getId();
   %
   tr
   td%= 
sampleIntLinks[i].parseDescription(Sample) %/td
   tda href = 
deleteInternalLink.jsp?sampleId=%= idString %linkId=%= linkId 
%delete/a/td
   /tr
   %
   }
   %
   /table

Strangely enough, even if I don't call parseDescription() within the 
JSP, I still get the exception as long as I just instantiate 
InternalLink.  Any clue what's going on here?

Thanks for the help, and happy holidays to all,
-Al

--
--
Albert Wang
DDED Informatics
Bristol-Myers Squibb Pharmaceutical Research Institute




--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]



RE: using regexp in JSPs on Tomcat

2002-12-24 Thread PELOQUIN,JEFFREY (HP-Boise,ex1)
hmmm,  do you use RE at all in the init method of your class?


also now that I look more carefully at the stack trace, you might try
looking at the compiled java for the calling jsp page. From your stack trace
the calling jsp page is viewSample.jsp, do you use any RE's in this jsp?

the compiled java code will be found within the
$TOMCAT/work/servername/path/to/jsp
the offending line will be 367, because of the use of a $ in the file name
you may have trouble vi'ing or more'ing the file.  I usaully ftp such files
to a windows machine.

javax.servlet.ServletException: org/apache/regexp/RESyntaxException
at 
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:471)
at org.apache.jsp.viewSample$jsp._jspService(viewSample$jsp.java:367)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)


Jeff

-Original Message-
From: Albert Wang [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 24, 2002 11:45 AM
To: Tomcat Users List
Subject: Re: using regexp in JSPs on Tomcat


Hi Jeff,

PELOQUIN,JEFFREY (HP-Boise,ex1) wrote:

Albert,

The stack trace you show would imply that your class is indeed throwing the
RESyntaxExeception.
I would guess you class definition or class method allows the passing of
the
Exception to the invoking class, in this case Jasper.

I would remove any Throws RESyntaxException from the class/method def and
wrap a try/catch around the new RE() statement.

I'm pretty sure that's what I'm doing.  Here is the particular method 
that I'm calling, which is contained in a class called InternalLink:
public String parseDescription(String phrase)
{
String linkTypeDescription = getLinkType().getDescription();
String primaryEntityLabel = phrase +   + 
getPrimaryEntity().getId();
String secondaryEntityLabel = phrase +   + 
getSecondaryEntity().getId();
RE ent1Expression = null;
RE ent2Expression = null;
try {
ent1Expression = new RE(_ENT1_);
ent2Expression = new RE(_ENT2_);
} catch (org.apache.regexp.RESyntaxException e) {
throw new TrackerException(regexp problem);
}
linkTypeDescription = 
ent1Expression.subst(linkTypeDescription, primaryEntityLabel);
linkTypeDescription = 
ent2Expression.subst(linkTypeDescription, secondaryEntityLabel);
return linkTypeDescription;
}

Here's the offending little snippet of JSP code:

%
}

InternalLink[] sampleIntLinks = sample.getAllInternalLinks();
int numIntLinks = sampleIntLinks.length;
if(numIntLinks  0) {
%
h2Internal Links/h2
table border=1
tr
thDescription/th
thActions/th
/tr
%
Arrays.sort(sampleIntLinks);
for(int i = 0; i  numIntLinks; i++) {
int linkId = sampleIntLinks[i].getId();
%
tr
td%= 
sampleIntLinks[i].parseDescription(Sample) %/td
tda href = 
deleteInternalLink.jsp?sampleId=%= idString %linkId=%= linkId 
%delete/a/td
/tr
%
}
%
/table

Strangely enough, even if I don't call parseDescription() within the 
JSP, I still get the exception as long as I just instantiate 
InternalLink.  Any clue what's going on here?

Thanks for the help, and happy holidays to all,
-Al

-- 
--
Albert Wang
DDED Informatics
Bristol-Myers Squibb Pharmaceutical Research Institute




--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]