Bean in tomcat
Hi - I created a parameterHandling.jsp- This JSP is placed in the location -
C:\Program Files\Apache Group\Tomcat 4.1\webapps\ROOT\sid
This JSP makes a reference to a bean called myBean - i have placed the bean in the same folder -
I am getting the following error-
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\sid\parameterHandling_jsp.java:7: '.' expected
import t;
^
1 error
Could some one please putr light on what is going erong in this case -
Hi - I created a parameterHandling.jsp- This JSP is placed in the location -
C:\Program Files\Apache Group\Tomcat 4.1\webapps\ROOT\sid
This JSP makes a reference to a bean called myBean - i have placed the bean in the same folder -
I am getting the following error-
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\sid\parameterHandling_jsp.java:7: '.' expected
import t;
^
1 error
Could some one please putr light on what is going erong in this case -
Similar Messages
-
Bean OSX Tomcat 4.0 problem
I have wrote a bean that runs another small application. The bean functions fine on Win2K. The application itself runs standalone fine on both Win2K and on OSX. However, nothing happens in Tomcat 4.0/OSX combo. Did someone encounter similar problem or knows what might be wrong/missing?
Thank You.
process = runtime.exec( "java -classpath path app param" )...sorry... for not being more clear...
Since we had OS X Tomcat combo the bean needed complete path to any command called through runtime.exec. -
Where do i save my beans in tomcat?
hi
I'm learning java beans and i'm relatively new to it. My jsp code is
<jsp:useBean id= "stringBean" class = "example.StringBean">
<jsp:setProperty name="stringBean" property="message" value="messg"/>
</jsp:useBean>
<html>
<head><title>Using Java Beans in a JSP page </title></head>
<body bgcolor = "blue">
<h3>The msg obtained by using a bean component is :</h3>
<font size = "5"><jsp:getProperty name="stringBean" property="message" />
</body>and the bean StringBean.java is
package example;
public class StringBean {
private String message = " No message " ;
public String getMessage() {
return (message);
public void setMessage(String message)
this.message = message;
}Whenver i run the jsp page i get an error as follows
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /beans.jsp(1,1) The value for the useBean class attribute example.StringBean is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1223)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Generator.generate(Generator.java:3284)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:189)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Can someone please help as to where do i save my class file in tomcat??I've also had this problem (sorry for resurrecting an old question) and I put my class in the classes folder last night (within a folder appropriately named for the package it's in) and I got the same message as above, even after restarting the web application. Do I need to restart anything else or tell Tomcat where the bean is?
Cheers
-- Kev
Just searched for different terms and found that my class needs a public default constructor. Seem to have missed that part ;�)
Message was edited by:
KevDGill -
Where to save the java bean in Tomcat?
hi,
im using a bean in a jsp. my coding of jsp is:
<html>
<head>
<title> JSP BEAN EXAMPLE </title>
</head>
<body>
<%@ page language="java" import="Counter" %>
<jsp:useBean id="counter" scope="session" class="Counter" />
<jsp:setProperty name="counter" property="count" param="count" />
<% out.println("Count from scriplet code:" + counter.getCounter() + "<br>"); %>
Count from jsp:getProperty:
<jsp:getProperty name="counter" property="count"/>
<br>
</body>
</html>
the bean is:
public class Counter
int count=0;
public Counter()
public int getCounter()
count++;
return this.count;
public void setCounter(int c)
this.count=count;
please tell me the correct location where i should save my bean file?
my jsp is saved at :Tomcat 4.1\webapps\ROOT
im getting an error such as
2005-02-19 14:11:31 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Cannot find any information on property 'count' in a bean of type 'Counter'
at org.apache.jasper.runtime.JspRuntimeLibrary.getReadMethod(JspRuntimeLibrary.java:704)
at org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:694)
at org.apache.jasper.compiler.Node$GetProperty.accept(Node.java:552)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:1028)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:1070)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:1076)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:232)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:1028)
at org.apache.jasper.compiler.Generator.generate(Generator.java:1917)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:242)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:369)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:536)
will some one please help me??hi
first use package to store ur bean class. and change ur mutator and accessor methods like this
setCount() and getCount()
ur jsp code is here
<html>
<head>
<title> JSP BEAN EXAMPLE </title>
</head>
<body>
<%@ page language="java" import="SampleLib.Counter" %>
<jsp:useBean id="counter"class="SampleLib.Counter" />
<jsp:setProperty name="counter" property="count" param="count"/>
<% out.println("Count from scriplet code:" + counter.getCount() + "<br>"); %>
Count from jsp:getProperty:
<jsp:getProperty name="counter" property="count"/>
<br>
</body>
</html>
ur bean is herepackage SampleLib; // i have added package statement here
public class Counter
int count=0;
public Counter()
public int getCount()
count++;
return this.count;
public void setCount(int c)
this.count=count;
Bye for now
sat -
Seeting up tomcat to run beans
Hi. I installed jdk1.3/tomcat 4.0 on my windows 2000 server, and it runs well with html and "plain" JSPs, but when I try to load a bean-calling JSP, got an "class not found" error. It seems tomcat cannot find mybean.class.
Somebody told me I had to "register" the bean in server.xml, but didn�t work.
There exists any standard procedure to run beans in tomcat? Thanks.you dont have to register javabeans in doc descriptor (and certailnly not server.xml). Most likely the bean is not in the class path. To keep it simple, If your bean's fully qualified name is com.foo.SomeBean then make sure you have SomeBean.class file at WEB-INF\classes\com\foo\ directory.
-
Help with JSP/Weblogic/Tomcat Discrepencies
Hi,
I have something very strange happening. I recently did some JSP stuff on
WLS60SP1 and all went quite well. I then took those same JSP pages and tried
them out on the latest release of TOMCAT. I was really impressed that
everything seemed to be completely transparent and working just fine until
the following situation:
When I reference, within a JSP page, an object that has previously been
added to the request scope that has just been created, but not messed with
in anyway...meaning all the attributes in this bean have their default
values set...and they are all Strings with the exception of one Integer
using this format:
<%= custVal.getCustomerNumber() %>
- In WLS, what shows in the text field on the form is nothing, because
customer number in the custVal object is null (default for a String)..this
is what I want.
- In Tomcat, what shows it the word "null".
...here is the weird part, by changing from scriptlet references to the
<jsp:getProperty....> format such as....
<jsp:getProperty name="custVal" property="customerNumber"/>
-In WLS, he is still a happy camper and works just fine regardless of how I
reference the bean
-In Tomcat, I also get the correct results that I want.
So, unlike most postings, I found out how to fix it but I would like to know
why...any ideas?
Thanks in advance,
Paul Reed
www.jacksonreed.com
object training and mentoring
Jackson-Reed, Inc. 888-598-8615
www.jacksonreed.com
Author of "Developing Applications with Visual Basic and UML"
http://www.amazon.com/exec/obidos/ASIN/0201615797/jackreedinc/104-0083168-31
95939
Author of "Developing Applications with Java
Try http://localhost:7001/HelloWorld.jsp
"b. patel" <[email protected]> wrote:
>
>I need help with running a simple JSP. I created a WLS domain using the
>WebLogic
>Configuration Wizard. I am trying to access HelloWorld.jsp which is
>located under
>C:\bea\user_projects\wlsdomainex\applications\DefaultWebApp.
>I type
>http://localhost:7001/DefaultWebApp/HelloWorld.jsp. I get 404 - Page
>Not Found
>Error. The weblogic server starts Succesfully. I am trying this in Win
>2K environment.
>
>I am new to WebLogic. Thanks for your Help in advance.
>
-
Eliminate Scriptlets in form radio
I have a web form working great for the past year using Scriptlets and Bean in Tomcat 6.0.20.
Now I would like to eliminate the Scriptlets and use EL instead.
Please advise how I can get the below radio input to work with EL in my JSP. All my attempts are not working.
Bean that worked with the Scriptlet:
public String getCityRadio(String myField)
String myRadio = "";
if(getCity() != null)
if(getCity().equals(myField))
myRadio = "checked";
return myRadio;
}JSP works with Bean and Scriptlets:<jsp:useBean id="cityBean" class="beanPackage.CityBean" scope="request" />
Boston <input type="radio" name="city" value="Boston" <%= cityBean.getCityRadio("Boston") %>>
<br>
Buffalo <input type="radio" name="city" value="Buffalo" <%= cityBean.getCityRadio("Buffalo") %>>
<br>
Portland <input type="radio" name="city" value="Portland" <%= cityBean.getCityRadio("Portland") %>>My attempt to use EL instead of Scriptlet does not work with any of the below attempts. None of my EL attempts show any checked value or the check shows up only at the last radio button only.
//tried this:
Buffalo <input type="radio" name="city" value="Buffalo" ${cityBean.cityRadio["Buffalo"]}>>
Portland <input type="radio" name="city" value="Portland" ${cityBean.cityRadio["Portland"]}>>
//tried this:
Portland <input type="radio" name="city" value="Portland" ${cityBean.cityRadio[city]}>>
//tried this:
Portland <input type="radio" name="city" value="Portland" ${cityRadio[cityBean.city]}>>
//tried this:
Portland <input type="radio" name="city" value="Portland" ${getCityRadio[cityBean.city]}>>You have in fact discovered one of the cases where there is no direct mapping between java code and EL : Calling a method that takes parameters.
There is no way to do this in EL. You can't directly call methods that don't follow the getter/setter pattern.
There are a few possible ways around this
1: Put the condiitional logic onto the JSP page:
Boston <input type="radio" name="city" value="Boston" <c:if test="${cityBean.city=='Boston'"}checked</c:if>>
<br>
Buffalo <input type="radio" name="city" value="Buffalo" <c:if test="${cityBean.city=='Buffalo'"}checked</c:if>>
<br>
Portland <input type="radio" name="city" value="Portland" <c:if test="${cityBean.city=='Portland'"}checked</c:if>>Hey, its view logic in any case. Why not?
This is in fact a prime case for a custom tag.
Particularly since you are referencing each value 3 times in each line of code here.
A better approach would be to have
- a list of values {Boston, Buffalo, Portland} - in an attribute called "cityList"
- The currently selected value (eg Buffalo) (currently in cityBean.city)
and then loop over your entire list, checking it against the currently selected value.
<jsp:useBean id="cityBean" class="beanPackage.CityBean" scope="request" />
<c:forEach var="city" items="${cityList}">
${city}<input type="radio" name="city" value="${city}" <c:if test="${cityBean.city==city"}checked</c:if>>
</c:forEach>cheers,
evnafets -
Implementing Clustering in HFM
Dear All,
I am trying to implement clustering in HFM.
When I am going into EPM system Configurator and select HFM - configure application clusterI am unable to see both the HFM servers that are available.
Only this server on which I am running the configuration utility is available.
Please suggest.
Thanks,
ParmodHi,
I am trying to create a cluster on two servers with same name ‘Cluster292’ and than adding the respective servers to it so that both the servers are registered under the same cluster.
I have 2 servers infva0292 and infva02899.
On infva0292 I have created a cluster Cluster0292 and registered it successfully with server infva0292.
On infva02899 I have created a cluster Cluster0292 and when I try to register it with server infva02899 it fails.
Please advise . Urgently help is required.
I wont mind any brainstorming
This is my hfm_1_config.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<bean name="main">
<bean name="appServerConfiguration">
<property name="serverSelected">Tomcat 5</property>
<bean name="Tomcat 5">
<property name="manualProcessing">false</property>
<property name="winService">true</property>
</bean>
<bean name="WebLogic 9">
<property name="BEA_HOME">C:\bea</property>
<property name="location">C:\bea\weblogic91</property>
<property name="manualProcessing">false</property>
<property name="winService">true</property>
</bean>
<bean name="WebSphere 6">
<property name="location">C:\WebSphere\AppServer</property>
<property name="manualProcessing">false</property>
<property name="winService">true</property>
</bean>
</bean>
<bean name="customConfiguration">
<property name="adminGrp">admingrp</property>
<bean name="cluster1">
<property name="clusterName">Cluster292</property>
<property name="currentSession">true</property>
<property name="server1">infva02899</property>
</bean>
<property name="creatorGrp">admingrp</property>
<property name="dataSyncDelay">300</property>
<property name="deletedClusters"/>
<property name="enableSelected">true</property>
<property name="encryptUDL">false</property>
<property name="FileTransferFolderPath">C:\Hyperion\products\FinancialManagement\Web\HFM\FileTransfer</property>
<property name="financialManagementInstallationDir">C:\Hyperion\products\FinancialManagement\Web\HFM</property>
<property name="financialManagementPort">80</property>
<property name="financialManagementSessionTimeout">1200</property>
<property name="financialManagementVirtualDir">hfm</property>
<property name="financialManagentEnabled">true</property>
<property name="isLcmProxyKeepAlive">true</property>
<property name="isSvProxyKeepAlive">false</property>
<property name="LcmHTTPCompressionEnabled">true</property>
<property name="LCMInstallationDir">C:\Hyperion\products\FinancialManagement\Web\HFMLCMService</property>
<property name="lcmProxyKeepAliveInterval">60</property>
<property name="LCMSessionTimeout">1800</property>
<property name="LCMVirtualDir">hfmlcmservice</property>
<property name="lifeCycleManagementEnabled">true</property>
<property name="NumMaxDBConnections">40</property>
<property name="password">URnlXC0+PVaB6SSPlsunjQ==</property>
<property name="registeredClusters"/>
<property name="registeredServers">infva02899</property>
<property name="selectedTask">clusterRegister</property>
<property name="serverDelay">300</property>
<property name="smartviewEnabled">true</property>
<property name="smartviewInstallationDir">C:\Hyperion\products\FinancialManagement\Web\HFMOfficeProvider</property>
<property name="smartviewSessionTimeout">1200</property>
<property name="smartviewVirtualDir">hfmofficeprovider</property>
<property name="SvHTTPCompressionEnabled">true</property>
<property name="SystemDataLinkFile">C:\Hyperion\products\FinancialManagement\MS_SQL_SERVER_hfm.udl</property>
<property name="upgradeClient">false</property>
<property name="username">DCOMUser</property>
<property name="warnClient">false</property>
<property name="WebMaxUploadSize">1073741824</property>
<property name="WebResponseBufferSize">4194304</property>
<property name="workingFolder">C:\Hyperion\products\FinancialManagement\Server Working Folder</property>
</bean>
<bean name="dbConfiguration">
<bean name="DB2_82">
<property name="dbName">hypdb</property>
<property name="host">infva02899.vshodc.lntinfotech.com</property>
<property name="password">WgPVGsYX+KY=</property>
<property name="port">50000</property>
<property name="userName">hypuser</property>
</bean>
<bean name="MS_SQL_SERVER">
<property name="dbName">EPM13HSS</property>
<property name="host">infva0292</property>
<property name="jdbcUrl">jdbc:hyperion:sqlserver://infva0292:1433;DatabaseName=EPM13HSS</property>
<property name="password">C94qvK24r8vM8QeIikYgIg==</property>
<property name="port">1433</property>
<property name="userName">sa</property>
</bean>
<bean name="MSSQLServer">
<property name="dbName">hypdb</property>
<property name="host">infva02899.vshodc.lntinfotech.com</property>
<property name="password">WgPVGsYX+KY=</property>
<property name="port">1433</property>
<property name="userName">hypuser</property>
</bean>
<bean name="MSSQLServer2005">
<property name="dbName">hypdb</property>
<property name="host">infva02899.vshodc.lntinfotech.com</property>
<property name="password">WgPVGsYX+KY=</property>
<property name="port">1433</property>
<property name="userName">hypuser</property>
</bean>
<bean name="Oracle10">
<property name="dbName">hypdb</property>
<property name="host">infva02899.vshodc.lntinfotech.com</property>
<property name="password">WgPVGsYX+KY=</property>
<property name="port">1521</property>
<property name="tablespaceData"><default></property>
<property name="tablespaceIndex"><default></property>
<property name="userName">hypuser</property>
</bean>
<bean name="Oracle9">
<property name="dbName">hypdb</property>
<property name="host">infva02899.vshodc.lntinfotech.com</property>
<property name="password">WgPVGsYX+KY=</property>
<property name="port">1521</property>
<property name="tablespaceData"><default></property>
<property name="tablespaceIndex"><default></property>
<property name="userName">hypuser</property>
</bean>
<property name="serverSelected">MS_SQL_SERVER</property>
</bean>
<bean name="licenseConfiguration">
<property name="licenseHostName">infva02899.vshodc.lntinfotech.com</property>
<property name="licensekey">*</property>
<property name="licensePort">Default</property>
</bean>
<bean name="sharedServicesConfiguration">
<property name="host">infva02899.vshodc.lntinfotech.com</property>
<property name="password">41JS7FLl71HM8QeIikYgIg==</property>
<property name="port">28080</property>
<property name="ssl">false</property>
<property name="userName">admin</property>
</bean>
<property name="shortcutFolderName">Oracle EPM System/Financial Management</property>
<property name="state">Configuration Failed</property>
<bean name="taskConfiguration">
<property name="clusterConfig">Configured</property>
<property name="clusterRegister">Configuration Failed</property>
<property name="hfmAppServerConfig">Configured</property>
<property name="hfmDComConfig">Configured</property>
<property name="hfmDsnConfig">Configured</property>
<property name="hfmWebServerConfig">Configured</property>
<property name="hubRegistration">Configured</property>
<beanList name="maintenanceTasks">
<listItem>
<property>hubRegistration</property>
</listItem>
</beanList>
<beanList name="preSelectedTasks">
<listItem>
<property>hubRegistration</property>
</listItem>
<listItem>
<property>hfmAppServerConfig</property>
</listItem>
<listItem>
<property>hfmDComConfig</property>
</listItem>
<listItem>
<property>relationalStorageConfiguration</property>
</listItem>
<listItem>
<property>clusterRegister</property>
</listItem>
<listItem>
<property>hfmWebServerConfig</property>
</listItem>
<listItem>
<property>clusterConfig</property>
</listItem>
</beanList>
<property name="relationalStorageConfiguration">Configured</property>
</bean>
</bean>
</root> -
Hi and thanks for previous answers, but my page import trouble continues.
I have now compiled a class, myBean.class and placed it in this folder ...
ROOT/WEB-INF/classes/peters/beans/
when I use ...
<%@ page import="peters.beans.*" %>
Tomcat finds the path, but using
<%@ page import="peters.beans.myBean" %>
a class not found exception appears.
I can�t understand why, it it something wrong with the public/private properties in myBean?
This is the syntax ...
public class myBean
��private String sName="Pette";
public myBean()
public String getName()
return sName;
Thanks for any answers.
Have a nice day / reg. PGJippy, I found a solution!
First I added the line - package pg; - to the testBean class and placed the file in ROOT/WEB-INF/classes/pg
The I used the following jsp-tags in my .jps-file
<%@ page import="pg.*" %>
<jsp:useBean id="theBean" scope="page" class="pg.testBean" />
/pg -
Problem using a bean in JSP on Tomcat 5.0.28
Hi,
I'm new to JSP, I've installed Tomcat 5.0.28 and I'm able to run JSP but when I try an asp wich uses a bean it gives me this error, the directory structure is
testingProject with the first.jsp
testingProject\WEB-INF\classes\myPackage with the test.class
the first.asp
<%@ page import="myPackage.Test" %>
<html><head><title>Test</title></head>
<body bgcolor=white>
<jsp:useBean id="list" class="myPackage.Test"> </jsp:useBean>
<jsp:getProperty name="list" property="value1" />
<%=list.value1%>
<p>
</body></html>
the Test.java
package myPackage;
public class Test{
String value1="testinggggggggg";
public void Test(){
public String getValue1(){ return value1}
the error
thanks in advance
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 6 in the jsp file: /first.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat 5.0\work\Catalina\localhost\testingProject\org\apache\jsp\first_jsp.java:60: cannot resolve symbol
symbol : variable value1
location: class myPackage.Test
out.print(list.value1);
^
1 error
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)There are two ways of getting info from the bean.
1) the jsp:getProperty tag, which seems correct in your code
2) the <%= ... tag. In that case you must write a valid java expression. In your case: list.getValue1() -
Beginner trying to get my beans to work with jsp on tomcat
Please help me open my eyes!
I know this is a stupid oversight on my part, but I've been working for days on getting other things to work on my tomcat server, so I'm out of ideas on this one.
I've followed all the tomcat docs instructions on where to put my jsp and bean files and set my classpath to where my beans are located. jsps work fine for me but when I try to run this jsp that uses my CalcBean, I get this and similar internal server errors:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 1 in the jsp file: /jsp/calc/calculate.jsp
Generated servlet error:
C:\jakarta-tomcat-4.0\work\Standalone\localhost\research\jsp\calc\calculate$jsp.java:56: Class org.apache.jsp.CalcBean not found.
CalcBean calc = null;
^
Do I need to register my bean somewhere like web.xml?
Thanks so much in advance for any help!!rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
-
Tomcat 4.1 Bean error (Unable to compile class for JSP)
Help,
I am using Tomcat 4.1 with with JDK1.3.1_01. I have a JSP page in which I try to use a Bean, but I get the following error from Tomcat.
The JSP page is very simple. I am using package names in the import statement. Code below.
I've put the class files under
<TOMCAT>\webapps\projectname\WEB-INF\classes under the appropriate packages. What else is missing? I can not figure out what I am doing wrong.
***************** START JSP CODE *********************
<html>
<head>
<title>User Information</title>
</head>
<%@ page session="true" %>
<%@ page import="com.xxx.yyy.data.*" %>
<body>
<P> </P>
<P> </P>
<P> </P>
<!--
<jsp:useBean id="user" class="com.xxx.yyy.data.User" scope="session"/>
-->
<%
User user = (User) session.getAttribute("user");
%>
UserID = <%= user.getUserID() %><BR>
User Name = <%= user.getUserName() %><BR>
Password = <%= user.getPassword() %><BR>
Password Hint = <%= user.getPasswordHint() %><BR>
</body>
</html>
***************** END JSP CODE *********************
***************** START TOMCAT ERROR MESSAGE *********************
org.apache.jasper.JasperException: Unable to compile class for JSP
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:477)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:182)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2397)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
at java.lang.Thread.run(Thread.java:536)
root cause
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 20 in the jsp file: /userInfo.jsp
Generated servlet error:
[javac] Compiling 1 source file
D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:7: package com.xxx.yyy.data does not exist
import com.xxx.yyy.data.*;
^
D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:61: package com.xxx.yyy.data does not exist
com.xxx.yyy.data.User user = null;
^
An error occurred at line: 20 in the jsp file: /userInfo.jsp
Generated servlet error:
D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:63: package com.xxx.yyy.data does not exist
user = (com.xxx.yyy.data.User) pageContext.getAttribute("user", PageContext.SESSION_SCOPE);
^
An error occurred at line: 20 in the jsp file: /userInfo.jsp
Generated servlet error:
D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:66: package com.xxx.yyy.data does not exist
user = (com.xxx.yyy.data.User) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "com.xxx.yyy.data.User");
^
An error occurred at line: 25 in the jsp file: /userInfo.jsp
Generated servlet error:
D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:77: cannot resolve symbol
symbol : class User
location: class org.apache.jsp.userInfo_jsp
User user = (User) session.getAttribute("user");
^
An error occurred at line: 25 in the jsp file: /userInfo.jsp
Generated servlet error:
D:\Apache_Group\Tomcat_4.1\work\Standalone\localhost\PALBO\userInfo_jsp.java:77: cannot resolve symbol
symbol : class User
location: class org.apache.jsp.userInfo_jsp
User user = (User) session.getAttribute("user");
^
6 errors
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:120)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:315)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:326)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:182)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2397)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
at java.lang.Thread.run(Thread.java:536)
***************** END TOMCAT ERROR MESSAGE *********************Hi
I am running my Tomcat apps (on a Windows dev machine) in an alternate location (ie. not default webapps). The same crap comes to me every time. Unable to install etc. I have tried every trick in the book regarding classpath settings etc.
When I use 'javap' to check the classpath from any location on my machine, its works and javap returns the signature of my class.
When I use it though Tomcat (with the import set to include the filename), it get the error. I have heard rumors that using JDK 1.3 in stead of 1.4 helps, but I just want it to work with 1.4 :)
So if any of you can help me on this, please.
PS. On my linux server it works just fine, as does every other thing on that machine ;)
Chris (chris.schuit <at> euronet.nl) -
Bean: define problem in tomcat.But it is working fine in Jdeveloper. Why?
I am use a logic iterator tag for a dropdown list and bean :define for the show the values of the drop down list in jdeveloper. But in tomcat when i use this same code i got the following errors.
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 152 in the jsp file: /Trip_Consignor_Details_Insert.jsp
Generated servlet error:
[javac] Compiling 1 source file
/data/jakarta-tomcat-5.0.19/work/Catalina/localhost/Lost/org/apache/jsp/Trip_005fConsignor_005fDetails_005fInsert_jsp.java:315: cannot find symbol
symbol : method setValue(java.lang.Object)
location: class org.apache.struts.taglib.html.OptionTag
jspxth_html_option_0.setValue(param1);
^
An error occurred at line: 172 in the jsp file: /Trip_Consignor_Details_Insert.jsp
Generated servlet error:
/data/jakarta-tomcat-5.0.19/work/Catalina/localhost/Lost/org/apache/jsp/Trip_005fConsignor_005fDetails_005fInsert_jsp.java:414: cannot find symbol
symbol : method setValue(java.lang.Object)
location: class org.apache.struts.taglib.html.OptionTag
jspxth_html_option_1.setValue(param2);
^
Note: /data/jakarta-tomcat-5.0.19/work/Catalina/localhost/Lost/org/apache/jsp/Trip_005fConsignor_005fDetails_005fInsert_jsp.java uses unchecked or unsafe operations.
An error occurred at line: 172 in the jsp file: /Trip_Consignor_Details_Insert.jsp
Generated servlet error:
Note: Recompile with -Xlint:unchecked for details.
2 errors
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
I think this may caused for the following line of code--
<html:option value='<%=sUomCode%>'></html:option>
May i have to add a jar file for this tag in my classpath and keep the jar file in tomcat's [ jakarta-tomcat-5.0.19 ]/ common/lib?.
i am using ubuntu as os. Please suggest me.I set the classpath in enviornment file in /etc folder.
and in eclipse i did-- right click on project -->properties-->java build path-->Libraries-->Add External jars. [and add the two jars].
My code is ----
<html:select property="sLocCode">
<logic:iterate id="results" name="tripConsignor" property="result">
<bean:define id="param1" name="results" property="sLocCode"/>
<html:option value='<%=param1%>'></html:option>
</logic:iterate>
</html:select>
problem in the line ----
<html:option value='<%=param1%>'></html:option>
Is their any alternative to set the html values. I tried <bean:write>. But failed.
So i just want to set the value of <html:option value="-----------"></html:option>.
please give me the solution or alternative way to set the value. Please Help -
Using java beans in jsp using tomcat
hi i have made a form to enter user first name and last anme with html and then i have made a value javabean in which i want to store the information filled bu user. i want to display the information stored in java bean in jsp page i have made the full application and i have made class file of java bean as well as jsp file but when i try to run this web application in tomcat i am getting class not found exception.
could anybody tell me that where i should store the bean class in tomcat and do i need to make any package in which i have to place my java bean file plz tell me complete procedure along with code if possiblewhew thats a lot of questions... All of this is pretty basic stuff. I would recommend you take a look at the web services tutorial: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/
lets see.
Starting a package name with com is just a generic standard which is followed.
It is most correct when creating commercial packages to create packages like com.companyName.project
http://java.sun.com/docs/codeconv/html/CodeConventions.doc8.html
You should not need a page import directive unless you are using classes in scriptlets: ie <% %> tags in your JSP. Your jsp:useBean tag will automatically import necessary classes - you don't need to import classes for beans specifically
<jsp:useBean id="myClass" scope="session" class="com.myPackage" />
Your directory structure should be something like this
webApplicationRootDirectory
- page1.html
- page2.html
- page3.jsp
- page4.jsp
- WEB-INF
- web.xml
- classes
- com
- myPackage
- myClass.classerrrm. Thats about it I think. -
Cant find bean class from jsp page using Tomcat 4
Hi
I have searched numerpus forums and seen many posts from people who seem to have the same problem however none of the solutions seem to work for me.
I have a jsp page which is trying to call a bean method however I get an error
saying that the class for the bean cannot be found. I have :
1. put the class in a package called kolaBean under
C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\begjsp-ch01\WEB-INF\classes\kolaPackage
2. included the package statement in the java file for the bean
3. included an empty constructor in the java file for the bean
4. I have declared the above constructor as public (is this necessary?)
5. used the full package name:
kolaPackage.kolaBean bakedBean = new kolaPackage.kolaBean();
6. imported import java.beans.*; (is this necessary ?)
7. still got the same error...
Any pointers really really appreciated
Thanks
Kolain reply to David Rons email:
Is this a fresh install of tomcat? If so, it could be a configuration
problem.Yes it is
Is the class public in the package (I forget that all the time)?Yes it is. I have also declared the constructor to be public is this
necessary?
What's the error message?here is the error message:
An error occurred between lines: 11 and 14 in the jsp file:
/begjsp-ch01/kolaBean.jsp
Generated servlet error:
C:\Program Files\Apache Tomcat
4.0\work\localhost\_\begjsp-ch01\kolaBean$jsp.java:59: Class
kolaPackage.kolaBean not found.
kolaPackage.kolaBean bakedBean = new
kolaPackage.kolaBean();
^
2 errors
Thanks in advance
Kola
Maybe you are looking for
-
I sure hope someone can help me with these ipod classic 160gb issues. My ipod classic 160gb will be playing fine and then freeze up (unable to move around in it at all) and i have to reset it. This happens constantly whether in my car or when i liste
-
Hello, I am using Photoshop version 2014.2.2 (20141204.r.310x64) and Extension Manager version 7.3.2.39 running on a Windows 7 64-bit operating system with a Quadro K3000m graphics card and 16gb ram. I have a very peculiar problem which I am not able
-
Error when I added the Google iPhone API in my project!
Hi, I'm writing an app where I need the Google iPhone API! So I added the API in my project but when I'm trying to build it it gives me an error. Error: *Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with code
-
Problem with Bank of America website
Flash Player interferes with my opening Bank of America site. Internet Explorer says it cannot open the page. I have done the diagnostics on the connection. There is no problem and every other website works fine. I have to uninstall Flash Player, and
-
Hi everytime i try to update my apps on my Iphone 4s i keep getting the message unknown error, plz help Cheers Martin