Compiling *.java for cfinvoke
I'm trying to connect to a web service that uses
complex-within-complex data types for its parameter.
I am constantly getting errors trying to invoke the web
service and it has been recommended by someone on this list (Mr.
Andreyev) that I do the following:
1. Use wsdl2java tool (CF_HOME/runtime/bin) supplying URL to
webservice WSDL to create java code.
2. Create java classes by compiling java code created in step
1
3. Create jar file(s) from classes in step 2
4. Put jar file in CF classpath or just copy it to
CF_HOME/lib directory
5. Using <cfscript> create required objects, arrays and
other arguments and supply them to web service method call.
This is not as simple as it sounds (well, not to someone
who's only interaction with java is in a cup).
1. Use wsdl2java tool (CF_HOME/runtime/bin) tsupplying URL to
webservice WSDL to create java code.
This has been done. The tool created a series of subfolders
under C:\CFusionMX7\runtime\bin which ends in a folder called
schema
Inside schema are six other folders that each contain 1 and
111 .java files
[EDIT] I think I have part of the problem worked out.
2. Create java classes by compiling java code created in step
1
This has not been done.
My command line in javac is: javac @filename -verbose -source
1.4
I get a total of 100 errors and 33 warnings
All the errors are on this theme:
C:\CFusionMX7\runtime\bin\...\AccommodationRoomT
ype.java:10: package org.apache.axis.encoding does not exist
public class AccommodationRoomType implements
java.io.Serializable, org.apache.
axis.encoding.SimpleType {
The common theme in the error messages is:
package org.apache.axis.something does not exist
Am I not using javac correctly or is it just battling to
compile the code generated by wsdl2java?
Thanks
Neal
Hi there Mr. Andreyev
[EDIT]. You are a prince amongst men, sir. All .class files
have been created
This version of your line worked
javac -source 1.4 -deprecation -classpath
C:/CFusionMX7/lib/axis.jar;C:/CFusionMX7/lib/xml-apis.jar;C:/CFusionMX7/lib/saaj.jar;C:/C FusionMX7//lib/jaxrpc.jar;.
@C:/CFusionMX7/runtime/bin/au/com/qantas/www/schema/allfiles.txt
It threw
warnings, not
errors. I was reading them as the same thing.
Thank you for your kind assistance. On to step 3!
[END EDIT]
Using the command line as you suggested threw up a new set of
errors but I think I know what is causing them.
The first time I tried your script I modified it as follows:
javac -deprecation -classpath
C:/CFusionMX7/lib/axis.jar;C:/CFusionMX7/lib/xml-apis.jar;C:/CFusionMX7/lib/saaj.jar;C:/C FusionMX7//lib/jaxrpc.jar;.
C:/CFusionMX7/runtime/bin/au/com/qantas/www/schema/aCalypsoV1/*.java
Note that there is a space between the period (.) and the
start of the path to the java files.
On running this i received back many many error messages
pointing out that
"as of release 5, 'enum' is a keyword, and may not be used as
an identifier (use -source 1.4 or lower to use 'enum' as an
identifier)"
I then modified your line as follows
javac -source 1.4 -deprecation -classpath
C:/CFusionMX7/lib/axis.jar;C:/CFusionMX7/lib/xml-apis.jar;C:/CFusionMX7/lib/saaj.jar;C:/C FusionMX7//lib/jaxrpc.jar;.
C:/CFusionMX7/runtime/bin/au/com/qantas/www/schema/aCalypsoV1/*.java
This also gave me a bunch of errors in the vein of:
"C:\CFusionMX7\runtime\bin\au\com\qantas\www\schema\aCalypsoV1\ContactDetails.jav
a:38: package au.com.qantas.www.schema.CustomersV1 does not
exist
public void
setEmailAddress(au.com.qantas.www.schema.CustomersV1.EmailAddres
s emailAddress) {"
The .java files that were created by wsdl2java were grouped
into six folders under /www/schema
Every error message references one of these other folders. It
looks like the compiler is trying to reference them.
I have these folders:
www/schema/aCalypsoV1
www/schema/AmadeusBookingsV1
www/schema/ChannelsV1
www/schema/CustomersV1
www/schema/FinancialsV1
www/schema/ReferenceV1
I tried creating a text file with an absolute path to every
single .java file in those six files in it (naming it
www/schema/allfiles.txt) and modifying your script as follows:
javac -source 1.4 -deprecation -classpath
C:/CFusionMX7/lib/axis.jar;C:/CFusionMX7/lib/xml-apis.jar;C:/CFusionMX7/lib/saaj.jar;C:/C FusionMX7//lib/jaxrpc.jar;.
@C:/CFusionMX7/runtime/bin/au/com/qantas/www/schema/allfiles.txt
This threw a set of errors in this theme
C:\CFusionMX7\runtime\bin\au\com\qantas\www\schema\ChannelsV1\Channel.java:32:
w
arning: as of release 5, 'enum' is a keyword, and may not be
used as an identifi
er
(use -source 5 or higher to use 'enum' as a keyword)
Using -source 1.4 throws errors saying use source 5 or higher
Using -source 5 or leaving it out altogether says use source
1.4
I am stuck.
Similar Messages
-
I want to compile java for *.exe program?
I want to compile java for *.exe program?
ThanksI want to compile java for *.exe program?
ThanksYou're welcome, but the correct answer was allready
given in previous response.oops, late again, must edit.
You're welcome, but the correct answer was allready given in the first response. -
Dear all
My organization has a web cum wap site running on XML - XSL. When i uploaded a modified file it started giving me the following error
java.lang.Exception: XSP Java Compiler: Compilation failed for
_index.java The compiler has run out of memory. Consider using the
"-J-mx<number>" command line option to increase the maximum heap
size.
The site is running on Linux platform ( with Apache, Jserv, Cocoon).
can anybody help me to resolve this problem.
with thanxs and regards
Rohit Joshi
(Mobile Application Developer)
Globe Communication (http://www.globecommunication.net)
Nil - 26 Malviya Nagar, Delhi, India.Thank you very much.
But the as i had wrote that am using Apache, Jserv and Cocoon, my site is in XML , XSL format..i can do logical work in XML and representation in two formats one is HTML and one in WML through XSL. so only i have to make all these files and put them in to theirs respective place, htdocs. Then , as u know, it automaticaaly parsed, compiled and processed through parsers and processors provided by servers. So i don't need to compile each java file. Now u suggest me what i have to do? Is their any procedure that Cocoon Engine automaticaaly can increased this size.
Thanxs and regards
Rohit Joshi -
Java compile error for removed API
Hi,
What are the Java compile errors for API that has been removed?
As I understand it, API elements are deprecated and not removed from the API immediately, but will be removed in future releases or after so many years.
When Java code is compliled in a higher Java version, and the API has finally been removed - what are the errors that will be ouput in the log?
Thank you for your time.WalterLaan wrote:
And if you recompile one with a method removed that the other use and then run the other you would get a NoSuchMethodError (or more generally just an error sub class of LinkageError).
Not that you should be catching those unless you accept classes from the user (as plugins).Presumably you mean he should not be catching them?
@OP: In general, you should not catch unchecked exceptions. These are RuntimeException, Error, and their descendants. There are exceptions, such as at "layer boundaries," or when you don't want errors in one module/application/plugin/etc. to affect or prevent processing in others. -
How to check for a logic bomb in compiled java code ?
I have couple of security requirements.
1. How do I check for logic bomb in the compiled java code ?
2. Is there any way to monitor memory utilized by class when running inside a constructor ?1. Let me see if you can define 'logic bomb', then maybe a answer can be supplied. If you simply mean malicious code, then in general you cannot. You can attempt to do the kinds of things that antivirus software does, like check for the existence of known malicious code and code patterns, but that won't work any better on Java than it does on anything else.
2. Google java profiling. Also, for something relatively simple, read about jconsole. -
HELP for Compile java programe !
Hello All,
i want to make java programe by which i can compile java programes
and when i compile java programe from my programe then
i shoul get compiled status means programe compile successfuly
or not compile.
if any example i m thanksfull.
onlyforjava.how about if compile fail?
the process obj seems return value 0 as it run successful.
I haven't try this, but I have experienced the process obj returns 0 if the executed command has some routine to handle error cases, in which, error will not halt the system.
So, I recommand the following scenario.
1. let say, if your java is test.java. check the existence of file test.class.
If, it exists, get its modified time.
2. compile the java code with
Procress p = Runtime.exec(new String[]{"javac", "test.java"});
3. get the error string if any.
InputStream in = new BufferedInputStream(p.getInputStream());int read;while ((read = in.read()) != -1){ System.out.println((char)read);}
4. handle error with the exitValue
if (p.exitValue() != 0){ System.out.println("warning.");}
5. check again the file test.class if it is a newly created file.
6. if it is newly created, compile success. Else, failed. -
EXCEPTION_ACCESS_VIOLATION (0xc0000005) on compiled Java code
I'm confronted with the following error of this code.
http://db-www.naist.jp/~makoto-y/tmp/Int2LongHash.java
The exception appears only when the system gets high-load.
Is there work-arounds?
I've tried also with jdk1.5.0_06, but the same error occurred.
Converting the inner class to a top-level class has no effects.
# An unexpected error has been detected by Java Runtime Environment:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00a2cd75, pid=1540, tid=2968
# Java VM: Java HotSpot(TM) Client VM (1.6.0-beta2-b86 mixed mode)
# Problematic frame:
# J org.metabrick.xbird.util.collections.Int2LongHash$Int2LongLRUMap$ChainedEntry.recordRemoval(Lorg/metabrick/xbird/util/collections/Int2LongHash;)V
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
--------------- T H R E A D ---------------
Current thread (0x003f6800): JavaThread "main" [_thread_in_Java, id=2968]
siginfo: ExceptionCode=0xc0000005, writing address 0xfc2cee54
Registers:
EAX=0x42d43500, EBX=0x03d3ee00, ECX=0x03d3ee00, EDX=0x07911838
ESP=0x0091f760, EBP=0x0091f778, ESI=0x0790f9f8, EDI=0xfc2cee38
EIP=0x00a2cd75, EFLAGS=0x00010203
Top of Stack: (sp=0x0091f760)
0x0091f760: 0790ac30 079220b0 00000200 03d917f8
0x0091f770: 00000000 6d955aa7 0091f7a8 00a2c9dc
0x0091f780: 00000200 00000000 0091f7e8 00a12d50
0x0091f790: 5ab674cf 00000000 07911838 03d3ee00
0x0091f7a0: 03d8b700 00000010 0091f7f8 00a2c000
0x0091f7b0: 03d8b700 078e4af4 00000010 00a2ab04
0x0091f7c0: 078e4af4 03d8b700 00000010 00000001
0x0091f7d0: 00000000 6d955ae7 5ab674d0 00000000
Instructions: (pc=0x00a2cd75)
0x00a2cd65: 20 8b fe c1 ef 09 c6 87 80 b1 5b 48 00 8b 79 20
0x00a2cd75: 89 77 1c c1 ef 09 c6 87 80 b1 5b 48 00 8b e5 5d
Stack: [0x008d0000,0x00920000), sp=0x0091f760, free space=317k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
J org.metabrick.xbird.util.collections.Int2LongHash$Int2LongLRUMap$ChainedEntry.recordRemoval(Lorg/metabrick/xbird/util/collections/Int2LongHash;)V
J org.metabrick.xbird.util.collections.Int2LongHash.remove(I)J
J org.metabrick.xbird.util.collections.Int2LongHash$Int2LongLRUMap.addEntry(IIJLorg/metabrick/xbird/util/collections/Int2LongHash$BucketEntry;)V
J org.metabrick.xbird.util.collections.Int2LongHash.put(IJ)J
J org.metabrick.xbird.xquery.util.StringChunk.storeCharChunk([CII)J
J org.metabrick.xbird.xquery.util.StringChunk.store([CII)J
J org.metabrick.xbird.xquery.dm.dtm.BigDocumentTable.setTextAt(J[CII)J
J org.metabrick.xbird.xquery.dm.dtm.DocumentTableBuilder.createTextNode()V
J org.metabrick.xbird.xquery.dm.dtm.DocumentTableBuilder.endElement(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
J org.apache.xerces.parsers.AbstractSAXParser.endElement(Lorg/apache/xerces/xni/QName;Lorg/apache/xerces/xni/Augmentations;)V
J org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement()I
J org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Z)Z
j org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Z)Z+24
j org.apache.xerces.parsers.XML11Configuration.parse(Z)Z+132
j org.apache.xerces.parsers.XML11Configuration.parse(Lorg/apache/xerces/xni/parser/XMLInputSource;)V+29
j org.apache.xerces.parsers.XMLParser.parse(Lorg/apache/xerces/xni/parser/XMLInputSource;)V+9
j org.apache.xerces.parsers.AbstractSAXParser.parse(Lorg/xml/sax/InputSource;)V+43
j org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Lorg/xml/sax/InputSource;)V+43
j org.metabrick.xbird.xquery.dm.instance.DocumentTableModel.loadDocument(Ljava/io/InputStream;)V+35
j org.metabrick.xbird.client.tools.command.ImportDocument.process([Ljava/lang/String;)Z+99
j org.metabrick.xbird.client.tools.CommandInvoker.executeCommand([Ljava/lang/String;)Z+8
j org.metabrick.xbird.client.tools.CommandInvoker.run([Ljava/lang/String;)V+66
j org.metabrick.xbird.client.tools.CommandInvoker.main([Ljava/lang/String;)V+19
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x48aa5000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3636]
0x48aa0800 JavaThread "CompilerThread0" daemon [_thread_blocked, id=4076]
0x48a9e400 JavaThread "Attach Listener" daemon [_thread_blocked, id=3144]
0x48aac400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2248]
0x48a86c00 JavaThread "Finalizer" daemon [_thread_blocked, id=2664]
0x48a82800 JavaThread "Reference Handler" daemon [_thread_blocked, id=2700]
=>0x003f6800 JavaThread "main" [_thread_in_Java, id=2968]
Other Threads:
0x48a7f400 VMThread [id=4028]
0x48aa6800 WatcherThread [id=3704]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 72576K, used 28616K [0x029d0000, 0x07890000, 0x07890000)
eden space 64512K, 32% used [0x029d0000, 0x03e6fdd0, 0x068d0000)
from space 8064K, 92% used [0x068d0000, 0x07022230, 0x070b0000)
to space 8064K, 0% used [0x070b0000, 0x070b0000, 0x07890000)
tenured generation total 967936K, used 253073K [0x07890000, 0x429d0000, 0x429d0000)
the space 967936K, 26% used [0x07890000, 0x16fb4788, 0x16fb4800, 0x429d0000)
compacting perm gen total 12288K, used 5879K [0x429d0000, 0x435d0000, 0x469d0000)
the space 12288K, 47% used [0x429d0000, 0x42f8dd08, 0x42f8de00, 0x435d0000)
No shared spaces configured.
Dynamic libraries:
0x00400000 - 0x00423000 C:\Program Files\Java\jdk1.6.0\bin\javaw.exe
0x7c940000 - 0x7c9dd000 C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c931000 C:\WINDOWS\system32\kernel32.dll
0x77d80000 - 0x77e29000 C:\WINDOWS\system32\ADVAPI32.dll
0x77e30000 - 0x77ec1000 C:\WINDOWS\system32\RPCRT4.dll
0x77cf0000 - 0x77d7f000 C:\WINDOWS\system32\USER32.dll
0x77ed0000 - 0x77f17000 C:\WINDOWS\system32\GDI32.dll
0x762e0000 - 0x762fd000 C:\WINDOWS\system32\IMM32.DLL
0x60740000 - 0x60749000 C:\WINDOWS\system32\LPK.DLL
0x73f80000 - 0x73feb000 C:\WINDOWS\system32\USP10.dll
0x77bc0000 - 0x77c18000 C:\WINDOWS\system32\msvcrt.dll
0x7c340000 - 0x7c396000 C:\Program Files\Java\jdk1.6.0\jre\bin\msvcr71.dll
0x6d7f0000 - 0x6da2f000 C:\Program Files\Java\jdk1.6.0\jre\bin\client\jvm.dll
0x76af0000 - 0x76b1b000 C:\WINDOWS\system32\WINMM.dll
0x6d310000 - 0x6d318000 C:\Program Files\Java\jdk1.6.0\jre\bin\hpi.dll
0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL
0x6d7a0000 - 0x6d7ac000 C:\Program Files\Java\jdk1.6.0\jre\bin\verify.dll
0x6d3a0000 - 0x6d3bf000 C:\Program Files\Java\jdk1.6.0\jre\bin\java.dll
0x6d7e0000 - 0x6d7ef000 C:\Program Files\Java\jdk1.6.0\jre\bin\zip.dll
0x6d560000 - 0x6d573000 C:\Program Files\Java\jdk1.6.0\jre\bin\net.dll
0x719e0000 - 0x719f7000 C:\WINDOWS\system32\WS2_32.dll
0x719d0000 - 0x719d8000 C:\WINDOWS\system32\WS2HELP.dll
0x6d580000 - 0x6d589000 C:\Program Files\Java\jdk1.6.0\jre\bin\nio.dll
VM Arguments:
jvm_args: -Xmx1024m -Xms1024m
java_command: org.metabrick.xbird.client.tools.CommandInvoker -col /xmark import document C:\Software\xmark\xmark100.xml
Launcher Type: SUN_STANDARD
Environment Variables:
JAVA_HOME=C:\Program Files\Java\jdk1.6.0
PATH=C:\Program Files\Java\jdk1.6.0\bin;D:\Software\maven-1.0.2\bin;D:\cygwin\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\Software\apache-ant-1.6.5\bin;C:\ghc\ghc-6.4.2\bin;C:\Program Files\QuickTime\QTSystem\
USERNAME=yui
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 4, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows XP Build 2600 Service Pack 2
CPU:total 2 family 15, cmov, cx8, fxsr, mmx, sse, sse2, ht
Memory: 4k page, physical 2096404k(108924k free), swap 3511144k(1471688k free)
vm_info: Java HotSpot(TM) Client VM (1.6.0-beta2-b86) for windows-x86, built on Jun 2 2006 00:36:31 by "java_re" with unknown MS VC++:1310The following is the error that I got with using JDK 1.5.
# An unexpected error has been detected by HotSpot Virtual Machine:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00b8c9f8, pid=4024, tid=1608
# Java VM: Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed mode)
# Problematic frame:
# J org.metabrick.xbird.util.collections.Int2LongHash$Int2LongLRUMap$ChainedEntry.recordRemoval(Lorg/metabrick/xbird/util/collections/Int2LongHash;)V
--------------- T H R E A D ---------------
Current thread (0x00036190): JavaThread "main" [_thread_in_Java, id=1608]
siginfo: ExceptionCode=0xc0000005, writing address 0xfa424094
Registers:
EAX=0x00040e40, EBX=0xfa424078, ECX=0x05bd3fc0, EDX=0x05bd3fc0
ESP=0x0007f578, EBP=0x0007f590, ESI=0xfa424078, EDI=0x081c8168
EIP=0x00b8c9f8, EFLAGS=0x00010203
Top of Stack: (sp=0x0007f578)
0x0007f578: 081c1fa8 6d7d1061 022dd1c8 00000000
0x0007f588: 00000200 00000200 0007f5c8 00b8c598
0x0007f598: 0899f428 05bd3fc0 00000200 00000000
0x0007f5a8: 0007f5c8 00b41018 00000200 000001cb
0x0007f5b8: 05c50338 05c19448 05bd3fc0 000001a8
0x0007f5c8: 0007f648 00b8b880 07dd565c 0899f428
0x0007f5d8: 022dd1cb 00000000 08976190 00b8054c
0x0007f5e8: 00001000 0000af89 00001000 6d7d1061
Instructions: (pc=0x00b8c9f8)
0x00b8c9e8: 89 5f 20 c1 e8 09 c6 80 00 a9 6c 48 00 8b 72 20
0x00b8c9f8: 89 7e 1c c1 ee 09 c6 86 00 a9 6c 48 00 8b e5 5d
Stack: [0x00040000,0x00080000), sp=0x0007f578, free space=253k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
J org.metabrick.xbird.util.collections.Int2LongHash$Int2LongLRUMap$ChainedEntry.recordRemoval(Lorg/metabrick/xbird/util/collections/Int2LongHash;)V
J org.metabrick.xbird.util.collections.Int2LongHash.remove(I)J
J org.metabrick.xbird.util.collections.Int2LongHash$Int2LongLRUMap.addEntry(IIJLorg/metabrick/xbird/util/collections/Int2LongHash$BucketEntry;)V
J org.metabrick.xbird.util.collections.Int2LongHash.put(IJ)J
J org.metabrick.xbird.xquery.util.StringChunk.storeCharChunk([CII)J
J org.metabrick.xbird.xquery.util.StringChunk.store([CII)J
J org.metabrick.xbird.xquery.dm.dtm.BigDocumentTable.setTextAt(J[CII)J
J org.metabrick.xbird.xquery.dm.dtm.DocumentTableBuilder.createTextNode()V
J org.metabrick.xbird.xquery.dm.dtm.DocumentTableBuilder.endElement(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
J com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Lcom/sun/org/apache/xerces/internal/xni/QName;Lcom/sun/org/apache/xerces/internal/xni/Augmentations;)V
J com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement()I
J com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Z)Z
v ~OSRAdapter
j com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Z)Z+24
j com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Z)Z+118
j com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Lcom/sun/org/apache/xerces/internal/xni/parser/XMLInputSource;)V+29
j com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Lcom/sun/org/apache/xerces/internal/xni/parser/XMLInputSource;)V+9
j com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Lorg/xml/sax/InputSource;)V+43
j org.metabrick.xbird.xquery.dm.instance.DocumentTableModel.loadDocument(Ljava/io/InputStream;)V+35
j org.metabrick.xbird.client.tools.command.ImportDocument.process([Ljava/lang/String;)Z+102
j org.metabrick.xbird.client.tools.CommandInvoker.executeCommand([Ljava/lang/String;)Z+8
j org.metabrick.xbird.client.tools.CommandInvoker.run([Ljava/lang/String;)V+66
j org.metabrick.xbird.client.tools.CommandInvoker.main([Ljava/lang/String;)V+19
v ~StubRoutines::call_stub
V [jvm.dll+0x845a9]
V [jvm.dll+0xd9317]
V [jvm.dll+0x8447a]
V [jvm.dll+0x8b44a]
C [java.exe+0x14c5]
C [java.exe+0x64dd]
C [kernel32.dll+0x16fd7]
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x00aa7490 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=1780]
0x00aa60f0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3456]
0x00aa53f8 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2544]
0x00a96c80 JavaThread "Finalizer" daemon [_thread_blocked, id=856]
0x00a957e8 JavaThread "Reference Handler" daemon [_thread_blocked, id=816]
=>0x00036190 JavaThread "main" [_thread_in_Java, id=1608]
Other Threads:
0x0003fbd0 VMThread [id=3592]
0x00ab0e20 WatcherThread [id=3108]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 72576K, used 59965K [0x02ae0000, 0x079a0000, 0x079a0000)
eden space 64512K, 80% used [0x02ae0000, 0x05d8f7b0, 0x069e0000)
from space 8064K, 99% used [0x069e0000, 0x071bfff8, 0x071c0000)
to space 8064K, 0% used [0x071c0000, 0x071c0000, 0x079a0000)
tenured generation total 967936K, used 451270K [0x079a0000, 0x42ae0000, 0x42ae0000)
the space 967936K, 46% used [0x079a0000, 0x23251ab0, 0x23251c00, 0x42ae0000)
compacting perm gen total 8192K, used 5367K [0x42ae0000, 0x432e0000, 0x46ae0000)
the space 8192K, 65% used [0x42ae0000, 0x4301dfb0, 0x4301e000, 0x432e0000)
No shared spaces configured.
Dynamic libraries:
0x00400000 - 0x0040c000 C:\Program Files\Java\jdk1.5.0_06\bin\java.exe
0x7c940000 - 0x7c9dd000 C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c931000 C:\WINDOWS\system32\kernel32.dll
0x77d80000 - 0x77e29000 C:\WINDOWS\system32\ADVAPI32.dll
0x77e30000 - 0x77ec1000 C:\WINDOWS\system32\RPCRT4.dll
0x77bc0000 - 0x77c18000 C:\WINDOWS\system32\MSVCRT.dll
0x6d6e0000 - 0x6d874000 C:\Program Files\Java\jdk1.5.0_06\jre\bin\client\jvm.dll
0x77cf0000 - 0x77d7f000 C:\WINDOWS\system32\USER32.dll
0x77ed0000 - 0x77f17000 C:\WINDOWS\system32\GDI32.dll
0x76af0000 - 0x76b1b000 C:\WINDOWS\system32\WINMM.dll
0x762e0000 - 0x762fd000 C:\WINDOWS\system32\IMM32.DLL
0x60740000 - 0x60749000 C:\WINDOWS\system32\LPK.DLL
0x73f80000 - 0x73feb000 C:\WINDOWS\system32\USP10.dll
0x6d2f0000 - 0x6d2f8000 C:\Program Files\Java\jdk1.5.0_06\jre\bin\hpi.dll
0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL
0x6d6b0000 - 0x6d6bc000 C:\Program Files\Java\jdk1.5.0_06\jre\bin\verify.dll
0x6d370000 - 0x6d38d000 C:\Program Files\Java\jdk1.5.0_06\jre\bin\java.dll
0x6d6d0000 - 0x6d6df000 C:\Program Files\Java\jdk1.5.0_06\jre\bin\zip.dll
0x6d530000 - 0x6d543000 C:\Program Files\Java\jdk1.5.0_06\jre\bin\net.dll
0x719e0000 - 0x719f7000 C:\WINDOWS\system32\WS2_32.dll
0x719d0000 - 0x719d8000 C:\WINDOWS\system32\WS2HELP.dll
0x6d550000 - 0x6d559000 C:\Program Files\Java\jdk1.5.0_06\jre\bin\nio.dll
VM Arguments:
jvm_args: -Xmx1024m -Xms1024m -ea
java_command: org.metabrick.xbird.client.tools.CommandInvoker -col /xmark import document C:\Software\xmark\xmark100.xml
Launcher Type: SUN_STANDARD
Environment Variables:
JAVA_HOME=C:\Program Files\Java\jdk1.6.0
PATH=C:\Program Files\Java\jdk1.6.0\bin;D:\Software\maven-1.0.2\bin;D:\cygwin\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\Software\apache-ant-1.6.5\bin;C:\ghc\ghc-6.4.2\bin;C:\Program Files\QuickTime\QTSystem\
USERNAME=yui
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 4, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows XP Build 2600 Service Pack 2
CPU:total 2 family 15, cmov, cx8, fxsr, mmx, sse, sse2, ht
Memory: 4k page, physical 2096404k(370660k free), swap 3511144k(1545452k free)
vm_info: Java HotSpot(TM) Client VM (1.5.0_06-b05) for windows-x86, built on Nov 10 2005 11:12:14 by "java_re" with MS VC++ 6.0 -
Unable to compile class for JSP
Please can anyone help me to solve this.
Actually,this is the condition.
In my db,there is a table called UserPassword, which has 4
fields(empNo,UserName,password,level). Now I want to do these things:
When the user submits the data to create a new account via HTML form, it submits the data to the file called CreateAcc.jsp. In this file it perform some logic,here are they.
1)To check the empNo,if it is already exist in the DB,
if empNo =exist then display error.(record already exist)
if empNo =notexist then do task 2).
2)check the UserName,if it is already exist in the db,
if UserName=exist then display error.(because it's a primary key)
if UserName=notexist then do task 3).
3)Create a new user account and save it to the db.
To do these tasks,I never create a new objects for the tasks 1) and 2).
only for task 3)create an object.
Is it the right way?
Here is the file CreateAcc.jsp
<%@ page language="java" %>
<%@ page import="core.UserAccManager" %>
<%@ page import="data.UserPassword" %>
<jsp:useBean id="UserAccManager" class="core.UserAccManager" scope="session"/>
<jsp:setProperty name="UserAccManager" property="*"/>
<jsp:useBean id="UserPassword" class="data.UserPassword" scope="session"/>
<jsp:setProperty name="UserPassword" property="*"/>
<%
String nextPage ="MainForm.jsp";
if(UserPassword.verifyEmpno()){
if(UserPassword.verifyUsername()){
if(UserPassword.createAcc()) nextPage ="MsgAcc.jsp";
}else{
nextPage="UserNameExist.jsp";
else{
nextPage="UserAccError.jsp";
%>
<jsp:forward page="<%=nextPage%>"/>The directory structure:
UserPassword.java- F:/Project/core/data/UserPassword.java
UserAccManager.java - F:/Project/core/UserAccManager.java
Now both are compiling.I put the class files into the TOMCAT,as follows.
UserAccManager.class - webapps/mySystemName/WEB-INF/classes/core/
UserPassword.class - webapps/mySystemName/WEB-INF/classes/core/data/
Here is the full code of the file UserAccManager.java.
package core; //Is this right?
import data.UserPassword; //Is this right?
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public final class UserAccManager{
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost:3306/superfine";
private static Connection connection;
private static PreparedStatement pstmt1;
private static PreparedStatement pstmt2;
private static PreparedStatement pstmt3;
private UserAccManager(){
// Initializes the connection and statements
public static void initConnection() {
if (connection == null) {
try {
String sql;
// Open the database
Class.forName(DRIVER).newInstance();
connection = DriverManager.getConnection(URL);
// Prepare the statements
sql = "SELECT * FROM UserPassword where empNo= ?";
pstmt1 = connection.prepareStatement(sql);
sql = "SELECT UserName FROM UserPassword where UserName= ?";
pstmt2 = connection.prepareStatement(sql);
sql ="INSERT INTO UserPassword VALUES(?,?,?,?)";
pstmt3 = connection.prepareStatement(sql);
catch (Exception ex) {
System.err.println(ex.getMessage());
// Closes the connection and statements
// Method to be called by main class when finished with DB
public void closeConnection() {
//same as previous
public static boolean verifyEmpno(int empno) {
boolean emp_no_select_ok = false;
int emp = -1;
initConnection();
try {
pstmt1.setInt(1, empno);
ResultSet rs1 = pstmt1.executeQuery();
while(rs1.next()){
emp=rs1.getInt("empNo");
if(emp>0)
emp_no_select_ok = false;
} else{
emp_no_select_ok = true;
rs1.close();
pstmt1.close();
catch (Exception ex) {
System.err.println(ex.getMessage());
return emp_no_select_ok;
public static boolean verifyUsername(String username) {
boolean user_name_select_ok = false;
String user = "xxxx";
initConnection();
try {
pstmt2.setString(1, username);
ResultSet rs2 = pstmt2.executeQuery();
while(rs2.next()){
user=rs2.getString("UserName");
if(!user.equals("xxxx"))
user_name_select_ok = false;
} else{
user_name_select_ok = true;
rs2.close();
catch (Exception ex) {
System.err.println(ex.getMessage());
return user_name_select_ok;
public static boolean createAcc(int empno, String username, String password, int
level){
boolean create_acc_ok = false;
initConnection();
try{
//create a new object,from the UserPassword table.
UserPassword useraccount = new UserPassword();
useraccount.setEmpno(empno);
useraccount.setUsername(username);
useraccount.setPassword(password);
useraccount.setLevel(level);
//assign value for ???
pstmt3.setInt(1, useraccount.getEmpno());
pstmt3.setString(2, useraccount.getUsername());
pstmt3.setString(3, useraccount.getPassword());
pstmt3.setInt(4, useraccount.getLevel());
if(pstmt3.executeUpdate()==1) create_acc_ok=true;
pstmt3.close();
//con.close();
catch(SQLException e2){
System.err.println(e2.getMessage());
return create_acc_ok;
}here is the bean (part of it)
package data; //is it right?
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class UserPassword
private int empno;
private String username;
private String password;
private int level;
// Constructor
public UserPassword()
this.empno = empno;
this.username = username;
this.password = password;
this.level = level;
// setters and getters are here.
// public boolean verifyEmpno() {
// return UserAccManager.verifyEmpno(empno);
// public boolean verifyUsername(String username) {
// return UserAccManager.verifyUsername(username);
// These 2 methods not compile with or without para's.So I leave that job for the
//controll class UserAccManager.java.
Now my problem is this: When I submit data, there is an error;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\HRM\CreateAcc_jsp.java:8:
cannot access core.data.UserPassword
bad class file: C:\Program Files\Apache Group\Tomcat
4.1\webapps\HRM\WEB-INF\classes\core\data\UserPassword.class
class file contains wrong class: data.UserPassword
Please remove or make sure it appears in the correct subdirectory of the classpath.
import core.data.UserPassword;
^
1 error
Are there any mistakes? If so tell me where is it and how to change them.Please help.I try it that way, but it don't compile.
Error:core\data\UserPassword.java:package javax.servlet does not exist
import javax.servlet.*;
core\data\UserPassword.java:package javax.servlet.http does not exist
import javax.servlet.http.*;
So,I comment them only in the UserPassword.java file,and compile it again.
Then it compile well.I goto the directory to get the .class files.
But there is only UserPassword.class inside the data folder. There is not
UserAccManager.class in the core folder.
Then I try this way,I put my 2 java files in to a new folder,
F:\SystemName\com
When I try it that way, but it don't compile.
javac -classpath . -d . com\*.javaError:com\UserPassword.java:package javax.servlet does not exist
import javax.servlet.*;
com\UserPassword.java:package javax.servlet.http does not exist
import javax.servlet.http.*;
So,I comment them only in the UserPassword.java file,and compile it again.
Now both are compiling well.There was 2 class files.
I put them in to the WEB-INF/classes/com directory.
Start the server.But it gave errors:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserPassword.verifyEmpno(empno)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyUsername(username)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: non-static method
verifyUsername(java.lang.String) cannot be referenced from a static context
if(UserAccManager.verifyUsername(username)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable password
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable level
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: non-static method
createAcc(int,java.lang.String,java.lang.String,int) cannot be referenced from a static
context
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
8 errorsTo solve the problem non-static method,I goto the UserAccManager.java file and do these
things.
package com;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
//import javax.servlet.*; //otherwise it tells an error.(package
//javax.servlet does not exist)
//import javax.servlet.http.*;
public class UserAccManager {
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost:3306/superfine";
private static Connection connection;
private static PreparedStatement pstmt1;
private static PreparedStatement pstmt2;
private static PreparedStatement pstmt3;
private UserAccManager() {
// Initializes the connection and statements
private static void initConnection() {
//same
// Closes the connection and statements
// Method to be called by main class when finished with DB
public static void closeConnection() {
//same
public static boolean verifyEmpno(int empno) {
// same.
public static boolean verifyUsername(String username) {
//same.
public static boolean createAcc(int empno, String username, String password, int
level){
//same
package com;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
//import javax.servlet.*;
//import javax.servlet.http.*;
public class UserPassword {
// same
Again compile those files and put .class filses into the WEB-INF/classes/com directory.
When i submits the data via the form it generates an error:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyEmpno(empno)){
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyUsername(username)){
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable password
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable level
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
6 errorshere is the CreateAcc.jsp file
<%@ page language="java" %>
<%@ page import="com.UserAccManager" %>
<%@ page import="com.UserPassword" %>
<jsp:useBean id="userPassword" class="com.UserPassword" scope="request"/>
<jsp:setProperty name="userPassword" property="*" />
<%
String nextPage ="MainForm.jsp";
if(UserAccManager.verifyEmpno(empno)){
if(UserAccManager.verifyUsername(username)){
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
}else{
nextPage="UserNameExist.jsp";
else{
nextPage="UserAccError.jsp";
%>
<jsp:forward page="<%=nextPage%>"/>Please, anyone know how to send these parameters to the java file.
Thanks. -
Error while running compiled java code
Hi
I have an evaluation license of the JDeveloper2.0 installed on my WindowsNT 4.0 workstation.
I seem to have a problem running my compiled jave code. After compiling the source code(.java file) when I try to run the same I get a message saying
"<FileName> not found in outpath classpath or sourcepath ".
What does this mean and how can I rectify it?
Regards
Sree
nullYour classpath tells Java run time where to look for the class files it needs. In JDeveloper the class path is set in your project properties. Select Project->Properties and check that the source and output paths correspond to your myprojects and myclasses directories.
-
Error while compiling java file
Hi, im newby in java,
i was trying to compile java files, and after that i will use it in JSP as javabean.
I have 2 files already, the first file is a connection code, and its compiled successfully, it looks like this
i named this as ConnectionBean.java
package my_package;
import java.sql.*;
public class ConnectionBean {
private Connection con;
private static final String driver = "org.postgresql.Driver";
private static final String url = "jdbc:postgresql://localhost:5432/PSQLDS";
private static final String username = "postgres";
private static final String password = "mypassword";
public ConnectionBean() {
public Connection logOn() {
try {
Class.forName(driver); con = DriverManager.getConnection(url, username, password); }
catch(ClassNotFoundException e) {
System.err.println("ConnectionBean: driver unavailable..."); con = null; }
catch (SQLException e) {
System.err.println("ConnectionBean: driver not loaded..."); con = null; }
return con;
public void logOff() {
try {
con.close(); }
catch (Exception e) {
e.printStackTrace(); }
as you can see above im using "package", and yes i have manage to put all my java files within the correct path (ROOT\WEB-INF\classes\my_package)
And also, i have test this class as javabean on JSP file and it works.
There for i continue to create the second java file, as a purpose to create a back engine for JSP. I use the same package as ConnectionBean.java, it looks like this
i named this as ListPageEngine.java
package my_package;
import java.beans.*;
import java.sql.*;
public class ListPageEngine {
public static void main(String[] args) {
ConnectionBean conBean = new ConnectionBean();}
on compiling process using command "javac ListPageEngine.java", i get this error message
ListPageEngine.java:11: cannot find symbol
symbol : class ConnectionBean
location: class my_package.ListPageEngine
ConnectionBean conBean = new ConnectionBean();}
^
ListPageEngine.java:11: cannot find symbol
symbol : class ConnectionBean
location: class my_package.ListPageEngine
ConnectionBean conBean = new ConnectionBean();}
^
2 errors
I think, i am pretty much sure that all my configuration (wheater its Apache TomCat, Environment Variable or PostgreSQL server) was good, as a prove, i was able to use ConnectionBean.class in my JSP file.
I susspect the problem is related with "package", seems i cannot use ConnectionBean class within ListPageEngine class when i use package.
For another information, i didn't install such thing as J2EE, i only install JDK 1.5, i also guess this might be the cause.
Right now im all stuck, i try to find thread which might be related with my problem but i failed to find it, most of them get the same answer by UncleSAM which are
Try the following forum (about JSP technology)
http://forum.java.sun.com/forum.jspa?forumID=45
JavaBeans spec contains nothing about JSP, but JSP spec describes using of beans.
i hope my question is clear so anyone who might have experience or clue with this problem might be able to help me.
Thanks beforefinally folks, i found answer to my own problem hehehehe..
the problem is on the compiling command (javac ... my_file.java), i found that i need to add some parameter on the command to make it works.
This problem solved. -
Unable to compile class for JSP. apache-tomcat-6. What could be wrong?
Hello, I am new to JSP and I am trying a very basic jsp and class file on Windows XP. I get the Unable to compile class for JSP.
Steps that I have done:
javac ch06_01.java , placed the ch06_01.class under
C:\Apps\apache-tomcat-6.0.16\webapps\ch06\WEB-INF\classes
Then grabbed the ch06_02.jsp and placed it under
C:\Apps\apache-tomcat-6.0.16\webapps\ch06\
When I run it (by placing this into Explorer or Firefox URL
http://localhost:8080/ch06/ch06_02.jsp) I get the error further
below. Things I have done and made sure they are in place are:
set up JAVA_HOME to C:\Apps\jdk1.6.0_06
Using CATALINA_BASE: C:\Apps\apache-tomcat-6.0.16
Using CATALINA_HOME: C:\Apps\apache-tomcat-6.0.16
Using CATALINA_TMPDIR: C:\Apps\apache-tomcat-6.0.16\temp
Using JRE_HOME: C:\Apps\jre1.6.0_06
I did a google on the error and I found people saying to place the
tools.jar from the jsk into the lib directory under CATALINA_HOME. But
the examples still don't work. What step could I be missing? Your help is greatly
appreciated.
This is the simple jsp file:
<%@ page import="ch06_01" %>
<HTML>
<HEAD>
<TITLE>Using a JavaBean</TITLE>
</HEAD>
<BODY>
<H1>Using a JavaBean</H1>
<% ch06_01 messager = new ch06_01(); %>
The message is: <%= messager.msg() %>
</BODY>
</HTML>
this is the simple ch6_01 java file:
public class ch06_01
public ch06_01()
public String msg()
return "Hello from JSP!";
HTTP Status 500 -
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: 6 in the generated java file
The import ch06_01 cannot be resolved
An error occurred at line: 9 in the jsp file: /ch06_02.jsp
ch06_01 cannot be resolved to a type
6: <BODY>
7: <H1>Using a JavaBean</H1>
8:
9: <% ch06_01 messager = new ch06_01(); %>
10:
11: The message is: <%= messager.msg() %>
12:
An error occurred at line: 9 in the jsp file: /ch06_02.jsp
ch06_01 cannot be resolved to a type
6: <BODY>
7: <H1>Using a JavaBean</H1>
8:
9: <% ch06_01 messager = new ch06_01(); %>
10:
11: The message is: <%= messager.msg() %>
12:
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:316)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
Edited by: indikon1 on Jun 12, 2008 1:18 PM
I just updated the directories of the variables to reflect the current status of my system.What is wrong is that you are using an "old" jsp tutorial :-)
Since Java 1.4, JSPs have been unable to access classes in the "default" package.
What you need to do:
Put the java class ch06_01 in a package.
Steps to do this
- Edit ch06_01 and add the following to the very top of the file (without the quotes): "package mypackage;"
- create a folder "mypackage"
- move ch06_01.java into that folder
- compile that class (now in the mypackage package)
- place ch06_01.class under C:\Apps\apache-tomcat-6.0.16\webapps\ch06\WEB-INF\classes\mypackage
In your jsp:
<%@ page import="mypackage.ch06_01" %>
I would suggest using a more up-to-date tutorial that uses JSTL.
Take a look at this [Apache Tomcat tutorial|http://www.coreservlets.com/Apache-Tomcat-Tutorial/index.html] -
Unable to compil class for jsp
error is
HTTP Status 500 -
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: 6 in the generated java file
Syntax error on token ".", Identifier expected after this token
An error occurred at line: 7 in the generated java file
Syntax error on token ".", Identifier expected after this token
An error occurred at line: 9 in the jsp file: /travel/issue.jsp
LibraryStudent cannot be resolved to a type
6: <BODY>
7: <H1>issue books</H1>
8: <CENTER>
9: <jsp:useBean id="student"
10: type="LibraryStudent"
11: scope="session" />
12: student name:
An error occurred at line: 9 in the jsp file: /travel/issue.jsp
LibraryStudent cannot be resolved to a type
6: <BODY>
7: <H1>issue books</H1>
8: <CENTER>
9: <jsp:useBean id="student"
10: type="LibraryStudent"
11: scope="session" />
12: student name:
An error occurred at line: 13 in the jsp file: /travel/issue.jsp
LibraryStudent cannot be resolved to a type
10: type="LibraryStudent"
11: scope="session" />
12: student name:
13: <jsp:getProperty name="student" property="studentName" />
14:
15: book name:
16: <jsp:getProperty name="student" property="bookName" />
An error occurred at line: 16 in the jsp file: /travel/issue.jsp
LibraryStudent cannot be resolved to a type
13: <jsp:getProperty name="student" property="studentName" />
14:
15: book name:
16: <jsp:getProperty name="student" property="bookName" />
17:
18: <jsp:getProperty name="student"
19: property="issueData" />
An error occurred at line: 18 in the jsp file: /travel/issue.jsp
LibraryStudent cannot be resolved to a type
15: book name:
16: <jsp:getProperty name="student" property="bookName" />
17:
18: <jsp:getProperty name="student"
19: property="issueData" />
20: </FORM>
21: </CENTER>LibraryStudent.java is
import java.util.*;
import java.text.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
public class LibraryStudent {
private String emailAddress, s,password, sname,bname;
private String date,value;
public String getStudentName() {
return(sname);
public void setStudentName(String sname) {
this.sname = sname;
public String getEmailAddress() {
return(emailAddress);
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
public String getPassword() {
return(password);
public void setPassword(String password) {
this.password = password;
public String getBookName() {
return(bname);
public void setBookName(String bname) {
this.bname = bname;
public String getDate() {
return(date);
public void setDate(String date) {
this.date = date;
public String getIssueData() //method that create connection withh database
throws ServletException,IOException{
try{
getDate(); //and add a entry in database
getBookName();
getStudentName();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:db2");
Statement st=con.createStatement();
String sql =
"insert into table1 (bookname,studentname,date) values(bname,sname,date)";
st.executeUpdate(sql);
System.out.println(sql);
String s= "your book has been issued ";
return(s);
catch(Exception e)
e.printStackTrace();
return "failed";
public String getSumbitData()
throws ServletException,IOException{
try
getBookName();
getStudentName();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:db2");
Statement st=con.createStatement();
String sql =
"delete from db2 where bookname='bname' and studentname=sname";
st.executeUpdate(sql);
System.out.println(sql);
String s="your book has been sumbitted ";
return(s) ;
catch(Exception e)
e.printStackTrace();
return "failed";
public static int findStudent //to validate customer
(String emailAddress,
String password) throws ServletException,IOException{
try
if (emailAddress == null) {
return(0);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:user");
Statement st=con.createStatement();
String sql="select * from user where name='"+emailAddress+"' and password='"+password+"'";
System.out.println(sql);
ResultSet rs=st.executeQuery(sql);
if(rs.next())
return(1);
else
return(0);
}catch(Exception e)
e.printStackTrace();
return (0);}
to be continued.............and Library.java is import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Library extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
String emailAddress = request.getParameter("emailAddress");//use to email&pass
String password = request.getParameter("password");//from html page
LibraryStudent student = new LibraryStudent();//Make a student Object
int a=LibraryStudent.findStudent(emailAddress, password);//to validate student
if (a==0) {
gotoPage("/library/accounts.jsp", request, response);
else
student.setStudentName(request.getParameter("sname"));//use to sent other textbox
student.setBookName(request.getParameter("bname"));//data in librarystudent
student.setDate(request.getParameter("date"));//class after validation
HttpSession session = request.getSession(true);
session.putValue("student", student);
//for moving different page
if (request.getParameter("issue") != null) {
gotoPage("/travel/issue.jsp",
request, response);
} else if (request.getParameter("sumbit") != null) {
gotoPage("/travel/sumbit.jsp",
request, response);
} else if (request.getParameter("search") != null) {
gotoPage("/travel/search.jsp",
request, response);
} else if (request.getParameter("account") != null) {
gotoPage("/travel/EditAccounts.jsp",
request, response);
} else {
gotoPage("/travel/IllegalRequest.jsp",
request, response);
private void gotoPage(String address,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher(address);
dispatcher.forward(request, response);
} issue.jsp is
<%@page import="java.io.,java.util.,java.sql.*"%>
<HTML>
<HEAD>
<TITLE>issue books</TITLE>
</HEAD>
<BODY>
<H1>issue books</H1>
<CENTER>
<jsp:useBean id="student"
type="LibraryStudent"
scope="session" />
student name:
<jsp:getProperty name="student" property="studentName" />
book name:
<jsp:getProperty name="student" property="bookName" />
<jsp:getProperty name="student"
property="issueData" />
</FORM>
</CENTER>
</BODY>
</HTML> plz solve my problem .i m new to servlet and jsp and i have keen desire to learn this topic -
Unable to compile class for JSP--- help me plz!!!!!
hi friends;
Pease suggest me where i am wrong, i think javabean is not instantiated in jsp file.may be it is related to the classpath of javabean. i have not set any variable for javabean classpath. and i put javabean class file in
TOMCAT_HOME/webapps/test3/WEB-INF/UseDta.class
and all the jsp and html in /test3. my jsp an javabeans are--
1. GetName.html
<HTML>
<BODY>
<FORM METHOD=POST ACTION="SaveName.jsp">
What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
<P><INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>
2. SaveName.jsp
<jsp:useBean id="user" class="UserData" scope="session">
<jsp:setProperty name="user" property="*"/>
</jsp:useBean>
<HTML>
<BODY>
Continue
</BODY>
</HTML>
3. UserData.java
public class UserData {
String username;
String email;
int age;
public UserData(){}
public void setUsername( String value )
username = value;
public void setEmail( String value )
email = value;
public void setAge( int value )
age = value;
public String getUsername() { return username; }
public String getEmail() { return email; }
public int getAge() { return age; }
4. NextPage.jsp
<jsp:useBean id="user" class="UserData" scope="session"/>
<HTML>
<BODY>
You entered<BR>
Name: <%= user.getUsername() %><BR>
Email: <%= user.getEmail() %><BR>
Age: <%= user.getAge() %><BR>
</BODY>
</HTML>
url: http://localhost:8080/test3/GetName.html
is it related to context path??
HTTP Status 500 -
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: 2 in the jsp file: /SaveName.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:44: cannot find symbol
symbol : class UserData
location: class org.apache.jsp.SaveName_jsp
UserData user = null;
^
An error occurred at line: 2 in the jsp file: /SaveName.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:46: cannot find symbol
symbol : class UserData
location: class org.apache.jsp.SaveName_jsp
user = (UserData) jspxpage_context.getAttribute("user", PageContext.SESSION_SCOPE);
^
An error occurred at line: 2 in the jsp file: /SaveName.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:48: cannot find symbol
symbol : class UserData
location: class org.apache.jsp.SaveName_jsp
user = new UserData();
^
3 errors
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:437)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.30 logs.
Apache Tomcat/5.0.30
please Reply me ASAP
i'll be glad if you reply. pleaseI am using Tomcat 6.0.
I have put my UserData class in user package and
used in below jsp(SaveName.jsp)
<%@ page import="user.UserData" %>
<jsp:useBean id="user" class="user.UserData" scope="session"/>
<jsp:setProperty name="user" property="*"/>
<HTML>
<BODY>
Continue
</BODY>
</HTML>
I have already set my classpath as C:\Documents and Settings\user\My Documents\Java\apache-tomcat-6.0.16\apache-tomcat-6.0.16\webapps\ROOT\WEB-INF\classes;
UserData class is in C:\Documents and Settings\user\My Documents\Java\apache-tomcat-6.0.16\apache-tomcat-6.0.16\webapps\ROOT\WEB-INF\classes\user
My UserData class is
package user;
public class UserData {
String username;
String email;
int age;
public UserData(){
this("","",0);
System.out.println("najn thanne puli");
public UserData(String username,String email,int age){
this.username=username;
this.email=email;
this.age=age;
public void setUsername( String value )
username = value;
public void setEmail( String value )
email = value;
public void setAge( int value )
age = value;
public String getUsername() { return username; }
public String getEmail() { return email; }
public int getAge() { return age; }
But running SaveName.jsp shows exception
org.apache.jasper.JasperException: /SaveName.jsp(2,0) The value for the useBean class attribute user.UserData is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1200)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1160)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2399)
org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
org.apache.jasper.compiler.Generator.generate(Generator.java:3372)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
Please help me.thanks in advance. -
Compilation Error for import classes not found in generated Proxy Class
Hi,
We are generating java classes for the COM dll using JCOM com2java compiler.
We are getting a compilation error for import class not found when compiling the
generated Proxy java source code. It can't find the com.bea.jcom.Dispatch class that
the generated Proxy java source code extends. It also can't find com.bea.jcom.Variant
or com.bea.jcom.Param. These are interfaces or data types or classes used by COM
library.
I added weblogic.jar to my class path and the only Dispatch class i found inside
the weblogic.jar is com.linar.jintegra.Dispatch;
We have com objects for which we want to develop an EJB client to interface with
the COM object using JCOM with Native Mode disabled.
Any help on the compilation error..I tried changing the extends for Dispatch to com.linar.jintegra.Dispatch
but the other errors are still there.
To begin with, I think the generated code should not refer to any of the COM data
types.
Any help please.
Thank you in advance,
Regards,
Rahul Srivastava
[email protected]Hi,
I resolved the other errors by changing all references from com.bea.jcom.Variant
etc to com.linar.jintegra.class name..all were present under the com.linar.jintegra
package.
Thank you all anyways,
Regards,
rahul
"Rahul Srivastava" <[email protected]> wrote:
>
Hi,
We are generating java classes for the COM dll using JCOM com2java compiler.
We are getting a compilation error for import class not found when compiling
the
generated Proxy java source code. It can't find the com.bea.jcom.Dispatch
class that
the generated Proxy java source code extends. It also can't find com.bea.jcom.Variant
or com.bea.jcom.Param. These are interfaces or data types or classes used
by COM
library.
I added weblogic.jar to my class path and the only Dispatch class i found
inside
the weblogic.jar is com.linar.jintegra.Dispatch;
We have com objects for which we want to develop an EJB client to interface
with
the COM object using JCOM with Native Mode disabled.
Any help on the compilation error..I tried changing the extends for Dispatch
to com.linar.jintegra.Dispatch
but the other errors are still there.
To begin with, I think the generated code should not refer to any of the
COM data
types.
Any help please.
Thank you in advance,
Regards,
Rahul Srivastava
[email protected] -
Using a Compiled Java Class --- Error
Hi All,
I am new to jsp tech. I am using 'Sun Java system application web server'.
I am getting following error when running ch06_02.jsp :
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
Generated servlet error:
[javac] /nfs/bxslnx/home/bxs/install/SUNWappserver/domains/domain1/generated/jsp/j2ee-modules/__default-web-module-server/org/apache/jsp/jsp/Examples/ch06/ch06_005f02_jsp.java:6: '.' expected
[javac] import ch06_01;
[javac] ^
[javac] 1 error
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:88)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:337)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:429)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:489)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:468)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:516)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:307)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:251)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
note The full stack trace of the root cause is available in the Sun-Java-System/Application-Server logs.
My two files are :
ch06_01.java
public class ch06_01
public ch06_01()
public String msg()
return "Hello from JSP!";
ch06_02.jsp
<%@page import="ch06_01" %>
<HTML>
<HEAD>
<TITLE>Using a JavaBean</TITLE>
</HEAD>
<BODY>
<H1>Using a JavaBean</H1>
<% ch06_01 messager = new ch06_01(); %>
The message is: <%= messager.msg() %>
</BODY>
</HTML>
Please help me ....... I don't know whats going wrong . I m using Suse OS.
Thanks
BasantHi
You have to place the xml parsing library inside the lib directory under the WTK.
Mihai
Maybe you are looking for
-
Retrieving old non iBookstore iBook content for iPad from Mac
I have recently bought a new iPad and decided to make a clean sweep and start from scratch. I have deleted all the old backups for my old iPad as they were hogging space and I thought I wouldn't need them however I forgot that I had a lot of books in
-
Columns in af:table rendering multiple times when filtering drop-down list
Technology: JDeveloper 10.1.3.0.4 SU5, ADF Faces/BC Page design: Master-detail jspx. Each section is an af:table. Drop-down lists created using instructions from http://www.oracle.com/technology/products/jdev/tips/muench/screencasts/editabletabledrop
-
Oracle9i Developer release 2 for Mac OS 10.2
Oracle 9i was released in August for Mac OS X. The release notes specify as a requirement Mac OS Server 10.2. Does Oracle 9i run on Mac OS 10.2 (as opposed to Mac OS 10.2 Server)? If not, what is missing in Mac OS 10.2?
-
Error trying to create first database with Database Studio on MaxDB 7.7
After installing the Database Studio 7.7 and starting up, i tried to create a first (local) database following the procedure documented in the online manual: Under the heading of "Servers" an entry "<Local>" was created. Then i used the right mouse
-
hey all, i have managed to set up zones on my solaris host but the ip addresses i assign them cant be pinged! i get "host unreachable from gateway...." the global zone ip is 192.168.0.1 and the zone ip is 192.168.0.15. I tried setting up the global z