Compiler issue with programmer defined class
I'm trying an example out of a Java book. I'm using jdk vs 5 to compile. In the example there are 2 classes Coin and CountFlips. CountFlips imports a class called Coin. I can use the -classpath statement and compile Coin ok, but when I compile CountFlips, it doesn't like the import statement ie import Coin; it gives me an error saying '.' expected. Since Coin.class is just in that directory and not part of a package, how should I get this to work ? I really would like to understand this.
Thank you in advance.
Hi,
do you deploy the Spring classes with the application ? I suggest to try the OracleAs forum as well to ensure this has to be in a specific path to be loaded. A list of forums is available from here
http://forums.oracle.com/forums/index.jspa?categoryID=84
Frank
Similar Messages
-
OCCI compilation issue with gcc-3.2.3 on Red Hat ES 2.1
Hello,
If I use OCCI of Oracle 10g and try to compile it with gcc-3.2.3 on Red Hat ES 2.1, I get linking errors.
The same works if I try to compile OCCI on Red Hat ES 3.0.
Any clues about how to compile the OCCI on RedHat ES/AS 2.1?Yes, I downloaded the OCCI for gcc-3.2.3.
As I said it works on Red Hat 3.0.
I want to compile it on Red Hat ES 2.1.
I have installed gcc-3.2.3 on Red Hat ES 2.1. But the occi compilation wont succeed onto it. -
Having compiler issues with Array, can anyone help please?
Using your Invoice class created in lab02, write a client program that allows the user to input three Invoice objects into an array of Invoice objects. After you have inputted all of the invoices, print a heading and then output all of the array elements (Invoice objects) by calling the method from your Invoice class that displays all of the data members on a single line using uniform field widths to insure that all Invoice objects will line up in column format (created in Lab04). At the end of the loop, display the calculated total retail value of all products entered in the proper currency format.
Example of possible program execution:
Part Number : WIDGET
Part Description : A fictitious product
Quantity : 100
Price : 19.95
(etc.)
Example of possible output
Part Number Part Description Quantity Price Amount
WIDGET A fictitious product 100 19.95 199.95
Hammer 9 pounds 10 5.00 50.00
(etc.)
Total Retail Value: 249.95
This is what I have so far at the bottom, can anyone tell me what I'm doin wrong please
//Invoice Lab 6
//Application to test class Invoice with arrays
public class InvoiceTest
public static void main( String args[] )
Invoice invoice1 = new Invoice( "1234", "Hammer", 2, 14.95 );
Invoice array [] = new Invoice [2];
array [0] = new Invoice ("1234", "Hammer", 2, 14.95);
array [1] = new Invoice ("5678", "PaintBrush", -5, -9.99);
double total = 0.0;
System.out.println("Part Number Description Quantity Price Amount");
System.out.println("----------------------------------------------------------------------------------");
for (int i=0; <=2; i++)
total+=array.getPaymentAmount();
system.out.println("The Total retail value is: %.2f\n")
// display invoice1
System.out.println( "Original invoice information" );
System.out.printf( "Part number: %s\n", invoice1.getPartNumber() );
System.out.printf( "Description: %s\n",
invoice1.getPartDescription() );
System.out.printf( "Quantity: %d\n", invoice1.getQuantity() );
System.out.printf( "Price: %.2f\n", invoice1.getPricePerItem() );
System.out.printf( "Invoice amount: %.2f\n",
invoice1.getInvoiceAmount() );
// change invoice1's data
invoice1.setPartNumber( "001234" );
invoice1.setPartDescription( "Blue Hammer" );
invoice1.setQuantity( 3 );
invoice1.setPricePerItem( 19.49 );
// display invoice1 with new data
System.out.println( "\nUpdated invoice information" );
System.out.printf( "Part number: %s\n", invoice1.getPartNumber() );
System.out.printf( "Description: %s\n",
invoice1.getPartDescription() );
System.out.printf( "Quantity: %d\n", invoice1.getQuantity() );
System.out.printf( "Price: %.2f\n", invoice1.getPricePerItem() );
System.out.printf( "Invoice amount: %.2f\n",
invoice1.getInvoiceAmount() );
Invoice invoice2 = new Invoice( "5678", "PaintBrush", -5, -9.99 );
// display invoice2
System.out.println( "\nOriginal invoice information" );
System.out.printf( "Part number: %s\n", invoice2.getPartNumber() );
System.out.printf( "Description: %s\n",
invoice2.getPartDescription() );
System.out.printf( "Quantity: %d\n", invoice2.getQuantity() );
System.out.printf( "Price: %.2f\n", invoice2.getPricePerItem() );
System.out.printf( "Invoice amount: %.2f\n",
invoice2.getInvoiceAmount() );
// change invoice2's data
invoice2.setQuantity( 3 );
invoice2.setPricePerItem( 9.49 );
// display invoice2 with new data
System.out.println( "\nUpdated invoice information" );
System.out.printf( "Part number: %s\n", invoice2.getPartNumber() );
System.out.printf( "Description: %s\n",
invoice2.getPartDescription() );
System.out.printf( "Quantity: %d\n", invoice2.getQuantity() );
System.out.printf( "Price: %.2f\n", invoice2.getPricePerItem() );
System.out.printf( "Invoice amount: %.2f\n",
invoice2.getInvoiceAmount() );
} // end main
} // end class InvoiceTestChange this (check my comments):
for (int i=0; <=2; i++) // what is <=2?? check the fixed version
total+=array.getPaymentAmount(); //two things 1) this needs to be inside the for-loop 2) you need to tell the array which index to look at
system.out.println("The Total retail value is: %.2f\n") //no need for \n because println does it automagically
}to this:
for(int i=0; i<array.length; i++) {
total += array.getPaymentAmount();
System.out.println("The total retail value is: " + total); //if you need another blank line like above be my guest
Honestly, I didn't look past this part so fix this and post again if something is still broken. -
Compilation issues with shared swc
I am often having error messages when I compile my project, that are often fixed with simply doing a Project clean. although, sometimes it requires to recompile certain graphic libraries.
I get this error most of the time "Unable to convert LinkageName to MovieClip" when instanciating a graphic. Or sometimes it can't find a class that is in another library
Is there something that we should do to our projects to change this? I am worried that when I compile an appStore IPA, I will have one of those errors slip and render my app useless.
All my libraries are merged with code and there is some Runtime sharing in my graphic swc's, although the issue is sometimes not even related to that
Thanks in advance for the helpThe weird name you mentioned, is that the server name listed in your mail profile in Outlook? If so, that is to be expected as Exchange 2013 uses a long string for server names. For example, on my profile for my Exchange 2013 server I see this
"3a5b584b-5f64-4e82-abde-ac32da667965@<my domain>".
So let me summarize what you said above to make sure we are all on the same page:
1) Open Shared mailbox by itself it fails
2) Add the mailbox as an additional mailbox it works.
How do you want to connect to this mailbox? Do you want #1 to work where you open just that mailbox as a profile. If you do, see this answer as it might work for what you are attempting -
http://social.technet.microsoft.com/Forums/en-US/64fc973b-2825-4991-8fa3-3d08c6a8df93/outlook-2010-cant-create-a-new-profile-with-a-shared-mailbox.
JAUCG - Please remeber to mark replies as helpful if they were or as answered if I provided a solution. -
Namespace issue with oracg generated classes
Hi,
I'm having problems generating classes with oracg from the Java Xdk from an XML schema. All classes are generated, but do not compile. In some sources (mostly in the type classes) "public void addSomething(null.Something theSomething)" is generated as the method declaration, and that doesn't compile. When I add a targetnamespace to the xsd file, the generated sources compile (the 'null.' is replaced with 'myPackage.', but when I generate an XML document, I contains a namespace reference (ns1) like this:
<ns1:Note xmlns:ns1 = "http://www.somewhere.org">
<ns1:Form>
<ns1:Reference>
<ns1:ReferenceNbr>1</ns1:ReferenceNbr>
<ns1:ReferenceType>1</ns1:ReferenceType>
</ns1:Reference>
</ns1:Form>
</ns1:Note>
What I want is this:
<Note>
<Form>
<Reference>
<ReferenceNbr>1<ReferenceNbr>
<ReferenceType>1<ReferenceType>
</Reference>
</Form>
</Note>
How can I get this result ?
Kind regards.Did you try adding the the XmlSeeAlso annotation to the webservice
@XmlSeeAlso({<package.name>.AccountIC.class})
This will add the schema for the data type (AccountIC) to the WSDL.
Hope this helps.
-Ajay -
This is what I want to achieve USING the ACE as a reverse proxy.
User uses the url https://abc/password - gets to the destination server & the web page
If user tries to use any thing additional then the connection is dropped at the ACE such as
https://abc/password/test or any such variation.
Following is the config I have to achieve this
class-map type http loadbalance match-any L7-CLASS-TEST
match http url /password
match http url /password/
class-map type http loadbalance match-any L7-CLASS-TEST-deny
2 match http url .*.*
policy-map type loadbalance first-match LBP-TEST
class L7-CLASS-TEST
serverfarm FARM-TEST
ssl-proxy client TEST
class L7-CLASS-TEST-deny
drop
class class-default
serverfarm FARM-TEST
ssl-proxy client TEST
The problem with this is when the page opens I get broken links on all the images. If I use the following line
match http url /password.*
I get the images to work but the user can use the https://abc/password/test which is not what I want.
Has any one faced this issue ?
Any help will be appreciated.
Thanks in advance
PrasannaPrasanna,
What about if you try it in HTTP and apply the following change?
class-map type http loadbalance match-any L7-CLASS-TEST-deny
2 match http url /.*
This should work in HTTP but not with HTTPS
Anyway, it should not work since everything seems to be encrypted, you may require either SSL-termination or END-TO-END SSL for this then the ACE can decrypt the request see what it needs to do and take the load balance decision.
Jorge -
BUG: Oracle Java Compiler bug with anonymous inner classes in constructor
The following code compiles and runs just fine using 1.4.2_07, 1.5.0_07 and 1.6.0_beta2 when compiling and running from the command-line.
It does not run when compiling from JDeveloper 10.1.3.36.73 (which uses the ojc.jar).
When compiled from JDeveloper, the JRE (both the embedded one or the external 1.5.0_07 one) reports the following error:
java.lang.VerifyError: (class: com/ids/arithmeticexpr/Scanner, method: <init> signature: (Ljava/io/Reader;)V) Expecting to find object/array on
stack
Here's the code:
/** lexical analyzer for arithmetic expressions.
Fixes the lookahead problem for TT_EOL.
public class Scanner extends StreamTokenizer
/** kludge: pushes an anonymous Reader which inserts
a space after each newline.
public Scanner( Reader r )
super( new FilterReader( new BufferedReader( r ) )
protected boolean addSpace; // kludge to add space after \n
public int read() throws IOException
int ch = addSpace ? ' ' : in.read();
addSpace = ch == '\n';
return ch;
public static void main( String[] args )
Scanner scanner = new Scanner( new StringReader("1+2") ); // !!!
Removing the (implicit) reference to 'this' in the call to super() by passing an instance of a static inner class 'Kludge' instead of the anonymous subclass of FilterReader fixes the error. The code will then run even when compiled with ojc. There seems to be a bug in ojc concerning references to the partially constructed object (a bug which which is not present in the reference compilers.)
-- SebastianThanks Sebastian, I filed a bug for OJC, and I'll look at the Javac bug. Either way, OJC should either give an error or create correct code.
Keimpe Bronkhorst
JDev Team -
Two compile issues with Sun Studio 12 @ x86(_64 = amd64)
The following two issues are absent on Solaris 10 SPARC and all previous Sun Studio versions (8 to 11), but present on both amd64 Solaris 10 and Linux 2.6 versions:
1. mozilla.org's Spidermonkey "JavaScript" (ECMAscript) can't be compiled with it: in file jsinterp.c an endless loop is entered by the optimizer in level -xO1 and higher (!). With no optimization, linking is impossible (unresolved symbols from jsinterp.o), which hints to defunct output.
2. the optimizer (ube) is crashing in sources with a switch with many many case labels in optimization level -xO3 and higher with a segfault.I have trouble to seperate a reasonable (example) source out of our complex sources showing the second issue --- what I can already tell is, that the following special pragma has to do with it (while I'm now in doubt that the each 256 case labels per switch, two switches in an if else clause have to do with it):
#pragma opt 0 (func_name)
Own1 Own2 func_name(...)
The buggy versions I can tell you: they are
on Solaris 10 amd64:
/opt/SUNWspro/bin/cc -V
cc: Sun C 5.9 SunOS_i386 2007/05/03
/opt/SUNWspro/prod/bin/ube -V
ube: Sun Compiler Common 12 SunOS_i386 2007/05/03
on GNU/Linux:
cc -V
cc: Sun C 5.9 Linux_i386 2007/05/03
ube -V
ube: Sun Compiler Common 12 Linux_i386 2007/05/03
The only important compiler option in this regard seems to be the optimization level, but the situation is complex too, if others should be also involved. I will investigate further... -
Need help with User defined class
I need to create two Java classes. The first class will be used as a template for objects which represent students, the second will be a program which creates two student object and calls some of their methods.
Create a file called "Student.java" and in it definr a class called Student which has the following Attributes:
* a String variable which can hold the student's name
* a double variable which can hold the studnet's exam mark.
In the student class, define public methods as follows:
1 a constructor method which accepts no arguments. This method should initialise the student's name to "unknown" and set the examination mark to zero
2 A constructor method which accepts 2 arguments- the first being a string representing the student's name and the other being a double which represents their exam mark. These arguments should be used to initialise the state variables with one proviso- the exam mark must not be set to a number outside the range 0...100. If the double argument is outside this range,set the exam mark attribute to 0.
3 A reader method which returns the students name
4 A reader method which returns the students exam mark.
5 A writer method which sets the student's name
6 A writer method which sets the student's eeam mark. If the exam mark argument is outside the the 0...100 range,the exam mark attibute should not be modified.
7 A method which returns the studnet's grade. The grade is a string such as "HD" or "FL" which can be determined from the following table.
Grade Exam Mark
HD 85..100
DI 75..84
CR 65..74
PS 50..64
FL 0..49
Part2 Client Code
Write a program in a file called "TestStudent.java"
Make sure the file is in the same directory as tne "Student.java" file
In the main method of "TestStudent.java" write code to do each of the following tasks
1 Create a student object using the no argument constructor.
2 Print this student's name and their exam mark
3 Create another student object using the other constructor-supply your own name as the string argument and whatever exam mark you like as the double argument
4 Print this studnet's name and their exam mark
5 Change the exam mark of this student to 50 and print their exam mark and grade.
6 Change the examination mark of this studnet to 256 and print their exam mark and grade.
Can someone please help
gooberSorry, I have sent you the wrong version. Try this,
public class Student {
private String name;
private double examMark;
public Student() {
name = "unknown";
examMark = 0.0;
public Student(String n, double em) {
name = n;
if(em >0 && em < 100) {
examMark = em;
} else {
examMark = 0.0;
public String getName() {
return name;
public void setName(String n) {
name = n;
public double getExamMark() {
return examMark;
public void setExamMark(double em) {
if(em >0 && em < 100) {
examMark = em;
} else {
examMark = 0.0;
public String getGrade() {
if ( examMark > 84) return "HD";
else if(examMark > 74) return "DI";
else if(examMark > 64) return "CR";
else if(examMark > 49) return "PS";
else return "FL";
} and
class TestStudent {
public static void main(String a[]) {
Student st = new Student();
System.out.println("Student Name is : "+st.getName());
System.out.println("Student Marks is : "+st.getExamMark());
Student st1 = new Student("XXXX",78);
System.out.println("Student Name is : "+st1.getName());
System.out.println("Student Marks is : "+st1.getExamMark());
st1.setExamMark(67);
System.out.println("Student Marks is : "+st1.getExamMark());
System.out.println("Student Grade is : "+st1.getGrade());
st1.setExamMark(256);
System.out.println("Student Marks is : "+st1.getExamMark());
System.out.println("Student Grade is : "+st1.getGrade());
}Hope this helps.
Sudha -
Java 6 Compiler issue with Windows 7
Hi,
Sorry for the newbie question. I am very new to Java and am currently reading Sams Teach Yourself Java 6 and am having a problem with the JDK 6 compiler. I wrote the beginner program "Hello Username" to test if the compiler is working and am getting the following configuration error when i go to compile it. 'javac' is not recognized as an internal or external command, operable program or batch file. I added the path C:\Program Files\Java\jdk1.6.0_01\bin to the PATH system variable as the book suggested but it did not change anything. What am I missing? The book was published in 2007 and does not include Windows 7. How can I fix this and get it running?
Thanks for any help you can offer.
CaseyAt first you have to sucessfully run the command
java -versionin a DOS console. if the output is something like
java version "1.6.0_15"
Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
Java HotSpot(TM) Client VM (build 14.1-b02, mixed mode, sharing)your problem is gone.
Type in this console th command
pathand there you have to find your path setting
...;C:\Program Files\Java\jdk1.6.0_01\bin;...In general you will have a environment setting JAVA_HOME=C:\Program Files\Java\jdk1.6.0_01 and the path has a
...;%JAVA_HOME%\bin;... -
JSP Compilation Issue with Tomcat 4.0.6
Hi There,
I've been checking the following issue online for sometime but I just can't seem to figure what is wrong with the server setup. I've this very simple JSP page processing the form variables submitted to an action page which is another JSP page. Thecode segement in the target JSP is like this;
if(request.getParameter("contactUsSubmit")!=null)
}Whenever I try to use request.getParameter("XYZ") in the target page just like above, I get following error from Tomcat;
Apache Tomcat/4.0.6 - HTTP Status 500 - Internal Server Error
type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: org/apache/jasper/runtime/JspException
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:481)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:98)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:458)
at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:551)
at java.lang.Thread.run(Thread.java:534)
root cause
java.lang.NoClassDefFoundError: org/apache/jasper/runtime/JspException
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:463)
at org.apache.jsp.contact$jsp._jspService(contact$jsp.java:174)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:98)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:458)
at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:551)
at java.lang.Thread.run(Thread.java:534)
When I comment the code fragment, it works. It is not about what is in the if statment is true, I can assure you. Consider it as simple output to ease your mind.
Any ideas why this might be happening? I'vve tried the same code with Resin 2.x and Tomcat 5.5 , it works just fine. Do you think there is something missed with the Tomcat setup or the Tomcat version (4.0.6) on that specific server is no good?
Any comments are greatly appreciated.
Thanks in advance...
Regards,
MertHi There,
As you said using equals would not work as it should be a valid String in order for the eqauls function to work.
Unfortuantely I can't access the Servlet created or the log files. It has crossed my mind too but this is a setup by the service provider and they don't let you nose into their business but they ahvedone something wrong with their system as far I can think.
I've wanted to print the output to the web but when i use the request.getParameter it just creates the error.
Java service is provided optional and as any optional service it is not well supported so I need to make them some pointers. So any more ideas?
Cheers,
Mert -
Hello all,
I have the following validating class that is supposed to check the usernames and passwords held in a file against what the user has typed into a form;
package bus;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
import bus.Credentials;
public class LogonValidator implements Validator {
public boolean supports(Class clazz) {
return clazz.equals(Credentials.class);
public void validate(Object obj, Errors errors) {
Credentials credentials = (Credentials) obj;
String usernameCompare = credentials.getUsername();
String passwordCompare = credentials.getPassword();
String username;
String password;
String[] data;
try {
BufferedReader in = new BufferedReader(new FileReader("C:/Documents and Settings/Jaz/workspace/OBS/war/LoginInfo.txt"));
String inLine = null;
while ((inLine = in.readLine()) != null) {
data = inLine.split(",");
username = data[0];
password = data[1];
if (((username.toString()).equals(usernameCompare))== false){
errors.rejectValue("username", "error.login.invalid-user",
null, "Value required.");
else{
if (((password.toString()).equals(passwordCompare)) == false){
errors.rejectValue("password", "error.login.invalid-pass",
null, "Incorrect Password.");
in.close();
}catch (IOException e){
}the file the class is to read from (LogonInfo.txt) intially contained only;
guest,guestand the app worked perfectly fine. However when more entries were added as such;
guest,guest
vip,vip
someone,someone
nobody,nobodythe form did not validate anything anymore. When I enter a valid username and password that is found in the txt file it simply says value required. Even if I use the initial entries of guest. Im completely lost with this one. Can anyone help?
Thank YouThank you very much for your help. I have amended the code as such;
while ((inLine = in.readLine()) != null) {
data = inLine.split(",");
username = data[0];
password = data[1];
if (username.equals(usernameCompare) && password.equals(passwordCompare)) {
break;
if (username.equals(usernameCompare)== false && password.equals(passwordCompare)){
errors.rejectValue("username", "error.login.invalid-user",
null, "Value required.");
else{
if (password.equals(passwordCompare) == false && username.equals(usernameCompare)){
errors.rejectValue("password", "error.login.invalid-pass",
null, "Incorrect Password.");
} I thought this would have worked, however it validates the username and password even if both are incorrect. What I would have expected it to do is to validate only if both username and password were correct.
Also if the username was correct and password incorrect display the appropriate error message. Again if the password was incorrect and the username correct display the error message.
I dont understand why this is not working.
Message was edited by:
Jazman -
Compile issues with cross-mipsel-linux-gnu-gcc
I'm trying to set up some sort of cross-compilation environment in order to compile software for a MIPS device.
I installed cross-mipsel-linux-gnu-gcc (4.7.2-1) along with cross-mipsel-linux-gnu-binutils (2.22-1). Then I tried to compile a simple Hello World, and the result was as follows:
[mcmlxxxvi@deepspace1 hello-world]$ cat hello.c
#include <stdio.h>
int main()
printf("Hello World!\n");
return 0;
[mcmlxxxvi@deepspace1 hello-world]$ mipsel-linux-gnu-gcc hello.c
hello.c:1:19: fatal error: stdio.h: No such file or directory
compilation terminated.
[mcmlxxxvi@deepspace1 hello-world]$ mipsel-linux-gnu-gcc hello.c -I/usr/include
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/4.7.2/../../../../mipsel-linux-gnu/bin/ld: cannot find crt1.o: No such file or directory
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/4.7.2/../../../../mipsel-linux-gnu/bin/ld: cannot find crti.o: No such file or directory
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/4.7.2/../../../../mipsel-linux-gnu/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/4.7.2/../../../../mipsel-linux-gnu/bin/ld: cannot find -lgcc
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/4.7.2/../../../../mipsel-linux-gnu/bin/ld: cannot find -lc
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/4.7.2/../../../../mipsel-linux-gnu/bin/ld: cannot find -lgcc
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/4.7.2/../../../../mipsel-linux-gnu/bin/ld: cannot find crtend.o: No such file or directory
/usr/lib/cross-mipsel-linux-gnu/lib/gcc/mipsel-linux-gnu/4.7.2/../../../../mipsel-linux-gnu/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
I know I generally need a compatible glibc build, but a) there isn't a package pre-built for MIPS as the compiler, and b) there is no mention of glibc in either gcc or binutils' AUR pages. So I thought that these two packages were somehow supposed to be sufficient - and they aren't.
I found a tutorial on setting up cross-compilation for MIPS and I tried to build libc, but as I used the gcc and bunutils AUR pacakges instead of going straight for the source, and, probably, as the tutorial is geared towards slightly older versions, I did not succeed. configure produced only a config.log and I wasn't able to make.
So, how are cross-mipsel-linux-gnu-gcc and cross-mipsel-linux-gnu-binutils supposed to be used? How do I need to set up my environment in order to be able to invoke the MIPS gcc the same way as my regular gcc?
Thanks in advance.The problem is gone after going to Kernel 39 in testing.
-
Issues with Weblogic - Offending class: javax/servlet/Servlet.class
Hi,
I've been working on a servlet that calls EJB objects and I'm having problems deploying it under Tomcat. It prints the following error message when I try to deploy the app:
INFO: validateJarFile(/home/xxxxx/tomcat/webapps/hello/WEB-INF/lib/wlfullclient.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
For reference, here is how my web.xml file looks like:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Hell World Servlet</display-name>
<description>
A Hello World servlet example for Entity Beans.
</description>
<servlet>
<servlet-name>HelloWorldServletEJB</servlet-name>
<description>
A Hello World servlet example for Entity Beans.
</description>
<servlet-class>examples.helloworld.HelloWorldServletEJB</servlet-class>
<load-on-startup>5</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorldServletEJB</servlet-name>
<url-pattern>/HelloWorldServletEJB</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout> <!-- 30 minutes -->
</session-config>
</web-app>and here is my directory tree structure:
hello/
`-- WEB-INF
|-- classes
| `-- examples
| `-- helloworld
| |-- Hello.class
| |-- HelloHome.class
| `-- HelloWorldServletEJB.class
|-- jsp
|-- lib
| `-- wlfullclient.jar
|-- web.xml
`-- web.xml.oldI've been dealing with this problem for the past 3 days and I'm really stuck at this point. Any help would be much appreciated.
Thanks
Edited by: spinth on May 19, 2009 9:19 PM
Edited by: spinth on May 19, 2009 9:20 PMI'm not sure what your code does but Tomcat doesn't support EJBs.
-
Issue with GregorianCalendar class
Hi I'm having issues with the GregorianCalender class. I am trying to enable daylight savings time but it doesn't seem to be working properly for. As a test I have taken the difference of time (in milliseconds) between a date where daylight savings causes a shift in time (April 4, 2004 for example). The two sample dates I have chosen are April 5, 2004 and April 4, 2004, ideally the time difference should be 23 hrs (since one hour is lost due to daylight savings) but I am getting 24hrs. I have a sample program in C++ which gives me the correct answer so I know the result am I getting here is wrong. Anybody have any suggestions?
String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
if (ids.length == 0)
System.exit(0);
// create a Pacific Standard Time time zone
SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
// set up rules for daylight savings time
pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 60 * 60 * 1000, true);
pdt.setEndRule(Calendar.OCTOBER, 31, Calendar.SUNDAY, 60 * 60 * 1000, false);
pdt.setDSTSavings( 60*60*1000 );
GregorianCalendar cal = new GregorianCalendar(2004, 4, 4);
GregorianCalendar cal1 = new GregorianCalendar(2007, 4, 5);
cal1.setTimeZone ( pdt );
cal.setTimeZone( pdt );
//This values is incorrect
long diff = cal1.getTimeInMillis() - cal.getTimeInMillis();
//I have also tried the following
String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
if (ids.length == 0)
System.exit(0);
// create a Pacific Standard Time time zone
SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
// set up rules for daylight savings time
pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 60 * 60 * 1000, true);
pdt.setEndRule(Calendar.OCTOBER, 31, Calendar.SUNDAY, 60 * 60 * 1000, false);
pdt.setDSTSavings( 60*60*1000 );
GregorianCalendar cal = new GregorianCalendar(pdt);
GregorianCalendar cal1 = new GregorianCalendar(pdt);
cal1.set(2004, 4, 5 );
cal.set( 2004, 4, 4 );
//This values is incorrect
long diff = cal1.getTimeInMillis() - cal.getTimeInMillis();
ThanksThere may be any of several issues:
Daylight savings time moves from year to year. Maybe last year, it was not on the same week number.
Daylight savings time officially occurs at 2am. Java date's default to midnight if explicitly initialized. So, try calculating from after 2-3 am, depending on which way time was shifted.- Saish
"My karma ran over your dogma." - Anon
Maybe you are looking for
-
Embedded fonts display differently in mx and spark
Hi there, My apologies if this is an known issue but I have not been able to find any posts describing this problem. As the title of the discussion describes the problem I see is that when embedding the same font for spark and mx components they disp
-
What is wrong in this java code?
Can someone please tell me what is wrong in this java code? /* The program is intended to start animating text at the click of a button, pause it at another click and resume at the next click. It should continue like this */ import javax.swing.*; imp
-
Set_magic_quotes_runtime is deprecated
I used DWCS3 to produce an XSLT Fragment which pulls in an RSS Feed. I keep getting error messages on my live server telling me: An error occurred in script '/home/mydomain/includes/MM_XSLTransform/MM_XSLTransform.class.php' on line 187: <br />Funct
-
ITunes 9 on SnowLeopard is slow in syncing with iPhone
Since I have installed the new iTunes version my sync process with my iPhone is very sluggish, iTunes is unresponsive during that time. While I am writing here I can click on iTunes but nothing happens.
-
4.0 does not work too well...
Since downloading 4.0, I've had lots of problems with page loading, Trackpad gestures, scrolling. having to click a new page to make it active, pointer does strange things on any page and a host of other minor but none the less irritating issues. I'v