Cannot Create HttpSession Object Tomcat 4.1
Hi,
I have a Servlet application that works fine on my local machine but when I try to deploy it on a commercial web server the program 'freezes' when it gets to the point in the program where a HttpSession object is created it simply stops with no Exception thrown.....
Any help would be greatly appreciated
Thanks in advance
Kev
post your code..
Similar Messages
-
Hi, When im giving a default value to a date column in the attribute settings i get this error when im running my jsp page (bc4j web application):
Error Message: JBO-25009: Cannot create an object of type:oracle.jbo.domain.Date with value: 31-dic-2099
How can i fix that? I�ve already trying all possible date formats.
ThankuThe default format for Date (oracle.sql.DATE which is the superclass of oracle.jbo.domain.Date) is yyyy-mm-dd.
-
Hi,
I have created a tree structure on the left side of the page and a table on the right hand of the page. My requirement is that when I click on the node on the left side, the table on the right needs to be refreshed. For the time being the tree nodes on the left side is just one level. Eveytime I click on the node, I get the following error
<RichExceptionHandler> <_logUnhandledException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase INVOKE_APPLICATION 5
javax.el.ELException: oracle.jbo.domain.DataCreationException: JBO-25009: Cannot create an object of type:java.math.BigDecimal from type:java.lang.String with value:Restricted
at com.sun.el.parser.AstValue.invoke(Unknown Source)
at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1589)
at org.apache.myfaces.trinidad.component.UIXTree.broadcast(UIXTree.java:237)
at oracle.adf.view.rich.component.rich.data.RichTree.broadcast(RichTree.java:308)
at org.apache.myfaces.trinidad.component.UIXCollection.broadcast(UIXCollection.java:157)
at org.apache.myfaces.trinidad.component.UIXTree.broadcast(UIXTree.java:244)
at oracle.adf.view.rich.component.rich.data.RichTree.broadcast(RichTree.java:308)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:112)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:106)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1137)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:361)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: oracle.jbo.domain.DataCreationException: JBO-25009: Cannot create an object of type:java.math.BigDecimal from type:java.lang.String with value:Restricted
at oracle.jbo.common.JboTypeMapEntries$2.convert(JboTypeMapEntries.java:135)
at oracle.jbo.domain.TypeFactory.get(TypeFactory.java:869)
at oracle.jbo.domain.TypeFactory.getInstance(TypeFactory.java:116)
at oracle.jbo.server.AttributeDefImpl.convertToJava(AttributeDefImpl.java:2220)
at oracle.jbo.server.ViewRowSetImpl.prepKeyForFind(ViewRowSetImpl.java:5377)
at oracle.jbo.server.ViewRowSetImpl.findByKey(ViewRowSetImpl.java:5394)
at oracle.jbo.server.ViewRowSetImpl.findByKey(ViewRowSetImpl.java:5296)
at oracle.jbo.server.ViewRowSetImpl.findByKey(ViewRowSetImpl.java:5290)
at oracle.jbo.server.ViewObjectImpl.findByKey(ViewObjectImpl.java:11628)
at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.syncTargetIter(JUCtrlHierNodeBinding.java:641)
at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.internalSetCurrentRow(JUCtrlHierNodeBinding.java:617)
at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.syncCurrentRow(JUCtrlHierNodeBinding.java:547)
at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.setRowAsCurrentOnTargetIterator(JUCtrlHierNodeBinding.java:561)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierNodeBinding.setRowAsCurrentOnTargetIterator(FacesCtrlHierNodeBinding.java:147)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$FacesModel.makeCurrent(FacesCtrlHierBinding.java:685)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
... 58 more
Caused by: java.lang.NumberFormatException
at java.math.BigDecimal.<init>(BigDecimal.java:459)
at java.math.BigDecimal.<init>(BigDecimal.java:728)
at oracle.jbo.common.JboTypeMapEntries$2.convert(JboTypeMapEntries.java:129)
... 76 more
Please can you let me know how I can resolve this issue.
ThanksHi, I have rechecked this issue. In the bug they say that Big Integer should be changed to Big Decimal to resolve the issue. I checked my application and saw that there is no Big Interger. Please can you guide me further.
-
Cannot Create Automation Object
Hi All,
I have essentially two problems are occuring the first is with Crystal
Reports 8.5 whereby running reports simeltaneously, one after the other
after the other, will intermittently after the 3rd or 4th report cause
windows to lock up and Notes 8 client will start to consume upwards of 100mb
of ram (in a minimum 1.25gb ram machine) and then 98-99% CPU Usage.
Assuming this was a problem with an older version of Crystal Reports, we
have upgraded and tested both Crystal Reports 9 Professional and Crystal
Reports 12 and thats where the "cannot create automation object" has
occured - this particular error will happen whenever we attempt to run any
report what so ever
Now that we've upgraded to Crystal Reports 9.0 Pro, we'd like to try and solve
the "cannot create automation object" error message we receive.
Have tried to communicate this problem with IBM, they insist the problem is crystal
related and not a problem with lotus notes.
Environment:
1. Lotus Domino Server, Release 8.0 for Windows/32
2. Windows 2003 Server (x86 edition) Service Pack 2
3. IBM Lotus Notes Version 8
4. Windows XP w/Service Pack 3
5. Symantec AntiVirus Full Version 10.1.5.5000
5a. Crystal Reports 9 for Reporting
Fault:
1. First Observed 18/07/2008
2. See above description
3. For the first problem with Crystal Reports version 8.5 - we upgraded our
client and server in test environment to Domino 8 and Notes 8 from Domino
6.5 and Notes 6.5, for the second problem it occured after we upgraded from
Crystal Reports 8.5 to Crystal Reports 9 & 12 versions.
4. Reinstalled Crystal Reports 8.5, no effect on first problem, installed
version 12 (from IBM website), second error, un-installed, reinstalled 8.5,
first error reappeared, reinstalled version 12 complete installation, same
problem (second error) uninstalled and installed version 9 trial and same
problem (second error)
Any help would be greatly appreciated.Is this happening in the Report Designer or in an application?
Please re-post if this is still an issue or purchase a case and have a dedicated support engineer work with you directly:
http://store.businessobjects.com/store/bobjamer/DisplayProductByTypePage&parentCategoryID=&categoryID=11522300?resid=-Z5tUwoHAiwAAA8@NLgAAAAS&rests=1254701640551 -
The printer is an OfficeJet J4540 All-In-One, running on Vista Home Premium x64. The orginal Solution Center faxed without any problems. I upgraded to new Solution Center and when I click on 'Send A Fax' I get this error message: "cannot create DIHPAiOFaxManger object". My OfficeJet can and does send faxes manually, but I would like to use the Solution Center. Please, help!!!
neptune49This might have been a quirk of the installation. So let's try to perform a complete and clean uninstallation and reinstallation. First if you use a USB cord, make sure to remove it. Do not plug it back in until the software directs you to. Then go through the Devices and Printers, Programs and Features and Device Manager folders and insure that all copies, files, and programs related to the printer are removed. Then as directed, restart the computer.
In the START menu type "%temp%" and press ENTER. Here I want you to press Ctrl+A and hit DELETE. Some of the files will not allow you to delete them, skip those files and delete the majority that allows it.
Then follow this link to download the full feature software and drivers for the printer:
http://h10025.www1.hp.com/ewfrf/wc/softwareDownloadIndex?softwareitem=mp-58704-2&cc=us&dlc=en&lc=en&...
Install that and let me know the result!
As an additional side note, you should also be able to use Windows Fax and Scan to fax from your PC as well.
Have a great day! -
Problem when creating new Objects in ESR
Hi ,
When i am trying to create new objects in ESR it is no allowing me to do,i have developed around 80 interfaces as of nowmsuddenly this eeror i getting,anyone experienced this kind of issue.
*You cannot create new objects since the system is not the original system of the software component version*
You cannot create new objects since the system is not
the original system of the software component version (NOT_ORIGINAL_NO_CREATE)
MESSAGE ID: com.sap.aii.ib.server.oa.rb_all.NOT_ORIGINAL_NO_CREATE
Regards,
RajHi Raja,
I am new to SAP PI. So i dunno much regarding SAP PI. Hence i am getting same error that not able to create objects in SWCV. I read this discussion but i dunno where to select the 'Modifiable & Original' options, so that i can enable the Objects. Can you please guide me?
Thanks,
Amarnath -
Import POJO create Entity Object?
Is it possible to import a POJO and create an Entity Object + table from it?
Hi,
you cannot create Entity Object from POJO but you can use POJO based model to generate Data Control and work with it "like with Entity Object" in view layer.
example: http://www.oracle.com/technology/products/jdev/tips/fnimphius/pojopagination/index.html
regards,
Branislav -
Hi all,
How to create HttpSession object in controller from pageContext reference variable.
Regards,
Haroon.Hi Haroon,
You can use like this
HttpSession httpsession = ((OAPageContextImpl)pageContext).getSession();
Regards,
Gyan -
Team,
I am trying to Install Exchange on my Lab, getting below error
message.
The Schema Role is installed on Root Domain and trying to install
exchange on Child domain.
1 Root Domain - 1 Child domain. both are located on single site.
“Setup encountered a problem while validating
the state of Active Directory: Exchange organization-level objects have not been created, and setup cannot create them because the local computer is not in the same domain and site as the schema master. Run setup with the /prepareAD parameter and wait for
replication to complete.”
Followed below articles:
http://support.risualblogs.com/blog/2012/02/21/exchange-2010-sp2-upgrade-issue-exchange-organization-level-objects-have-not-been-created-and-setup-cannot-create-them-because-the-local-computer-is-not-in-the-same-domain-and-site-as-the-sche/
http://www.petenetlive.com/KB/Article/0000793.htm
transferred the schema roles to different server on root domain, still no luck.
can someone please help me.
regards
Srinivasa k
Srinivasa KHi Srinivasa,
I guess, you didn't completed the initial setup schemaprep and adprep before starting the installation. You can do it as follows:
1. Open command Prompt as administrator and browse to the root of installation cd and run Setup.exe /PrepareSchema /IAcceptExchangeServerLicenseTerms
After finishing this,
2. Setup.exe /PrepareAD /OrganizationName:"<organization name>" /IAcceptExchangeServerLicenseTerms
3. To prepare all domains within the forest run Setup.exe /PrepareAllDomains /IAcceptExchangeServerLicenseTerms. If you want to prepare a specific domain run Setup.exe /PrepareDomain:<FQDN of the domain you want to prepare> /IAcceptExchangeServerLicenseTerms
4. Once you complete all of the 3 steps, install the pre-requisities for Exchange 2013
5. Finally, run the setup program
Hope this will help you
Regards from Visit ExchangeOnline |
Visit WindowsAdmin -
Cannot create a summary based on remote objects
Has anyone ever come across this error when creating a summary folder for a warehouse, using a DB Link?
Does anyone know how to resolve this?Hi
This is not a restiction of Discoverer, this is a SQL restriction, and it makes jolly good sense if you think about it.
You cannot create a materialized view across a database link. This is because the optimizer only works within its database. It cannot cross a database link because it will be interfering with the optimization of another database and thus will be unable to determine whether a query should be redirected. So if a query cannot be redirected, what's the point in having a materialized view, or, in Discoverer's language, a summary table?
How can you resolve this? Simple: you make sure that the summary and the objects upon which the summary will be based all exist within the same database.
I know this is probably not the answer that you wanted.
Best wishes
Michael -
Cannot create a session after the response has been committed (Tomcat 6)
I'm getting a rather annoying error when I try to open a pretty basic JSP page.
I'm rather new to the whole JSP scene, so I'm following the example found on pages 287 and onwards in "JSF in Action - Manning" in case anyone wanted to check my code against the source.
I've searched for about 4 hours now, coming back to this site a couple of times, once reading about writeouts and stuff. But I'm not really sure this is the issue in this case and if it is, where exactly the problem lies.
I've already fixed a number of errors I got (jtsl.jar and standard.jar missing etc...) but this particular problem is driving me (and my co-workers for that matter :-) ) up the wall.
Anyone willing to help me out here?
Error:
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Cannot create a session after the response has been committed
javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
root cause
java.lang.IllegalStateException: Cannot create a session after the response has been committed
org.apache.catalina.connector.Request.doGetSession(Request.java:2301)
org.apache.catalina.connector.Request.getSession(Request.java:2075)
org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833)
org.apache.myfaces.context.servlet.SessionMap.setAttribute(SessionMap.java:53)
org.apache.myfaces.util.AbstractAttributeMap.put(AbstractAttributeMap.java:103)
org.apache.myfaces.util.AbstractAttributeMap.put(AbstractAttributeMap.java:35)
org.apache.myfaces.application.jsp.JspStateManagerImpl.saveSerializedViewInServletSession(JspStateManagerImpl.java:523)
org.apache.myfaces.application.jsp.JspStateManagerImpl.saveSerializedView(JspStateManagerImpl.java:358)
javax.faces.application.StateManager.saveView(StateManager.java:47)
org.apache.myfaces.application.jsp.JspViewHandlerImpl$StateMarkerAwareWriter.flushToWriter(JspViewHandlerImpl.java:387)
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:322)
org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
Source Code of login.jsp:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<f:view>
<html>
<head>
<title>
<h:outputText value="ProjectTrack"/>
</title>
</head>
<body>
<table>
<tr>
<td>
<h:graphicImage url="/images/logo Skillteam.jpg"
alt="Welcome to ProjectTrack"
title="Welcome to ProjectTrack"
width="435" height="120"/>
</td>
<td>
<font face="Arial, sans-serif"
size="6">
<h:outputText value="ProjectTrack"/>
</font>
</td>
</tr>
http://forum.java.sun.com/post!default.jspa?forumID=45#
Click for bold </table>
</body>
</html>
</f:view>
web.xml & faces-config
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>ProjectTrack</display-name>
<welcome-file-list>
<welcome-file>faces/login.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
</web-app>
<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-config>
<navigation-rule>
<from-view-id>/login.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/inbox.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>failure</from-outcome>
<to-view-id>/login.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>Setup:
Eclipse Europe 3.3.0
Tomcat 6.0.13
MyFaces 1.2
JRE 1.6.0_02When searching for this error, this was the first page google gave me. I found the answer and just in case anyone else stumbles in here with the same question I thought I'd share my findings.
Unfortunately, if your problem is the same as mine, you're going to feel pretty silly. I was navigating to the wrong page. If MyFaces(when running tomcat) tries to resolve to a page that doesn't exist, the error given above is what happens.
In my case I accidentally put my .jsp page into the wrong directory and ended up banging my head against the wall for an hour figuring that out. Hope this helps someone. -
Cannot create DataSource, Exception in Tomcat 4.1
I am running into a major problem with Tomcat4.1 trying to access a Datasource.
I referenced about 7 articles one of which has the subject "Cannot create JDBC driver of class '' for connect URL 'null', cause..."
but he is using Tomcat 5. I even tried to simulate his solution to mine but still no use.
I tried to connect to the database the old fashion way and it worked... I get connected (JDBC connection w/o Datasource).
I changed the XML many times but with no luck. I must be doing something stupid that I can't see.
Any help is greatly appreciated.... I ran out of solutions...
I initially loaded my app through Tomcat manager and created the DataSource through Tomcat admin screen.
my CLASSPATH =
C:\J4Log\logging-log4j-1.2.9\dist\lib\log4j-1.2.9.jar;
C:\JBoss4-0\jboss-4.0.1sp1;C:\CONNX32\CONNXJDBC\JAVA\JAR\connxjdbc.jar;
C:\JBuilderX\lib\mysql-connector-java-3.0.15-ga-bin.jar;
C:\Program Files\Apache Group\Tomcat 4.1\common\lib\commons-dbcp-1.2.1.jar;
C:\Program Files\Apache Group\Tomcat 4.1\common\lib\commons-pool-1.1.jar;
C:\Program Files\Apache Group\Tomcat 4.1\common\lib\commons-collections-3.1.jar;
C:\Program Files\Apache Group\Tomcat 4.1\common\lib\mysql-connector-java-3.1.8-bin.jar
my web.xml =
<resource-ref>
<description>DB connection</description>
<res-ref-name>jdbc/MyDBASE</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>-------------------
The sample snipet to connect to the database (which works)
ConnectionHelper contains the following (simplified)...
Class.forName("com.mysql.jdbc.Driver").newInstance();
return DriverManager.getConnection("jdbc:mysql://10.0.3.52/MyDBASE?user=Myadmin&password=AdminPWD");
ConnectionHelper connectionHelper = new ConnectionHelper();
Statement st = null;
try {
Connection conn = connectionHelper.getConnection();
st = conn.createStatement();
System.out.println("\n=========== ssuucceessffullllllll=======\n");
catch (SQLException ex1) {
System.out.println("error connecting=================");
ex1.printStackTrace();
whenever i execute my JSP (which calls my java class .. code follows....
Context envCtx = (Context) init.lookup("java:comp/env");
DataSource ds = (DataSource)envCtx.lookup("jdbc/MyDBASE");it breaks on the DataSource giving..
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '
' for connect URL 'null', cause:
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:243)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:743)
at org.apache.commons.dbcp.BasicD.........--
Another error (which is from within the IDE) is
java.lang.NoClassDefFoundError: tyrex/jdbc/xa/EnabledDataSource at rg.apache.naming.factory.TyrexDataSourceFactory.getObjectInstance(TyrexDataSourceFactory.java:166)
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:164)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
at org.apache.naming.NamingContext.lookup(NamingContext.java:834)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
at simpleservlet.TestJSPBean.init(TestJSPBean.java:41)
at org.apache.jsp.testJSP$jsp._jspService(testJSP$jsp.java:115)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)--------------------------
and finally, Server.XML...
<?xml version='1.0' encoding='utf-8'?>
<Server className="org.apache.catalina.core.StandardServer" debug="0" port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"/>
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" debug="0" jsr77Names="false"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" debug="0"/>
<GlobalNamingResources>
<Environment name="simpleValue" override="true" type="java.lang.Integer" value="30"/>
<Resource name="jdbc/MyDBASE" scope="Shareable" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/MyDBASE">
<parameter>
<name>validationQuery</name>
<value>select now()</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://10.0.3.52/MyDBASE?autoReconnect=true</value>
</parameter>
<parameter>
<name>password</name>
<value>AdminPWD</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>4</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.gjt.mm.mysql.Driver</value>
</parameter>
<parameter>
<name>username</name>
<value>Myadmin</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
</ResourceParams>
</GlobalNamingResources>
<Service className="org.apache.catalina.core.StandardService" debug="0" name="Tomcat-Standalone">
<Engine className="org.apache.catalina.core.StandardEngine"
debug="0" defaultHost="localhost"
mapperClass="org.apache.catalina.core.StandardEngineMapper"
name="Standalone">
<Host className="org........
<Context className="org.apache.catalina.core.StandardContext" cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper"
cookies="true" crossContext="false" debug="0"
displayName="simpleservlet"
docBase="/WebModule1" mapperClass="org.apache.catalina.core.StandardContextMapper"
path="/WebModule1" privileged="false" reloadable="false" swallowOutput="false"
useNaming="true"
workDir="work\Standalone\localhost\WebModule1"
wrapperClass="org.apache.catalina.core.StandardWrapper">
<Resource auth="Container"
description="DB connection"
name="jdbc/MyDBASE" scope="Shareable"
type="javax.sql.DataSource"/>
</Context>
</Engine>
</Service>
</Server>Thanks in advance for ANY help.I am running into a major problem with Tomcat4.1 trying to access a Datasource.
I referenced about 7 articles one of which has the subject "Cannot create JDBC driver of class '' for connect URL 'null', cause..."
but he is using Tomcat 5. I even tried to simulate his solution to mine but still no use.
I tried to connect to the database the old fashion way and it worked... I get connected (JDBC connection w/o Datasource).
I changed the XML many times but with no luck. I must be doing something stupid that I can't see.
Any help is greatly appreciated.... I ran out of solutions...
I initially loaded my app through Tomcat manager and created the DataSource through Tomcat admin screen.
my CLASSPATH =
C:\J4Log\logging-log4j-1.2.9\dist\lib\log4j-1.2.9.jar;
C:\JBoss4-0\jboss-4.0.1sp1;C:\CONNX32\CONNXJDBC\JAVA\JAR\connxjdbc.jar;
C:\JBuilderX\lib\mysql-connector-java-3.0.15-ga-bin.jar;
C:\Program Files\Apache Group\Tomcat 4.1\common\lib\commons-dbcp-1.2.1.jar;
C:\Program Files\Apache Group\Tomcat 4.1\common\lib\commons-pool-1.1.jar;
C:\Program Files\Apache Group\Tomcat 4.1\common\lib\commons-collections-3.1.jar;
C:\Program Files\Apache Group\Tomcat 4.1\common\lib\mysql-connector-java-3.1.8-bin.jar
my web.xml =
<resource-ref>
<description>DB connection</description>
<res-ref-name>jdbc/MyDBASE</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>-------------------
The sample snipet to connect to the database (which works)
ConnectionHelper contains the following (simplified)...
Class.forName("com.mysql.jdbc.Driver").newInstance();
return DriverManager.getConnection("jdbc:mysql://10.0.3.52/MyDBASE?user=Myadmin&password=AdminPWD");
ConnectionHelper connectionHelper = new ConnectionHelper();
Statement st = null;
try {
Connection conn = connectionHelper.getConnection();
st = conn.createStatement();
System.out.println("\n=========== ssuucceessffullllllll=======\n");
catch (SQLException ex1) {
System.out.println("error connecting=================");
ex1.printStackTrace();
whenever i execute my JSP (which calls my java class .. code follows....
Context envCtx = (Context) init.lookup("java:comp/env");
DataSource ds = (DataSource)envCtx.lookup("jdbc/MyDBASE");it breaks on the DataSource giving..
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '
' for connect URL 'null', cause:
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:243)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:743)
at org.apache.commons.dbcp.BasicD.........--
Another error (which is from within the IDE) is
java.lang.NoClassDefFoundError: tyrex/jdbc/xa/EnabledDataSource at rg.apache.naming.factory.TyrexDataSourceFactory.getObjectInstance(TyrexDataSourceFactory.java:166)
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:164)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
at org.apache.naming.NamingContext.lookup(NamingContext.java:834)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
at simpleservlet.TestJSPBean.init(TestJSPBean.java:41)
at org.apache.jsp.testJSP$jsp._jspService(testJSP$jsp.java:115)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)--------------------------
and finally, Server.XML...
<?xml version='1.0' encoding='utf-8'?>
<Server className="org.apache.catalina.core.StandardServer" debug="0" port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"/>
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" debug="0" jsr77Names="false"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" debug="0"/>
<GlobalNamingResources>
<Environment name="simpleValue" override="true" type="java.lang.Integer" value="30"/>
<Resource name="jdbc/MyDBASE" scope="Shareable" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/MyDBASE">
<parameter>
<name>validationQuery</name>
<value>select now()</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://10.0.3.52/MyDBASE?autoReconnect=true</value>
</parameter>
<parameter>
<name>password</name>
<value>AdminPWD</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>4</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.gjt.mm.mysql.Driver</value>
</parameter>
<parameter>
<name>username</name>
<value>Myadmin</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
</ResourceParams>
</GlobalNamingResources>
<Service className="org.apache.catalina.core.StandardService" debug="0" name="Tomcat-Standalone">
<Engine className="org.apache.catalina.core.StandardEngine"
debug="0" defaultHost="localhost"
mapperClass="org.apache.catalina.core.StandardEngineMapper"
name="Standalone">
<Host className="org........
<Context className="org.apache.catalina.core.StandardContext" cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper"
cookies="true" crossContext="false" debug="0"
displayName="simpleservlet"
docBase="/WebModule1" mapperClass="org.apache.catalina.core.StandardContextMapper"
path="/WebModule1" privileged="false" reloadable="false" swallowOutput="false"
useNaming="true"
workDir="work\Standalone\localhost\WebModule1"
wrapperClass="org.apache.catalina.core.StandardWrapper">
<Resource auth="Container"
description="DB connection"
name="jdbc/MyDBASE" scope="Shareable"
type="javax.sql.DataSource"/>
</Context>
</Engine>
</Service>
</Server>Thanks in advance for ANY help. -
Cannot create weak reference to 'classobj' object
I am trying to run the python Script in a C# program using Iron Python I am getting this type of Error
cannot create weak reference to 'classobj' object
I am using this code for running the python code
var ironPythonRuntime = Python.CreateRuntime();
try
dynamic loadPython = ironPythonRuntime.UseFile("Program.py");
catch (Exception ex)
Console.WriteLine(ex.Message);Hi Mahesh,
About IronPython issue, It's third-party product. Please redirect to IronPython forum. The link as below.
https://ironpython.codeplex.com/workitem/list/basic
After search this error,
this thread tells me.
Try to use virtualenv. It is used to separate many instances of python and it's libraries - you can have as many virtual environments as possible: python 2.5 , 2.6 , 2.7, whatever - with any combinations of libraries - so you can have for example five
python 2.6 instances with different sets of libraries configured.
By the way, here is also a blog talking about
Running IronPython Scripts from a C# 4.0 Program
Now I will move your thread to "off-topic" forum. Thanks for your understanding.
Best regards,
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Cannot create resource instance (Works on NetBeans/Tomcat)
I have a project that works just fine in NetBeans w/ Tomcat but when I deploy it to Sun One Web Server 6.1 SP5 I get the following error:
StandardWrapperValve[jsp]: WEB2792: Servlet.service() for servlet jsp threw exception
javax.servlet.ServletException: Cannot create resource instance
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)
at jsps.index_jsp._jspService(_index_jsp.java:91)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:687)
at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:459)
at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:375)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:771)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:322)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:161)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:580)
----- Root Cause -----
javax.naming.NamingException: Cannot create resource instance
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:167)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
at org.apache.naming.NamingContext.lookup(NamingContext.java:834)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at jsps.index_jsp._jspService(_index_jsp.java:79)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:687)
at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:459)
at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:375)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:771)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:322)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:161)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:580)
I have the following in my in context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/BOEnterpriseTest1">
<Resource name="jdbc/dev10g" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@10.10.10.10:1521:dev" username="userid" password="pwd" maxActive="20" maxIdle="10" maxWait="-1"/>
</Context>
I have the following in my web.xml:
<resource-ref>
<description>jdbc:oracle:thin:@10..10.10.10:1521:dev</description>
<res-ref-name>jdbc/dev10g</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
What�s missing on the Sun One server?I am trying to do a refresh of a Crystal Reports report in a JSP.
Using the web.xml looking like:
<resource-ref>
<description>jdbc:oracle:thin:@10.10.
10.10:1521:dev10g</description>
<res-ref-name>jdbc/dev10g</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
and code in my JSP:
<%
InitialContext initContext = new InitialContext();
DataSource source = (DataSource) initContext.lookup("java:comp/env/jdbc/dev10g");
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
try{
DataSource ds = (DataSource)initCtx.lookup("Data");
catch ( NamingException e ){
DataSource ds = (DataSource) initContext.lookup("java:comp/env/jdbc/dev10g");
initCtx.bind("Data", ds);
I get the following error:
WEB2720: Error initializing naming context for context /BOEnterpriseTest1
javax.naming.NameNotFoundException: WEB3885: Name Data is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
at com.iplanet.ias.web.WebModule.verifyResType(WebModule.java:510)
at com.iplanet.ias.web.WebModule.bindResources(WebModule.java:410)
at com.iplanet.ias.web.WebModule.bindGlobalResourceRefs(WebModule.java:352)
at com.iplanet.ias.web.WebModule.createNamingContext(WebModule.java:323)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3718)
at com.iplanet.ias.web.WebModule.start(WebModule.java:251)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1133)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:652)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1133)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:355)
at org.apache.catalina.startup.Embedded.start(Embedded.java:995)
at com.iplanet.ias.web.WebContainer.start(WebContainer.java:431)
at com.iplanet.ias.web.WebContainer.startInstance(WebContainer.java:500)
at com.iplanet.ias.server.J2EERunner.confPostInit(J2EERunner.java:161)
What steps do I need to do on the Server side or in my code? -
Cannot create bean of class...using TOMCAT 3.1
my root is: "notwww.ucsd.edu/somesub/"
my beans are in .../WEB-INF/classes/aseBeans/
the error msg:
Error: 500
Location: /studentaffairs/aseAppValidate.jsp
Internal Servlet Error:
javax.servlet.ServletException: Cannot create bean of class aseBeans.AseApplicationBean
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:386)
at _0002faseAppValidate_0002ejspaseAppValidate_jsp_0._jspService(_0002faseAppValidate_0002ejspaseAppValidate_jsp_0.java:138)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:174)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:156)
at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Thread.java:496)
Root cause:
javax.servlet.ServletException: Cannot create bean of class aseBeans.AseApplicationBean
at _0002faseAppValidate_0002ejspaseAppValidate_jsp_0._jspService(_0002faseAppValidate_0002ejspaseAppValidate_jsp_0.java:71)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:174)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:156)
at org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338)
at java.lang.Thread.run(Thread.java:496)
I think I have all the necessary elements:
package aseBeans;
pickled my beans
<jsp:useBean id="app" scope="session" class="aseBeans.AseApplicationBean" >
<jsp:setProperty.../>
</jsp:useBean>
MANIFEST.MF was created, are the name/attribute pairs necessary?
Name: AseApplicationBean.class
Java-Bean: true
THANK YOUhubertn I modified the jsp file and the bean: here's the code:<!--
Copyright (c) 1999 The Apache Software Foundation. All rights
reserved.
Number Guess Game
Written by Jason Hunter, CTO, K&A Software
http://www.servlets.com
-->
<%@ page import = "num.NumberGuessBean" %>
<jsp:useBean id="numguess" class="num.NumberGuessBean" scope="session"/>
<jsp:setProperty name="numguess" property="*"/>
<html>
<head><title>Number Guess</title></head>
<body bgcolor="white">
<font size=4>
<% if (numguess.getSuccess()) { %>
Congratulations! You got it.
And after just <%= numguess.getNumGuesses() %> tries.<p>
<% numguess.reset(); %>
Care to try again?
<% } else if (numguess.getNumGuesses() == 0) { %>
Welcome to the Number Guess game.<p>
Play with default limits ( a number between 0 and 100)<p>
or enter upper and lower limits.<p>
<form method=get>
Play with defaults?: <input type=radio name=default value="yes">Yes
<input type=radio name=default value="no">No
</form>
<% if (numguess.getRadio().equals("no")) { %>
<form method=get>
Enter upper limit:<input type=text name=upperLimit>
Enter lower limit:<input type=text name=lowerLimit>
</form>
<% numguess.reset(); %>
<% } %>
<form method=get>
What's your guess? <input type=text name=guess>
<input type=submit value="Submit">
</form>
<% } else { %>
Good guess, but nope. Try <b><%= numguess.getHint() %></b>.
You have made <%= numguess.getNumGuesses() %> guesses.<p>
I'm thinking of a number between <jsp:getProperty name="numguess" property="lowerLimit"/> and <jsp:getProperty name="numguess" property="upperLimit"/>.<p>
<form method=get>
What's your guess? <input type=text name=guess>
<input type=submit value="Submit">
</form>
<% } %>
</font>
</body>
</html>
and the bean:
* Originally written by Jason Hunter, http://www.servlets.com.
package num;
import java.util.*;
public class NumberGuessBean {
int answer;
boolean success;
String hint;
int numGuesses;
String radiochoice;
int lowerLimit=0;
int upperLimit=100;
String error;
public NumberGuessBean() {
reset();
public void setGuess(String guess) {
numGuesses++;
int g;
try {
g = Integer.parseInt(guess);
catch (NumberFormatException e) {
g = -1;
if (g == answer) {
success = true;
else if (g == -1) {
hint = "a number next time";
else if (g < answer) {
hint = "higher";
else if (g > answer) {
hint = "lower";
public void setRadio(String s) {
radiochoice=s;
public String getRadio() {
return radiochoice;
public void setLowerLimit( int lowerLimit) {
this.lowerLimit=lowerLimit;
public int getLowerLimit() {
return lowerLimit;
public void setUpperLimit(int upperLimit) {
this.upperLimit=upperLimit;
public int getUpperLimit() {
return upperLimit;
public boolean getSuccess() {
return success;
public String getHint() {
return "" + hint;
public String getError() {
return ""+error;
public int getNumGuesses() {
return numGuesses;
public void reset() {
if (getRadio().equals("yes")) {
answer = (int)(Math.random()*100);
else {
int i;
i=(int)(Math.random()*upperLimit);
if (i<lowerLimit) {
i=i+lowerLimit;
answer=i;
success = false;
numGuesses = 0;
}
Maybe you are looking for
-
IMac Adapter Out Questions (Mini-DVI to VGA)
Hi everyone, I've got a 2.4ghz C2D 24" iMac. For two years I had the iMac hooked up to my LCD tv via this route: iMac -> Mini-DVI-to-VGA adapter -> 75' VGA Cable -> LCD TV. I recently upgraded my TV, and no longer have a VGA port on the TV. I'm not l
-
How to restrict pdf printing on a condition
Hello, We generate the pdf and distribute it to the user immediately. I've a business requirement to allow the user to print the pdf a maximum of 3 times. I was able to add the javascript to the pdf to make a webservice call that would keep a track o
-
Adobe form script changes not reflected when PDF created by ADS.
Hello Experts, We have done some modifications (UI elements java script) in PDF form in the Development system and tested... everything fine and as expected everything working. When we move the same changes to Quality system, the expected functionali
-
I cannot find in the Verizon UI where to set up emailed bills. I am not receiving these currently nor am I receiving paper bills. Can anyone tell me where to set this up in the user interface at Verizon? TIA JG
-
How to delete the leading letters
Hi friends, In my report in one variable i am getting value of guid and id no combinely, but i want to read only one id value so how can i get the only id value in this guid contains 32 characters and partner id is varried so how can i delete the