| tomcat/applet question... |
|
 |
Index ‹ java-programmer
|
- Previous
- 1
- The server encountered an internal error () that prevented itHi All
I am using Developing a Spring Framework MVC application step-by-step
from www.springframework.org. I use apache-tomcat-5.5.23, Ant 1.6 and
jdk1.4.
when i used ant, ant deploy, ant list and ant build the these all
commands
give me message suceessful but when i write url(http://localhost:8080/
springapp/hello.htm) on the browser then I am getting the following
error. do you have solution for this problem.
type Exception report
message
description The server encountered an internal error () that prevented
it from fulfilling this request.
exception
org.apache.jasper.JasperException: /WEB-INF/jsp/hello.jsp(1,1) The
absolute uri: http://java.sun.com/jstl/core cannot be resolved in
either web.xml or the jar files deployed with this application
org.apache.jasper.compiler.DefaultErrorHandler.jsp
Error(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatc
h(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspErro
r(ErrorDispatcher.java:88)
org.apache.jasper.compiler.Parser.processIncludeDi rective(Parser.java:
340)
org.apache.jasper.compiler.Parser.parseIncludeDire ctive(Parser.java:
373)
org.apache.jasper.compiler.Parser.parseDirective(P arser.java:485)
org.apache.jasper.compiler.Parser.parseElements(Pa rser.java:1557)
org.apache.jasper.compiler.Parser.parse(Parser.jav a:127)
org.apache.jasper.compiler.ParserController.doPars
e(ParserController.java:212)
org.apache.jasper.compiler.ParserController.parse( ParserController.java:
101)
org.apache.jasper.compiler.Compiler.generateJava(C ompiler.java:156)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:296)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:277)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:265)
org.apache.jasper.JspCompilationContext.compile(Js
pCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.servic
e(JspServletWrapper.java:299)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:
315)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
org.springframework.web.servlet.view.InternalResou
rceView.renderMergedOutputModel(InternalResourceVi ew.java:97)
org.springframework.web.servlet.view.AbstractView.
render(AbstractView.java:250)
org.springframework.web.servlet.DispatcherServlet.
render(DispatcherServlet.java:928)
org.springframework.web.servlet.DispatcherServlet.
doDispatch(DispatcherServlet.java:705)
org.springframework.web.servlet.DispatcherServlet.
doService(DispatcherServlet.java:625)
org.springframework.web.servlet.FrameworkServlet.s
erviceWrapper(FrameworkServlet.java:386)
org.springframework.web.servlet.FrameworkServlet.d
oGet(FrameworkServlet.java:346)
javax.servlet.http.HttpServlet.service(HttpServlet .java:690)
javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
Thanks
- 2
- Problem with Session Beans stateHi, I'm currently making a session bean, which will eventually act as
a Shopping Basket.
I have implemented the bean so that it just accepts a string (which
will eventually be an object reference), and the user can add and
remove strings.
Unfortunately, if I access the same bean from another machine and
create an instance of the session bean, they are shown the same
contents as from the other machine.
The session bean type is set to stateful (and I have tried stateless).
Can anyone point me in the direction of the problem please?
Cheers,
David
- 3
- Unicode value of a characterHi,
I am a beginner in Java programming and I would like to know which
code ( program ) I must write to get the Unicode value of any
character ?
Thank you very much for your help !
JPR105.
- 3
- where is the maximize button in JDialog?Anybody knows how to get a JDialog to display a maximize
button like a JFrame does? The default JDialog does not come with
maximize or minimize button? I checked out the API for JDialog and
could not find the answer. Can anybody help me out?
- 7
- JCE - load key from stringHi All,
We're trying to use JCE to encrypt some data. The issue is key storage.
We want to store it in some database, so the question is how to
re-create the key for decryption from varchar2 column?
The key in string form looks like this:
cryptix.jce.provider.key.RawSecretKey@3bfce353
This can be stored in the database easily. But how to load this into
KeyStore back?
TIA
Michael
- 7
- Eclipse: browsing sourcecode using { as marksHello everyone,
I am using eclipse 3.0.2 on Linux. Is it possible to browse
Java-sourcecode using the brackets { as a jumping point?
example
public void foo(){ <- first entry
if(isFoo){ <- second entry
doFoo();
}else{ <- third entry
doAnotherFoo();
}
thanks alot for any help!
kind regards
Oliver
- 7
- type safety in java 1.5 (bug or hole?)"John C. Bollinger" <email***@***.com> schrieb im Newsbeitrag
news:c8g89n$esu$email***@***.com...
> It would all the same be a nice complement to generics if the 1.5
> compiler would indeed issue warnings about user-inserted casts that are
> not provably correct. (I.e. those that the compiler cannot simply
> ignore). That would give Bracha's comment (that started this confusion)
> broad enough scope to no longer be confusing.
I agree very much.
BTW, there's another comment from Bracha in the very same paper that's
confusing (me): He says "The Java virtual machine does not directly support
overriding of methods with different return types. This feature is supported
by the compiler.". What does this mean? Does this mean that the different
return types are gone at run time? Here's an example:
static class A {
static A create() { return new A(); }
public A m(A a) { System.out.println("A->A"); return a; }
}
static class B extends A {
static B create() { return new B(); }
public B m(A a) { System.out.println("A->B"); return (B) a; }
public B m(B b) { System.out.println("B->B"); return b; }
}
public void testOverriding() {
A a_a = A.create(); // static type A, dynamic type A
A a_b = B.create(); // static type A, dynamic type B
B b_b = B.create(); // static type B, dynamic type B
A a2 = a_a.m(a_b); // prints: A->A
A a3 = a_a.m(b_b); // prints: A->A
A a5 = a_b.m(a_b); // prints: A->B <== overriding works
A a6 = a_b.m(b_b); // prints: A->B <== overriding works
B b2 = b_b.m(a_b); // prints: A->B
B b3 = b_b.m(b_b); // prints: B->B
}
public void testReflection() {
try {
System.out.println(
B.class.getMethod("m", new Class[] {A.class}).getReturnType()
== B.class
); // prints: true <== reflection works, too
}
catch (Throwable t) {
throw new RuntimeException("Laufzeitfehler", t);
}
}
So there's obviously some runtime support for overriding methods with a
different return type, because in this example both the overriding and the
reflection worked. Then what did Bracha mean?
2004-05-24, York.
--
werres at uni minus bremen.de
http://www.uni-bremen.de/~werres
- 9
- Applets and J2SE 5.0 - problems?I set my IE browser (corporate edict to use IE...ugh)
to use the 9/30 FCS release of 5.0
Whenever I visit a page with an applet, the browser
crashes.
Someone at our local user group (www.javasig.com)
mentioned something about version mismatches (???).
Anyone else experience this?
btw, kudos to Calvin Austin (J2SE 5.0 spec lead) and
the rest for a very organized and efficient release.
Frank G.
+==========================================+
| Crossroads Technologies Inc. |
| www.CrossroadsTech dot com |
| fgreco at REMOVE!cross!roads!tech!dot com|
+==========================================+
- 11
- 'back engineering' java appletshi,
is it possible to gain access to java code by a user using an applet over
the web? i know with some scripting languages like PHP or javascript then
users can view the code and 'back engineer' it to discover how it works etc.
is this possible with java?
thanks
- 11
- data lost issue using socketsHi,
I have an interesting issue with socket programming.
I would like to send String based information via Sockets.
As it could happen, that a part of the information gets lost on its
way to the client, I would like to send before all such packages the
size of the package as a "short" value (or something equal, but not
string because you can never be sure that your string completely
arrived ).
Does anybody know what is an elegant solution for this problem?
I send the strings using:
PrintWriter out = new PrintWriter(client.getOutputStream(), true);
out.println("test");
Thanks,
korcs
- 11
- "Invalid column name" inserting a row with weblogic/oracle
bsaastad wrote:
> Hello,
>
>
>
> Environment
>
> Weblogic 8.1, Oracle 9.0.1, JDK1.4
>
>
>
> I am attempting to migrate from WLS 6.1 to WLS 8.1. All appears to work
> with the exception of database inserts. They ALWAYS fail and return an
> "ORA-00904: invalid column name". I am connecting to the database via a
> pooled data source. This code worked fine under WLS6.1 using the
> Weblogic JDriver. The JDriver performs the inserts under 8.1 but the
> Statement.executeBatch() command returns a 0-length int[] (an
> acknowledged bug in the JDriver.) BEA says to use the drivers supplied
> by Oracle. I have tried both the type 4 driver and the type 2 oci
> driver with exactly the same result.
Odd. Would you pleaes download the latest appropriate version of
oracle's driver and either run this code in a standalone program
getting your connection directly from the driver, or get the driver
to the front of the -classpath argument in the startWeblogic script,
and then run this code in the server again?
thanks,
Joe Weinstein at BEA
>
>
>
> I can query the database via the connection and dump the contents of the
> queried row along with the column names using the ResultMetaData.
>
>
>
> ex.
>
>
>
> ResultSet rs = stmt.executeQuery( sqlCmd );
>
> ResultSetMetaData rsmd = rs.getMetaData();
>
> System.out.println( "Results of '" + sqlCmd + "'");
>
> while ( rs.next() )
>
> {
>
> for( int i = 1; i <= rsmd.getColumnCount(); i++)
>
> {
>
> System.out.println( "'" + rsmd.getColumnName(i) +
> "=" + rs.getString( i ) + "' " );
>
> }
>
> }
>
>
>
> .. produces:
>
>
>
> Results of 'SELECT POOL_ID, POOL_NM, POOL_DESC, REV_BY, REV_DT FROM
> POOL_R WHERE POOL_ID = 11'
>
>
>
> 'POOL_ID=11'
>
> 'POOL_NM=COMM'
>
> 'POOL_DESC=Communications Servers'
>
> 'REV_BY=saastabp'
>
> 'REV_DT=2002-12-16'
>
>
>
> Then when I turn around and try to insert a row like this:
>
>
>
> String sqlCmd = "INSERT INTO POOL_R (POOL_ID, POOL_NM, POOL_DESC,
> REV_BY, REV_DT) VALUES (100, 'FRED', 'TEST POOL NAME FOR FRED', 'test-
> user', {ts '2003-10-24 16:00:26.703'})";
>
>
>
> System.out.println( "[" + sqlCmd + "]");
>
> stmt.executeUpdate( sqlCmd);
>
>
>
> .. I get the exception below. Has anyone seen this before? Any ideas?
>
>
>
> Thanks,
>
> -Brian
>
>
>
> [INSERT INTO POOL_R (POOL_ID, POOL_NM, POOL_DESC, REV_BY, REV_DT) VALUES
> (100, 'FRED', 'TEST POOL NAME FOR FRED', 'test-user', {ts '2003-10-24
> 16:00:26.703'})]
>
>
>
> java.sql.SQLException: ORA-00904: invalid column name
>
>
>
>
>
> at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutbound-
> Request.java:108)
>
>
>
> at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef-
> .java:138)
>
>
>
> at weblogic.jdbc.rmi.internal.StatementImpl_weblogic_jdbc_wrapp-
> er_Statement_oracle_jdbc_driver_OracleStatement_811_WLStub.exec-
> uteUpdate(Unknown Source)
>
>
>
> at weblogic.jdbc.rmi.internal.StatementStub_weblogic_jdbc_rm-
> i_internal_StatementImpl_weblogic_jdbc_wrapper_Statement_ora-
> cle_jdbc_driver_OracleStatement_811_WLStub.executeUpdate(Unk-
> nown Source)
>
>
>
> at weblogic.jdbc.rmi.SerialStatement_weblogic_jdbc_rmi_internal-
> _StatementStub_weblogic_jdbc_rmi_internal_StatementImpl_weblogi-
> c_jdbc_wrapper_Statement_oracle_jdbc_driver_OracleStatement_811-
> _WLStub.executeUpdate(Unknown Source)
>
>
>
> at com.billing.tm.persist.BatchTest.doInsert(BatchTest.java:93)
>
>
>
> at com.billing.tm.persist.BatchTest.main(BatchTest.java:185)
>
>
>
> Caused by: java.sql.SQLException: ORA-00904: invalid column name
>
>
>
>
>
> at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError-
> .java:134)
>
>
>
> at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
>
>
>
> at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:579)
>
>
>
> at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1894)
>
>
>
> at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol-
> .java:1094)
>
>
>
> at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleSta-
> tement.java:2132)
>
>
>
> at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStat-
> ement.java:2015)
>
>
>
> at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(Orac-
> leStatement.java:2877)
>
>
>
> at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleState-
> ment.java:858)
>
>
>
> at weblogic.jdbc.wrapper.Statement.executeUpdate(Statement-
> .java:328)
>
>
>
> at weblogic.jdbc.rmi.internal.StatementImpl_weblogic_jdbc_wrapp-
> er_Statement_oracle_jdbc_driver_OracleStatement.executeUpdate(U-
> nknown Source)
>
>
>
> at weblogic.jdbc.rmi.internal.StatementImpl_weblogic_jdbc_wrapp-
> er_Statement_oracle_jdbc_driver_OracleStatement_WLSkel.invoke(U-
> nknown Source)
>
>
>
> at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef-
> .java:466)
>
>
>
> at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef-
> .java:409)
>
>
>
> at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Aut-
> henticatedSubject.java:353)
>
>
>
> at weblogic.security.service.SecurityManager.runAs(SecurityMana-
> ger.java:144)
>
>
>
> at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServ-
> erRef.java:404)
>
>
>
> at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecu-
> teRequest.java:30)
>
>
>
> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java)
>
>
>
> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
>
>
> --
> Posted via http://dbforums.com
- 11
- Form doesn't submit onUnload in NetscapeDear Netscape/Javascript/Java gurus,
I am trying to submit a form onUnLoad when the user accidentally
closes the browser before clicking on a link to complete the
transaction.
On IE, this works fine.
But on Netscape or Mozzilla browsers, the form would simply not submit
when
the browser is closed.
here is the code.
<script language="JavaScript">
function CheckWindowClosed() {
document.MyForm.submit();
}
</script>
<body onLoad="FunctionHandler();" onUnload="CheckWindowClosed();">
Kindly let me know if there is any workaround or fix where I can get
this working on Netscape.
Thanks and Regards,
Yash
- 11
- using parameterized ArrayListI am trying to read write <Event> objects to an ArrayList ... but when
I try to convert the arraylist back to the object arrayit gives me a
ClassCastException for the line
return (Event[]) a.toArray();
--------------------------------------
BufferedReader ois = null;
ArrayList<Event> a = new ArrayList<Event>();
try {
ois = new BufferedReader(new FileReader(this.calFile));
Event e = null;
String line;
while ((line = ois.readLine()) != null) {
e = new Event(line);
a.add(e);
}
ois.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
} catch (InvalidTimeRangeException e) {
e.printStackTrace();
}
if (a.isEmpty())
return null;
return (Event[]) a.toArray();
- 14
- gui builder for javaHi,
I just started programming java and I am looking for a free gui builder for
java on linux or windows platforms. Where can I find it.
thanks
Johan
- 15
- XML Validation problemI am having alot of trouble getting a XML document validated with a
schema.
I got a sample document and schema off of w3schools.com, which passed
an online xml validator:
http://tools.decisionsoft.com/schemaValidate.html. I cannot, however,
get them validated programmatically.
The documents are:
node.xsd:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com"
elementFormDefault="qualified"><xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element></xs:schema>
node.xml:
<?xml version="1.0"?>
<note
xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com note.xsd">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
I'm using java 1.5 currently, although I had problems with 1.4 and
xerces, so I'm pretty confident the problem isn't related to the java
version.
My code is:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setIgnoringElementContentWhitespace(true);
factory.setIgnoringComments(true);
SchemaFactory sFact =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
factory.setSchema(sFact.newSchema(new java.io.File(SCHEMA_FILE)));
DocumentBuilder builder = factory.newDocumentBuilder();
builder.setErrorHandler(new ErrorHandler() {
public void warning (SAXParseException exception) throws SAXException
{
System.err.println(exception);
}
public void error (SAXParseException exception) throws SAXException {
System.err.println(exception);
}
public void fatalError (SAXParseException exception) throws
SAXException {
System.err.println(exception);
}
});
org.w3c.dom.Document doc = builder.parse(file);
The error I recieve is:
org.xml.sax.SAXParseException:
http://www.w3.org/TR/xml-schema-1#cvc-elt.1?note
org.xml.sax.SAXParseException:
http://www.w3.org/TR/xml-schema-1#cvc-elt.1?note
Exception in thread "main" java.lang.IllegalStateException
at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl$3.checkState(ValidatorHandlerImpl.java:411)
at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl$3.getElementTypeInfo(ValidatorHandlerImpl.java:441)
at com.sun.org.apache.xerces.internal.jaxp.JAXPValidatorComponent$SAX2XNI.elementAug(JAXPValidatorComponent.java:299)
at com.sun.org.apache.xerces.internal.jaxp.JAXPValidatorComponent$SAX2XNI.endElement(JAXPValidatorComponent.java:291)
at com.sun.org.apache.xerces.internal.jaxp.XNI2SAX.endElement(XNI2SAX.java:163)
at com.sun.org.apache.xerces.internal.jaxp.validation.XNI2SAXEx.endElement(XNI2SAXEx.java:108)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:818)
at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.endElement(ValidatorHandlerImpl.java:339)
at com.sun.org.apache.xerces.internal.jaxp.XNI2SAX.endElement(XNI2SAX.java:163)
at com.sun.org.apache.xerces.internal.jaxp.JAXPValidatorComponent.endElement(JAXPValidatorComponent.java:206)
at com.sun.org.apache.xerces.internal.xinclude.XIncludeHandler.endElement(XIncludeHandler.java:790)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1241)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:248)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:169)
...
I am behind a web proxy, and I don't know if the validation process
involves retrieving files at the URLs in the xml and xsd files, which
could be the problem.
can someone shed some light on this?
Thanks in advance.
|
| Author |
Message |
Frances Del Rio

|
Posted: 2005-8-14 7:58:00 |
Top |
java-programmer, tomcat/applet question...
this is really weird, in tomcat/webapps/<appName>I have a jsp AND an
applet.. I'm using a package called smack for writing jabber clients
(http://www.jivesoftware.org/smack/), so:
in jsp:
<%@ page import="org.jivesoftware.smack.*"%>
no problems...
in applet:
import org.jivesoftware.smack.*;
when try to compile get told this package doesn't exist...
package is where all packages are supposed to be in Tomcat
(C:\tomcat\common\lib) and, again, the jsp has no problems with it, but
the applet, which is in exact same location as jsp, for some reason
can't find it..
(in applet am even getting en error (identifier expected) on
system.out.println()... don't know what to make of this..
this is line: System.out.println("test");...)
weird thing is, if I hide System.out.println() line get told package
smack doesn't exist.. if I don't hide System.out.println() line get
ONLY identifier-expected error on System.out.println() line..
would appreciate any help... thank you.. Frances
|
| |
|
| |
 |
Tor Iver Wilhelmsen

|
Posted: 2005-8-14 15:50:00 |
Top |
java-programmer >> tomcat/applet question...
Frances Del Rio <email***@***.com> writes:
> package is where all packages are supposed to be in Tomcat
> (C:\tomcat\common\lib) and, again, the jsp has no problems with it,
> but the applet, which is in exact same location as jsp, for some
> reason can't find it..
Er, applets don't run on the server but in the browser; they do not
have access to the lib directory on the server. You need to build the
applets using a classpath, then include the classes so that the
browser can get them.
> this is line: System.out.println("test");...)
You cannot have code outside of code blocks, like methods; that error
is something you get if that statements is at the "top level" in the
sourcefile.
> weird thing is, if I hide System.out.println() line get told package
> smack doesn't exist.. if I don't hide System.out.println() line get
> ONLY identifier-expected error on System.out.println() line..
It's not weird it's a consequence of that being two different parts of
compilation: Syntax parsing and dependency checking.
|
| |
|
| |
 |
Frances Del Rio

|
Posted: 2005-8-14 21:20:00 |
Top |
java-programmer >> tomcat/applet question...
Tor Iver Wilhelmsen wrote:
> Frances Del Rio <email***@***.com> writes:
>
>
>>package is where all packages are supposed to be in Tomcat
>>(C:\tomcat\common\lib) and, again, the jsp has no problems with it,
>>but the applet, which is in exact same location as jsp, for some
>>reason can't find it..
>
>
> Er, applets don't run on the server but in the browser; they do not
> have access to the lib directory on the server.
of course.. I hadn't thought of that... I found my error, as I
indicated in a follow-up to my own OP (had to tell javac the classpath
to that package..) this is all on my tomcat locally for now; but once I
put this applet up on my website it won't run on users' machines unless
this package gets somehow downloaded to their machines, right? (I mean
make it part of jre somehow, that downloads if users don't have jre in
their machines?) hmmm.... one more thing to think about...
you're right about System.out.println().. has to be inside a block, not
just in applets, but also in stand-alone's and servlets (just tried all
three...)
public class myApp {
System.out.println(" ");
no go....... :-o
ok, many thanks for yr help..
Frances
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- I am having trouble with OJB and locking when adding things that have cascading relationshipsHi all, I am using OJB and I can't seem to add a record to the
database if that object contains another object that is a) mapped in
the mapping and b) not already in the mapping. The error I get is:
OJB works reliably in all the other test suits:
-- adding any object and not imposing any connections, ie, they have
no elements that need to cascade
-- retreiving results (either with a criteria or alll records)
I dont know whats going on and would appreciate som ehelp - thanks in
advance
Josh
Time: 2.674
There was 1 error:
1) testAddProjectWithExistingEmployer(com.joshlong.portfolio.bos.tests.PortfolioTest)com.joshlong.portfolio.PortfolioException:
org.odmg.LockNotGrantedException: Can not lock ID:0Finished:Mon Nov 10
04:02:34 PST 2003
Started:Mon Nov 10 04:02:34 PST 2003
Title:Foo Bar
Employer:
------------------------
public void testAddProjectWithNewEmployer()
throws Exception {
// the pk for the Employer class is id and I didnt
//set it -- I want OJB to add it as well as add the Employer
//which also doesnt have the pk set which I presume makes it
// add it as opposed to updating it ...
Employer employer = new Employer();
employer.setContactInfo("this is the contact info");
employer.setName("le nom - " + new Date());
employer.setDuties("a;b;c;d");
portfolio.addEmployer(employer); // see below fo rthe code
behind addEmployer ( Employer);
Employer e = portfolio.getEmployerByName(name);
Project project = new Project();
project.setEmployer(employer);
project.setDescription("This is a description of the
things.");
project.setFinished(new Date());
project.setStarted(new Date());
project.setName("Joshua Long");
portfolio.addProject(project);
}
addEmployer is basically just a more specific method that in turn
calls:
void addRecord ( Object record )
throws PortfolioException
{
Implementation i = OJB.getInstance();
Database db = i.newDatabase();
db.open("default", Database.OPEN_READ_WRITE);
Transaction txc = i.newTransaction();
txc.begin();
txc.lock(record, Transaction.WRITE);
txc.commit();
db.close() ;
}
- 2
- Sessionhandling with Apache AxisHello Group,
i 've already written a littlr webservice with Apache Axis.
My Service starts a thread to process some data. The Client may
Access the output via different functions.
Everything very fine.
But if i kick the Client and the Session times out after 30
minutes, the thread is still running... and running... and running...
I want to tell the Service to kick the Thread after a timeout,
maybe this should possible via a Session.
How can i find out if a Session is timed out?
Thanks for your help and a happy x-mas (ok ok, some days to early :-) )
Greetings,
Steffen
- 3
- translate fitsG0ldmark Industries, Inc ( G D K I )
THIS ST()CK IS E><TREMELY U_NDERVA_LUED
Huge Advert|sing Campaign this week!
Breakout Forecast for July, 2006
Cu_rrent Price: $7.02 (5 days ago was $5)
Sh0rt Term Price Target: $12.00
Rec0mmendati0n: Str0ng Buy
RECENT H0T NEWS released MUST READ ACT NOW
LOS ANGELES & VANCOUVER, British Columbia---(July 5, 2006)
Goldmark Industries, Inc. ( G D K I - News) is excited to announce
that the Company is embarking into a new business direction. The
Company is making an aggressive move into the multi-billion-dollar
Urban Entertainment industry. The Hip-Hop Entertainment industry
generates several billion dollars per year in product sales with
an estimated consumer-based purchasing power well into the hundreds
of billions of dollars and topping over one trillion worldwide.
About Goldmark Industries, Inc ( G D K I ):
Goldmark Industries is preparing to stand at the forefront of
the Hip Hop consumer market, offering a wide range of urban
entertainment services in Music, Feature Films, Television,
Home Video/DVD and Major Events
Compaq Diag. viewing SCSI
fast spelling checks
sda named numbering
FFSYes. include: UDFCDROM NFS
refer
typically
Business Desktop Education
Lite. Winner:
thisswap via vnode
intend soit
extracted multiuser went planned
youwill gathered istime asa
Home Hobby
average meeting passed. realtime:
code Select extended
toavoid incurring working
prepared restoring
/var/swap thatisnumbering figure going /u.
macppc zaurus andcats
Mrpm: qWrite
drop frames
removed code.
wdb thekernel
thefile. creating /var/swap thatis
offset
mountyour above.You procedure plugging
modifying it: wd
feed needed listed above:
probably outside unable fetch
configure
work. clock proven most
shareware
Can access
newone theblocks
unknown j: aswell curious
length.RM missing
BIOSs abilityto
submit
buggy chipsets
Contents. Using OpenBSDs
WatchdogwdEnter Command Show reinitGraph: Creates
gathered istime asa /dev/wdm
numbering figure going
--
To UNSUBSCRIBE, email to email***@***.com
with a subject of "unsubscribe". Trouble? Contact email***@***.com
- 4
- How can I make my applet call another Web page?Hi All,
Would anyone know a way to have an applet call another Web page so
that, after the new page is loaded, if I hit the back button then I go
back to the page where the applet is at?
I don't need to know about button action events or about layout
managers or anything like that, just the URL processing code, or a
good reference.
Thank you,
S.
- 5
- Secret LaunchJoin now to make money
http://www.secretlaunch.com/?codelion
- 6
- JTable and optimal column width.Hi!
I have a JTable which has to columns filled over an 'String[][]'. Is it
possible, to set the cell width to the longest value in an column?
I found a solution with String.lengt() over Google, but this doesn't work
correctly because the value of String.length() doesn't fit exactly. I think
this is because the proportional fonts.
Greetings,
Christian.
- 7
- Quick help needed. Code runs, but one problem cannot be solvedHey, guys. I designed this code for guessing numbers.
The program should pick a random number between 1 and 10, inclusive
both. Then repeatedly prompt the user to guess the number. On each
guess report to the user that he or she is correct or that the guess is
high or low. Continue accepting guesses until the user guesses
correctly or choose to quit. Count the number of guesses and report
that value when the user guesses correctly. At the end of each game,
prompt to determine whether the user wants to play again. Continue
playing games until the user chooses to stop
Here is the problem, I let the random number print, so I know what
number is it. But when I input that number, instead of showing up
"Congratulations...", it shows up the correct number I entered is too
high. Please let me know what is going on. Thank you
//Code started!
import java.util.Random;
import java.util.Scanner;
public class HighLow
{
//
// Plays the Hi-Lo guessing game with the user
//
public static void main(String[] args)
{
boolean done = false;
boolean playAgain = true;
Random numberGenerator = new Random();
int randomNumber, numberOfGuesses, userNumber;
Scanner scan = new Scanner(System.in);
//
// Constants for messages to the user
//
final String guessMessage = "Enter your guess (-1 to quit): ";
final String tooHigh = "Sorry, the number you entered is higher than
my number.";
final String tooLow = "Sorry, the number you entered is lower than my
number.";
final String justRight = "Congratulations! You guessed my number!";
final String playAgainMessage = "Play again?";
while (playAgain) {
//
// Pick a random number
//
randomNumber = numberGenerator.nextInt(10) + 1;
System.out.println("The correct number is " +randomNumber);
//
// Start the guessing game
//
System.out.print(guessMessage);
userNumber = scan.nextInt();
numberOfGuesses = 1;
if (userNumber > randomNumber)
{
System.out.println(tooHigh);
numberOfGuesses += 1;
}
if (userNumber <0 && userNumber!=-1)
{
System.out.println("1-10 only");
}
if (userNumber < randomNumber && userNumber > 0)
{
System.out.println(tooLow);
numberOfGuesses += 1;
}
if (userNumber == randomNumber)
{
System.out.println(justRight);
numberOfGuesses += 1;
System.out.println("It taks you " +numberOfGuesses+ " times to
guess right");
}
//
// Check to see if the user wants to stop guessing
//
if (userNumber == -1)
done = true;
//
// Check to see if the user wants to play again
//
System.out.print("Would you like to play again? (y/n)? ");
if (scan.next().equals("n"))
playAgain = false;
else
done = false;
} // while loop
System.out.println("Thanks for playing! Bye!" );
} //method main
} //class HiLoGame
- 8
- HttpUrlConnection caching ipHello,
I got an ip caching problem when using HttpUrlConnection class.
When using the code :
URL url = new URL("http://a.domain");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
The VM seems to cache the ip address associated with the domain "a.domain".
If the ip associated with this domain change, the VM still connect to the
old ip. The only way to connect to the new ip, is to restart the VM.
I have tried
java.security.Security.setProperty("networkaddress.cache.ttl", "0");
but it does not work with HttpUrlConnection (it works fine with InetAddress
class for instance).
Any idea ?
Thank you,
Christophe
- 9
- menu drawn behind canvasHi,
I have a JFrame with a menu bar and inside the the frame a canvas. When I
click on a menu item
the menu is always (partly) drawn behind the canvas. How do you set the
options that will draw the menu(bar) to be visible ?
thanks
Johan
- 10
- ServerSocket & multiple clientsNeed help please.
I am trying to write a small client-server application that uses a
ServerSocket that allows connection of two clients via two ports (one on each
port, say 3000 & 4000).
I've tried different techniques, but always get the first client working but
the second client waiting until after the first client has ended (see code
snippet below).
How should I approach this (without the use of threads)?
(I am using the loopback address of "127.0.0.1" as both clients are on the
same PC)
private ServerSocket ss1;
private ServerSocket ss2;
private Socket socket1;
private Socket socket2;
try
{
ss1 = new ServerSocket(3000);
ss2 = new ServerSocket(4000);
}
and then
socket1 = ss1.accept();
socket2 = ss2.accept();
- 11
- java6 does it address default focus on a modal formIts always been near impossible to dynamically set a field with the
default focus when a form (perhaps previously instantiated) is
setVisible - if the form is a modal dialog.
Does anyone know if Java 6 addresses this?
- 12
- 13
- Rollover button problemI'm building a site in Dreamweaver MX where I have a set of rollover
buttons. These buttons go dim when the mouse is over them. When clicked,
another image appears on a different part of the page (I built this using
the Set Nav Bar image function). This all works fine on my Mac, using my
browser safari and Internet Explorer. But on a PC using Internet Explorer
the rollovers dim but when clicked nothing happens. Does anybody know why?
I can paste the code if that helps anybody . I'm not too good at
understanding Java script code so let me know what bits might help
Thanks
Kate
- 14
- XPathAPI(node, xpathStr) & XPathContext.getDTMHandleFromNode(node) slowHello,
I am using xalan 2.7.0: http://xml.apache.org/xalan-j/
As I run XPathAPI.eval(node, xpathStr) over and over again on several
nodes, it gets slower and slower.
This is documented in the XPathAPI documentation, and it suggests to
use the low-level XPath API:
http://xml.apache.org/xalan-j/apidocs/org/apache/xpath/XPathAPI.html
I am now using the low-level XPath API as follows:
XPathContext xpathSupport = new XPathContext();
PrefixResolverDefault prefixResolver = new
PrefixResolverDefault(document);
XPath xpath = new XPath(xpathStr, null, prefixResolver,
XPath.SELECT, null);
and then, for each node:
int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode);
XObject object = xpath.execute(xpathSupport, node,
prefixResolver);
It gets a bit better, but still, after using over and over again on
several nodes, it gets slower and slower.
I think that the problem is that
XPathContext.getDTMHandleFromNode(child) does not free memory.
Test this simplistic example yourself:
++++++++++++++++++++++++++++++++++++++++++++
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import org.apache.xpath.*;
import org.apache.xml.utils.*;
public class Test {
public static void main(String[] argv) throws Exception {
int numChilds = 100000+1;
System.out.println("Building a document with " + numChilds + "
childs");
Document doc =
DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
Element root = doc.createElement("root");
doc.appendChild(root);
for (int i = 0; i < numChilds; i ++) {
Element child = doc.createElement("child");
root.appendChild(child);
Element subChild = doc.createElement("sub-child");
child.appendChild(subChild);
Element subSubChild = doc.createElement("sub-sub-child");
subChild.appendChild(subSubChild);
subSubChild.setAttribute("title", "title" + i);
}
XPathContext xpathSupport = new XPathContext();
PrefixResolverDefault prefixResolver = new
PrefixResolverDefault(doc);
XPath titleXpath = new XPath("sub-child/sub-sub-child/@title",
null, prefixResolver, XPath.SELECT, null);
Runtime r = Runtime.getRuntime();
System.out.println("Evaluating XPath for each " + numChilds +
" childs");
NodeList nodeList = root.getChildNodes();
int size = nodeList.getLength();
for (int i = 0; i < size; i++) {
long start = System.currentTimeMillis();
Element child = (Element) nodeList.item(i);
int ctxtNode = xpathSupport.getDTMHandleFromNode(child);
//String title = titleXpath.execute(xpathSupport,
ctxtNode, prefixResolver).toString();
long duration = System.currentTimeMillis() - start;
if (i < 10 || (i % (numChilds/10)) == 0)
System.out.println("child #" + i + "\t took " +
duration + " ms." +
"\tfreeMemory: " + r.freeMemory() +
"\ttotalMemory: "+r.totalMemory());
else if (i == 10)
System.out.println("printing some selected childs only
from now on...");
}
}
}
++++++++++++++++++++++++++++++++++++++++++++
Here you can see an example of the result:
$ java Test
Building a document with 100001 childs
Evaluating XPath for each 100001 childs
child #0 took 77 ms. freeMemory: 10642840 totalMemory:
45129728
child #1 took 1 ms. freeMemory: 10583848 totalMemory:
45129728
child #2 took 0 ms. freeMemory: 10583848 totalMemory:
45129728
child #3 took 0 ms. freeMemory: 10583848 totalMemory:
45129728
child #4 took 0 ms. freeMemory: 10583848 totalMemory:
45129728
child #5 took 0 ms. freeMemory: 10583848 totalMemory:
45129728
child #6 took 0 ms. freeMemory: 10583848 totalMemory:
45129728
child #7 took 1 ms. freeMemory: 10583848 totalMemory:
45129728
child #8 took 0 ms. freeMemory: 10583848 totalMemory:
45129728
child #9 took 0 ms. freeMemory: 10583848 totalMemory:
45129728
printing some selected childs only from now on...
child #10000 took 3 ms. freeMemory: 10980392 totalMemory:
45129728
child #20000 took 5 ms. freeMemory: 9976808 totalMemory:
45129728
child #30000 took 7 ms. freeMemory: 6332656 totalMemory:
45129728
child #40000 took 9 ms. freeMemory: 5112168 totalMemory:
45129728
child #50000 took 12 ms. freeMemory: 1373472 totalMemory:
45129728
child #60000 took 14 ms. freeMemory: 19851264 totalMemory:
66650112
child #70000 took 16 ms. freeMemory: 16515832 totalMemory:
66650112
child #80000 took 19 ms. freeMemory: 15040280 totalMemory:
66650112
child #90000 took 21 ms. freeMemory: 7435744 totalMemory:
66650112
child #100000 took 24 ms. freeMemory: 17416944 totalMemory:
66650112
++++++++++++++++++++++++++++++++++++++++++++
each time I call xpathSupport.getDTMHandleFromNode(child) it does not
free the memory,
and so it gets slower and slower.
How to solve this problem?
Some people has suggested to use the DOM4J package instead of Xalan.
However, we already have quite a lot of software using Xalan and
changing the code would have some cost.
Is it possible to solve this problem without discarding xalan?
Regards,
DAvid
- 15
- problem with xercesImpl.jarI'm deploying a simple XML parsing servlet using the latest
2.5.0 xerces jars in it's lib directory.
This servlet runs fine on my local machine, but when I deploy it
to the production server, the JRE throws a java.lang.NoSuchMethodError
for the method
method parse(Ljava/io/InputStream;Lorg/xml/sax/helpers/DefaultHandler;)V not found
This method is definitely in the latest xerces jar, so I'm guessing
it's picking up an obsolete jar file somewhere before the current
jar in the classpath.
Unfortunately I have little control over the production server, so
can anyone suggest how I can force xerces to use the actual
latest library?
Thanks,
Sean
|
|
|