Error in code compiling
Hi this is the error i am getting while compiling
C:\>javac SessionListener.java
SessionListener.java:17: <identifier> expected
private static Map<String,HttpSession> sessionMX = new HashMap<String,HttpSe
ssion>();
^
SessionListener.java:60: <identifier> expected
public static Set<String> getActiveSessionids(){
^
SessionListener.java:118: ';' expected
^
3 errorsthis is the code which i am compiling so can you suggest me something....
thanks in advance
package com.listeners;
import java.util.Map;
import java.util.HashMap;
import java.util.Collections;
import java.util.Set;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionListener;
import javax.servlet.http.HttpSessionEvent;
public class SessionListener implements HttpSessionListener{
/*Usage of a Static Collection Object is what the other Poster is talking about*/
private static Map<String,HttpSession> sessionMX = new HashMap<String,HttpSession>();
/*Called @time when a new session is created */
public void sessionCreated(HttpSessionEvent se){
HttpSession session = se.getSession();
sessionMX.put(session.getId(),session);
/*Called @time when an existing session is being destroyed */
public void sessionDestroyed(HttpSessionEvent se){
HttpSession session = se.getSession();
sessionMX.remove(session.getId());
/* Utility Methods */
* Returns number os active sessions
public static int getNoActiveSessions(){
return sessionMX.size();
* Returns a Set of Active SessionIds
public static Set<String> getActiveSessionids(){
return sessionMX.keySet();
* Returns whether there is any Active Session or not
public static boolean isActive(String sessionId){
return sessionMX.containsKey(sessionId);
* Returns associated session for specified sessionID
* if not found returns 'null'
public static HttpSession getAssociatedSession(String sessionId){
HttpSession session = null;
if(isActive(sessionId))
session = sessionMX.get(sessionId);
return session;
* Invalidates the specified session with consequent sessionID
* returns true if succeful else returns false
public static boolean force2Invalidate(String sessionId){
boolean flag = false;
if(isActive(sessionId)){
sessionMX.get(sessionId).invalidate();
flag = true;
return flag;
}
What version of the javac compiler are you using? To use generics it needs to be 1.5 or later
Similar Messages
-
Can anyone explain why the code compiles on one database but not another?
I have two databases, both running 10.2.0.4, same hardware/OS platform.
On one database, this code compiles just fine, on the second database, I get errors as shown below:
SQL> SET SERVEROUTPUT ON SIZE 1000000;
SQL>
SQL> create or replace procedure testproc as
2 vCount number;
3 vCmd varchar2(2048);
4 vLastName varchar2(30);
5 vFirstName varchar2(30);
6 vPK integer := 0;
7 vSortLN varchar2(30);
8 vSortFN varchar2(30);
9 cursor cPERSON is
10 select LastName,
11 FirstName
12 from GENERIC.PERSON
13 order by LastName, FirstName;
14 BEGIN
15 select count(*) into vCount from USER_OBJECTS where object_name = 'ML4TEMPPERSON';
16
17 IF (vCount = 0) THEN
18 /* NOTE: Omit semi-colon from command. */
19 vCmd := 'create table ML4TEMPPERSON (PK integer not null, LastName varchar2(30), SortLN varchar2(30), FirstName varchar2(30), SortFN varchar2(30))';
20 Execute Immediate vCmd;
21 vCmd := 'alter table ML4TEMPPERSON add (constraint XPKML4TEMPPERSON PRIMARY KEY (PK))';
22 Execute Immediate vCmd;
23 END IF;
24
25 delete from ML4TEMPPERSON;
26
27 for P in cPERSON
28 loop
29 vLastName := rpad(P.LastName, 30, ' ');
30 vFirstName := rpad(P.FirstName, 30, ' ');
31 vSortLN := vLastName;
32 vSortFN := vFirstName;
33 DBMS_OUTPUT.PUT_LINE(vLastName || ', ' || vFirstName);
34 vPK := vPK+1;
35 INSERT into ML4TEMPPERSON
36 ( PK, LastName, SortLN, FirstName, SortFN)
37 values
38 (vPK, vLastName, vSortLN, vFirstName, vSortFN);
39 end loop;
40 IF (vPK > 0) THEN
41 COMMIT;
42 END IF;
43 END;
44 /
Warning: Procedure created with compilation errors.
SQL> show errors
Errors for PROCEDURE TESTPROC:
LINE/COL ERROR
25/3 PL/SQL: SQL Statement ignored
25/15 PL/SQL: ORA-00942: table or view does not exist
35/7 PL/SQL: SQL Statement ignored
35/19 PL/SQL: ORA-00942: table or view does not exist
SQL>Your table ML4TEMPPERSON doesn't exist in your second database, and you want do delete ans insert, may be in first database the table ML4TEMPPERSON exist
Try this code. /* Formatted on 2009/05/21 09:10 (Formatter Plus v4.8.8) */
SET SERVEROUTPUT ON SIZE 1000000;
CREATE OR REPLACE PROCEDURE testproc
AS
vcount NUMBER;
vcmd VARCHAR2 (2048);
vlastname VARCHAR2 (30);
vfirstname VARCHAR2 (30);
vpk INTEGER := 0;
vsortln VARCHAR2 (30);
vsortfn VARCHAR2 (30);
CURSOR cperson
IS
SELECT lastname, firstname
FROM generic.person
ORDER BY lastname, firstname;
BEGIN
SELECT COUNT (*)
INTO vcount
FROM user_objects
WHERE object_name = 'ML4TEMPPERSON';
IF (vcount = 0)
THEN
/* NOTE: Omit semi-colon from command. */
vcmd :=
'create table ML4TEMPPERSON (PK integer not null, LastName varchar2(30), SortLN varchar2(30), FirstName varchar2(30), SortFN varchar2(30))';
EXECUTE IMMEDIATE vcmd;
vcmd :=
'alter table ML4TEMPPERSON add (constraint XPKML4TEMPPERSON PRIMARY KEY (PK))';
EXECUTE IMMEDIATE vcmd;
END IF;
vcmd := 'delete from ML4TEMPPERSON';
EXECUTE IMMEDIATE vcmd;
FOR p IN cperson
LOOP
vlastname := RPAD (p.lastname, 30, ' ');
vfirstname := RPAD (p.firstname, 30, ' ');
vsortln := vlastname;
vsortfn := vfirstname;
DBMS_OUTPUT.put_line (vlastname || ', ' || vfirstname);
vpk := vpk + 1;
vcmd :=
'INSERT into ML4TEMPPERSON
( PK, LastName, SortLN, FirstName, SortFN)
values
|| vpk
|| ', '
|| vlastname
|| ','
|| vsortln
|| ','
|| vfirstname
|| ','
|| vsortfn
|| ')';
EXECUTE IMMEDIATE vcmd;
END LOOP;
IF (vpk > 0)
THEN
COMMIT;
END IF;
END;
/Edited by: Salim Chelabi on 2009-05-21 06:12 -
XSLT Exception: FATAL ERROR: 'Could not compile stylesheet'
Hi....
Am getting Folowing Exception while parsing the XSL file. Am using java 1.4 and MSXML4.2 SP2 parser andSDK.
but when I installed SQLServer2005, with that MSXML 6.0 Parser is Installed.
It is working fine before instalation of SQLServer2005.
java.lang.NullPointerException
at com.sun.org.apache.xalan.internal.xsltc.compiler.FunctionCall.translate(FunctionCall.java:826)
at com.sun.org.apache.xalan.internal.xsltc.compiler.ValueOf.translate(ValueOf.java:114)
at com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode.translateContents(SyntaxTreeNode.java:490)
at com.sun.org.apache.xalan.internal.xsltc.compiler.XslAttribute.translate(XslAttribute.java:252)
Compiler warnings:
file:///F:/Data/JRun4/servers/ABC/MainXSL.xsl: line 155: Attribute 'LenderBranchIdentifier' outside of element.
file:///F:/Data/JRun4/servers/ABC/MainXSL.xsl: line 156: Attribute 'LenderRegistrationIdentifier' outside of element.
ERROR: 'null'
FATAL ERROR: 'Could not compile stylesheet'
javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:753)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:548)
at com.ls.lsglobal.common.CLOUTSQLXML.TransXml2Xml(CLOUTSQLXML.java:274)
And My XSL is
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.5" xmlns:lsjava1="com.ls.lsglobal.common" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="lsjava1" >
<xsl:output method="xml" indent="yes" encoding="utf-8" doctype-system="MyRequest.1.3.DTD"/>
<xsl:template match="/" >
<REQUEST_GROUP>
<TRANSMITTAL_DATA>
<xsl:if test="AppraisedVal!=''">
<xsl:attribute name="AppraisedValueAmount"><xsl:value-of select="AppraisedVal"/></xsl:attribute>
</xsl:if>
<xsl:if test="StatedVal!=''">
<xsl:attribute name="EstimatedValueAmount"><xsl:value-of select="StatedVal"/></xsl:attribute>
</xsl:if>
<xsl:for-each select="ROOT/AppMain/MyLoop/Liab">
<xsl:if test=" normalize-space(LiabTypCd) = 'SMG' and (normalize-space(PresFutTypCd) = 'BOTH' or normalize-space(PresFutTypCd) = 'PRES') and PresLienPos='1' and normalize-space(RefCd) != 'LOAN'">
<xsl:attribute name="CurrentFirstMortgageHolderType"><xsl:value-of select="LiabId"/></xsl:attribute>
</xsl:if>
</xsl:for-each>
<xsl:attribute name="LenderBranchIdentifier">0001</xsl:attribute>
<xsl:attribute name="LenderRegistrationIdentifier"><xsl:value-of select="ROOT/AppMain/MyNum"/></xsl:attribute>
</TRANSMITTAL_DATA>
</REQUEST_GROUP>
</xsl:template>
</xsl:stylesheet>
And My Java Code is
public String TransXml2Xml(String xmlInFile, String xslFile, String xmlOutFile) throws Exception
try
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setIgnoringElementContentWhitespace(true);
Document document;
File stylesheet = new File(xslFile);
File dataInfile = new File(xmlInFile);
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse(dataInfile);
System.err.println("-->AVC:::xslFile="+xslFile+" xmlInFile="+xmlInFile+" xmlOutFile="+xmlOutFile);
StreamSource stylesource = new StreamSource(stylesheet);
TransformerFactory t=TransformerFactory.newInstance();
Transformer transformer = t.newTransformer(stylesource);
DOMSource source = new DOMSource(document);
javax.xml.transform.stream.StreamResult result = new javax.xml.transform.stream.StreamResult(new File(xmlOutFile));
transformer.setOutputProperty(javax.xml.transform.OutputKeys.INDENT , "yes");
transformer.setOutputProperty(javax.xml.transform.OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
if(strCLUTDTD_PATH.equals(""))
java.util.Properties props = new java.util.Properties();
java.io.FileInputStream fis = new java.io.FileInputStream("DataFileBasePath.properties");
props.load(fis);
fis.close();
strCLUTDTD_PATH = checkNull(props.get("CLUTREQDTD_PATH"));
transformer.setOutputProperty(javax.xml.transform.OutputKeys.DOCTYPE_SYSTEM , strCLUTDTD_PATH);
transformer.transform(source, result);
catch(Exception e)
e.printStackTrace();
throw e;
return "";
can any one know what solution for this problem. It is very help full for me.So look at your code and find out what you are passing to the TransformerFactory. Then find out why it's null. Don't just sit there and say "Duh", it's your code.
And remember that nobody but you can see it yet. If you like you could post it here and then others could see it and comment on it. -
Xcode Error won't compile any new projects!?
If you can help, please do. I have been having this problem for a whole day now and its really becoming a pain in the head.
Whenever I create a new project (Im working in C and Objective-C) even if don't write any code and just try and run the starter ("hello world") code it returns this error....
ld: file not found: /Developer/TomsXcode/build/Toms_Xcode.build/Debug/Toms_Xcode.build/Objects-normal/x86_64/TomsXcode.o
Command /Developer/usr/bin/gcc-4.2 failed with exit code 1
So far what I have done is;
Completely uninstalled Xcode and its Library's using the command line in Terminal
Installed the new version of Xcode (3.2.3)
Result: Error message is still there...
I have absolutely no clue what to do.
Thanks so much if you can help! :/It looks like this problem was resolved (congratulations!) in your recent cross post, [Re: XCode Error -> Nothing will compile at all|http://discussions.apple.com/thread.jspa?messageID=12058548�]. Here are the instructions on closing a thread: [http://discussions.apple.com/help.jspa#answers].
\- Ray -
Device Error - Sense Code(5 26 00)??
Hi everyone..
Another problem with PrE8.01. I am arriving at this error code: "Device Error - Sense Code (5 26 00) - Invalid Field in Parameter List - General" after the encoding and compiling media stage of burning to disk. I have a pioneer dvd/bluray burner (new) that has been working before (not with PrE8). Any suggestion please?
BenI've asked some questions and made some recommendations in your other thread so I won't repeat them here.
For your burning problem:
Check for a firmware update for your drive. As you described the machine as new it could well be out of date.
What brand of media are you trying to burn to?
For a DVD use the 'Burn to Folder' option. Does this complete?
Play the video (from step 3) in a software DVD player (VLC is good and free if you don't have one). Does this play OK?
Burn the folder to a DVD using a stand-a-lone burning tool (ImgBurn is good and free if you don't have one). Make sure you burn no higher than x4 speed. Does the burn complete? Does it play on a DVD player connected to a TV?
Post back with your answers please.
Cheers,
Neale
Insanity is hereditary, you get it from your children -
Hi All.
I hope someone can help.
I have recently installed Oracle XE on my Vista Ultimate laptop and it is up and running with no apparent problems. I then connected to the HR schema on XE with no problems using SQL Developer 1.2.1.3213 (OLD Version). I noticed that SQL Developer 1.5.4.59.40 (NEW version) was available and downloaded it (the offering without JDK included) and renamed the "C:\Program Files\SQLDeveloper" folder holding the older version to "C:\Program Files\SQLDeveloper_Orig" and placed the new version of SQL Developer in the Prog Files directory to give "C:\Program Files\SQLDeveloper".
I then ran SQLDeveloper.exe (NEW) and when requested gave the JDK path as "C:\Program Files\Java\JDK_1.6.0_11\bin\java.exe" ('Java -version' gives 1.6.0_11-b03) and migrated over the settings from the previous version of SQLDeveloper (OLD).
The Application loads fine but when i attempt to connect to XE's HR schema i get the following error:
"IO Exception: Undefined Error
VENDOR CODE 17002"
I have searched to try and find out what is going on but cannot find any solutions that work. The previous 17002 error solutions on this forumn have all failed.
These included changing the JDK.conf file to hold route to JDK directory and also creating a 'bat' file.
My system does not have the directory for the JDK in it's PATH environment setting (either USER or SYSTEM) but does include a directory path under SYSTEM environment vars to another version fo JDK on my machine under "C:\Program Files\Sun\JDK\". I thought this may be causing a conflict but it is version 1.6.0.05_b13 and is also compatible-is it not? I also have Java JRE6 (1.6.0_12-b04) on my machine - this does not have a PATH variable and was not referenced when loading SQL Developer when loading the first time.
Can anyone help me resolve this, why can the previous version still connect OK to XE and not new version? is there something i am missing? Do i require the Java JDK Directory to be placed under a PATH environment SYSTEM variable?
Thanks in advance,
M
Edited by: user592047 on 16-Mar-2009 10:08Taken from about SQL Developer:
Version:
CVS Version Internal to Oracle SQL Developer (client-only)
Java(TM) Platform 1.6.0_11
Oracle IDE 1.5.4.59.40
Versioning Support 1.5.4.59.40
Properties:
apple.laf.useScreenMenuBar true
awt.toolkit sun.awt.windows.WToolkit
class.load.environment oracle.ide.boot.IdeClassLoadEnvironment
class.load.log.level CONFIG
class.transfer delegate
com.apple.macos.smallTabs true
com.apple.mrj.application.apple.menu.about.name "SQL_Developer"
com.apple.mrj.application.growbox.intrudes false
file.encoding Cp1252
file.encoding.pkg sun.io
file.separator \
http.agent Mozilla/5.0 (Java 1.6.0_11; Windows Vista 6.0 x86; en_GB) ICEbrowser/v6_1_3
ice.browser.forcegc false
ice.pilots.html4.ignoreNonGenericFonts true
ice.pilots.html4.tileOptThreshold 0
ide.AssertTracingDisabled true
ide.bootstrap.start 10390897243225
ide.build MAIN-5940
ide.conf C:\Program Files\sqldeveloper_new\sqldeveloper\bin\sqldeveloper.conf
ide.config_pathname C:\Program Files\sqldeveloper_new\sqldeveloper\bin\sqldeveloper.conf
ide.debugbuild false
ide.devbuild false
ide.extension.search.path sqldeveloper/extensions:jdev/extensions:ide/extensions
ide.firstrun false
ide.java.minversion 1.5.0
ide.launcherProcessId 2672
ide.main.class oracle.ide.boot.IdeLauncher
ide.patches.dir ide/lib/patches
ide.pref.dir C:\Users\M\AppData\Roaming\SQL Developer
ide.pref.dir.base C:\Users\M\AppData\Roaming
ide.product oracle.sqldeveloper
ide.shell.enableFileTypeAssociation C:\Program Files\sqldeveloper_new\sqldeveloper.exe
ide.splash.screen splash.gif
ide.startingArg0 C:\Program Files\sqldeveloper_new\sqldeveloper.exe
ide.startingcwd C:\Program Files\sqldeveloper_new
ide.user.dir C:\Users\M\AppData\Roaming\SQL Developer
ide.user.dir.var IDE_USER_DIR
ide.work.dir C:\Users\M\Documents\SQL Developer
ide.work.dir.base C:\Users\M\Documents
java.awt.graphicsenv sun.awt.Win32GraphicsEnvironment
java.awt.printerjob sun.awt.windows.WPrinterJob
java.class.path ..\..\ide\lib\ide-boot.jar
java.class.version 50.0
java.endorsed.dirs C:\Program Files\Java\jdk1.6.0_11\jre\lib\endorsed
java.ext.dirs C:\Program Files\Java\jdk1.6.0_11\jre\lib\ext;C:\Windows\Sun\Java\lib\ext
java.home C:\Program Files\Java\jdk1.6.0_11\jre
java.io.tmpdir C:\Users\M\AppData\Local\Temp\
java.library.path C:\Program Files\sqldeveloper_new;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\oracle\xe\app\oracle\product\10.2.0\server\bin;C:\Program Files\CodeGear\RAD Studio\5.0\bin;C:\Users\Public\Documents\RAD Studio\5.0\Bpl;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\9.0\DLLShared\;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Users\Public\Documents\RAD Studio\5.0\Bpl;C:\Program Files\Common Files\Teleca Shared;C:\Program Files\Microsoft Network Monitor 3\;C:\PROGRA~1\DISKEE~1\DISKEE~1\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Java\jdk1.6.0_11;C:\Program Files\Sun\SDK\bin;C:\Users\Public\Documents\RAD Studio\5.0\Bpl;C:\Program Files\Nmap
java.naming.factory.initial oracle.javatools.jndi.LocalInitialContextFactory
java.runtime.name Java(TM) SE Runtime Environment
java.runtime.version 1.6.0_11-b03
java.specification.name Java Platform API Specification
java.specification.vendor Sun Microsystems Inc.
java.specification.version 1.6
java.util.logging.config.file logging.conf
java.vendor Sun Microsystems Inc.
java.vendor.url http://java.sun.com/
java.vendor.url.bug http://java.sun.com/cgi-bin/bugreport.cgi
java.version 1.6.0_11
java.vm.info mixed mode
java.vm.name Java HotSpot(TM) Client VM
java.vm.specification.name Java Virtual Machine Specification
java.vm.specification.vendor Sun Microsystems Inc.
java.vm.specification.version 1.0
java.vm.vendor Sun Microsystems Inc.
java.vm.version 11.0-b16
jdbc.library /C:/Program Files/sqldeveloper_new/jdbc/lib/ojdbc5.jar
line.separator \r\n
oracle.home C:\Program Files\sqldeveloper_new
oracle.ide.util.AddinPolicyUtils.OVERRIDE_FLAG true
oracle.translated.locales de,es,fr,it,ja,ko,pt_BR,zh_CN,zh_TW
oracle.xdkjava.compatibility.version 9.0.4
orai18n.library /C:/Program Files/sqldeveloper_new/jlib/orai18n.jar
os.arch x86
os.name Windows Vista
os.version 6.0
path.separator ;
reserved_filenames con,aux,prn,lpt1,lpt2,lpt3,lpt4,lpt5,lpt6,lpt7,lpt8,lpt9,com1,com2,com3,com4,com5,com6,com7,com8,com9,conin$,conout,conout$
sun.arch.data.model 32
sun.boot.class.path C:\Program Files\Java\jdk1.6.0_11\jre\lib\resources.jar;C:\Program Files\Java\jdk1.6.0_11\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_11\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.6.0_11\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0_11\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0_11\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0_11\jre\classes
sun.boot.library.path C:\Program Files\Java\jdk1.6.0_11\jre\bin
sun.cpu.endian little
sun.cpu.isalist pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86
sun.desktop windows
sun.io.unicode.encoding UnicodeLittle
sun.java2d.ddoffscreen false
sun.jnu.encoding Cp1252
sun.management.compiler HotSpot Client Compiler
sun.os.patch.level Service Pack 1
user.country GB
user.dir C:\Program Files\sqldeveloper_new\sqldeveloper\bin
user.home C:\Users\M
user.language en
user.name M
user.timezone Europe/London
user.variant
windows.shell.font.languages -
Code compiles - throws java.lang.NullPointerException
This program is intended to build an array and populate it with inventory, then print out the inventory line item by line item. The code compiles but throws the NullPointerException error when the program is run. Here is the main method with 2 classes, as well as the text from the error and a pointer to the specific place in the code the error is from...
main method
import java.util.Scanner;
import static java.lang.System.out;
import java.io.*;
public class Inventory1
private static void Exit() //set ability for program to exit on each loop
{ out.println("We hope this inventory program was " +
"helpful. Thank you for using our program.");
System.exit(0);
public static void main (String [] args)
boolean validNumber;
boolean validCount;
boolean validDollars;
//initialize scanner
Scanner sc = new Scanner(System.in);
Music info = new Music();
//declare and initialize variables
int[] itemNumber = new int [5];
String[] productName = new String[5];
int[] stockAmount = new int[5];
double[] productCost = new double[5];
double[] totalValue = new double[5];
while (true)
for (int i=0; i<5; i++)
out.println( "Enter CD name/description or 'exit' to stop the" +
" program: "); //prompt - product name
info.productName[i] = sc.next(); // input
if (info.productName.equalsIgnoreCase("exit"))
out.println("Exit entered. ");
Exit();
else
do
out.println("Please enter CD number: "); //prompt - item number
info.itemNumber[i] = sc.nextInt();
validNumber = true;
if( (info.itemNumber[i] <1 ) )
{//make sure product number is positive number
validNumber = false;
out.println("All CDs have positive numbers and no other " +
"characters. Please enter a valid CD number.");
}while (!validNumber);
do
out.println("Quantity in stock: "); // prompt - quantity
info.stockAmount [i] = (sc.nextInt()); // capture temp number to verify
validCount = true;
if(( info.stockAmount[i] <1 ))
{ // ensure stock amount is positive number
validCount = false;
out.println( "Inventory numbers must be positive. Please " +
"enter a correct value." ); // prompt for correct #
} while (!validCount);
do
out.println("What is the product cost for each unit? "); // prompt - cost
info.productCost[i] = sc.nextDouble();
validDollars = true;
if (( info.productCost[i] <1 ))
validDollars = false;
out.println( "Product cost must be a positive dollar " +
"amount. Please enter correct product cost." );
} while (!validDollars);
out.println(totalValue);
@Override
public String toString()
return super.toString();
Music classclass Music
String productName[];
String title;
int itemNumber[];
int item;
int stockAmount[];
int amount;
double productCost[];
double cost;
double totalValue[];
double value;
int i;
public Music(String title, int item, int amount, double cost, double value,
int i)
this.productName[i] = title;
this.itemNumber[i] = item;
this.stockAmount[i] = amount;
this.productCost[i] = cost;
this.totalValue[i] = value;
public Music()
public void setTotalValue(double[] totalValue)
this.totalValue = totalValue;
public double[] getTotalValue()
return totalValue;
public void setStockAmount(int[] stockAmount)
this.stockAmount = stockAmount;
public int[] getStockAmount()
return stockAmount;
public void setProductCost(double[] productCost)
this.productCost = productCost;
public double[] getProductCost()
return productCost;
public void setProductName(String[] productName)
this.productName = productName;
public String[] getProductName()
return productName;
public void setItemNumber (int[] itemNumber)
this.itemNumber = itemNumber;
public int[] getItemNumber()
return itemNumber;
}TotalInventory classclass TotalInventory
double TotalInfo;
public int [] getStockAmount(int[] units)
int[] stockAmount = units;
return units;
public double[] getTotalValue(double[] cost)
double[] productCost = cost;
return cost;
error message
init:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\Tammy\My Documents\School\JavaProgramming\Inventory\build\classes
compile:
run:
Enter CD name/description or 'exit' to stop the program:
here we go
Exception in thread "main" java.lang.NullPointerException
at Inventory1.main(Inventory1.java:54)
Java Result: 1
BUILD SUCCESSFUL (total time: 4 seconds)
Inventory1.main(Inventory1.java:54) is this line of code in the main method: info.productName[i] = sc.next(); // input Any suggestions?I have not changed my code from when I supplied it in the first post - I am simply pointing out that I already initiated the String with 5 as the number...I've supplied you with everything I am getting. The three modules are in the original post, as is the error message being received - nothing has changed.
This means with the code posted in my original question I am getting an NPE. I compile the code and run it. I'm able to input the "title" (productName) after the prompt but then get the NPE. I'm not trying to make you read my mind, I'm just asking for help and make every effort to provide as much detail as possible to make that easier on all of us. -
Hey all,
last week I moved on from windows xp to windows 7 and just installed net beans to continue a project of mine. I just compiled the project to see where I had left and this error came up:
Compiling 1 source file to D:\My Documents\NetBeansProjects\Filtra\build\classes
D:\My Documents\NetBeansProjects\Filtra\src\filtra\FiltraView.java:36: error while writing <anonymous filtra.FiltraView$1>: D:\My Documents\NetBeansProjects\Filtra\build\classes\filtra\FiltraView$1.class (Access is denied)
messageTimer = new Timer(messageTimeout, new ActionListener() {
1 error
D:\My Documents\NetBeansProjects\Filtra\nbproject\build-impl.xml:363: The following error occurred while executing this line:
D:\My Documents\NetBeansProjects\Filtra\nbproject\build-impl.xml:168: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)Filtra is the name of my project. The problem is that the code it has problem with it's netbeans own code while creating a form. May this be a Windows 7 problem with permissions or something else i can't thing of? I'm not very experienced so any help would be welcome.
Thanks in advance.Santeron wrote:
Hey all,
last week I moved on from windows xp to windows 7 and just installed net beans to continue a project of mine. I just compiled the project to see where I had left and this error came up:
Compiling 1 source file to D:\My Documents\NetBeansProjects\Filtra\build\classes
D:\My Documents\NetBeansProjects\Filtra\src\filtra\FiltraView.java:36: error while writing <anonymous filtra.FiltraView$1>: D:\My Documents\NetBeansProjects\Filtra\build\classes\filtra\FiltraView$1.class (Access is denied)
messageTimer = new Timer(messageTimeout, new ActionListener() {
1 error
D:\My Documents\NetBeansProjects\Filtra\nbproject\build-impl.xml:363: The following error occurred while executing this line:
D:\My Documents\NetBeansProjects\Filtra\nbproject\build-impl.xml:168: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)Filtra is the name of my project. The problem is that the code it has problem with it's netbeans own code while creating a form. May this be a Windows 7 problem with permissions or something else i can't thing of? I'm not very experienced so any help would be welcome.
Thanks in advance.Maybe irrelevant, but I had all kinds of file-security issues after I upgraded in-situ from XP to Vista... Apparently my existing XP user-accounts where "brought over" from XP, but they where NOT the same users (just new users with the same names), hence you cannot overwrite your own freeken files which were created under XP, unless you are an administrator... and even The Administrator can't read or write the former Administrator's file... in the end I gave up in disgust, backed up what I could, booted into linux and deleted the windows partition, and then booted into windows XP from CD, reformatted the drive, and started reinstalling everything from scratch... because Vista also totally refuses to format the drive it is itself installed on, even if you boot from CD!
Windows is not an operating system, it's a virus!
Cheers. Keith.
Edited by: corlettk on 2/10/2009 21:38 ~~ Clearer, sorry. -
Logical error in code, please help, thanks alot.
I have this file Socks.java which reads in a file containing information about a sock drawer. The file is of the format:
11
red athletic
green casual
blue athletic
blue athletic
red athletic
so when the program runs, it is supposed to output the socks that are pairs: so it would output
1 pair red athletic
1 pair blue athletic
my code compiles and runs fine and i am testing it with println statements, but I am not getting the desired ouput. Can someone look over it and see if they spot what is wrong. Right now in the code I am seeing what the value of socks[i] and socks[j] is by printing them out as you will notice. If anyone can help, I appreciate it. Thanks so much for all your wonderful help
Here is the code:
import java.io.*;
public class Socks {
public static void main(String args[])
try
String socks[] = new String[1000];
int pairs[] = new int[500];
int numOfsocks;
int i;
int j;
FileReader fr = new FileReader("test.txt");
BufferedReader inFile = new BufferedReader(fr);
numOfsocks = Integer.parseInt(inFile.readLine());
int possiblePairs = numOfsocks/2;
//System.out.println(numOfsocks);
//System.out.println(possiblePairs);
for(i = 0; i < numOfsocks; i++)
socks[i] = inFile.readLine();
//for(i = 0; i < numOfsocks; i++)
//System.out.println(socks);
for(i = 0; i <= possiblePairs;i++)
for(j = i; j <= possiblePairs;j++)
System.out.println(socks[i]);
System.out.println(socks[j]);
//if(pairs[i] >= 2)
//System.out.println(pairs[i]/2 + " pairs" + socks[i]);
inFile.close();
catch(IOException e){}
System.out.println("File Not Found or no File Specified");Try the following quickly revised version of your code.
import java.io.*;
public class Socks {
public static void main(String args[])
try
String socks[] = new String[1000];
int pairs[] = new int[500];
int numOfsocks;
int i;
int j;
FileReader fr = new FileReader("test.txt");
BufferedReader inFile = new BufferedReader(fr);
numOfsocks = Integer.parseInt(inFile.readLine());
for(i = 0; i < numOfsocks; i++)
socks[i] = inFile.readLine();
for(i = 0; i < numOfsocks; i++)
if (socks[i] != null)
pairs[i]++;
for(j = i + 1; j < numOfsocks; j++)
if (socks.equals(socks[j]))
pairs[i]++;
socks[j] = null;
System.out.println(pairs[i]/2 + " pairs " + socks[i]);
inFile.close();
catch(IOException e){
e.printStackTrace(); -
Error in code generation for deleting table BUT000_TD
Hi,
Did anyone encounter this error while working on EEWB ?
I created the project extension via EEWB and completed the wizard setting with the package (dev. class) value as $temp as I wanted to test it locally.
One of the errors, that I got is:
Error in code generation for deleting table BUT000_TD
Message no. DA464
Diagnosis
This error message indicates that internal inconsistencies exist.
Procedure
Please consult SAP.Hi,
As I mentioned in my previous post kindly check the consistency of the structure BUT000_TD.
Regards,
Sudheer. -
"Error Result code = -43" AND "Audio file not found"
In Garageband I was trying to click Join, but kept getting "Error Result code = -43"
What does this mean?
Also, I thought saving the file and restarting Garageband would help, but upon re-opening the program BIG problem: the file (just this one, others are opening fine) has this error message upon opening "Audio file “07 I See the Light.aif” not found!"mcgregorsgal wrote:
so do I have to basically start over?
for that one recording, it looks like it.
the error -43 is a system level error, so i HIGHLY doubt this will help, however you can ctrl-click the project file, choose Show Package Contents, open the media folder and preview any audio files in there to see if the missing file is there, but in all likelihood, you will need to re-record it -
Error : COmpany code does not exist or has not been fully maintained
Hi ,
I tried creating a material with industry sector : mechanical , material type : raw material.
i selected basic data 1 and 2 view or MRP 1 view for views , i gave plant as SUJA and storage location value S001 ( plant and stor loc i have created in the company code 2001)
but i get this error COmpany code 2001 does not exist or has not been fully maintained..
I created COMPANY CODE using SPRO - Entreprise structure --definition - financial accounting --define , copy , check , delete company code..
kindly suggest me the solution for this error..Hi,
Your company code not activated for material management. Few pre-requisites to create material and one is to activate company code for material management
Please activate in T.code: OMSY,
[For example: For Fiscal year variant K4]
In OMSY steps, u have to enteru2026u2026u2026..
Company Code (enter your company code name 2001)u2026u2026u2026u2026u2026.
Company Name..
Fiscal Year of Current Period 2009
Current period (posting period) 03( )
Fiscal year of previous period 2008( will come automatic)
Month of previous period 02( will come automatic)
Fiscal year of last period of previous year 2008
Last month of previous year 12
Allow Posting to Previous Period (Back posting)
Disallow back posting after a change of period
Now create material with T.code; MM01
Regards,
Biju K -
Can you Ignore Error Response Code in HttpUrlConnection?
I have a problem with a HttpUrlConnection object throwing an IOException when it gets an HTTP Error Response code. Especially when there is an actual response from the server sent back that has more details in it that are actually helpful.
I would like to just tell the HttpUrlConnection ot ignore HTTP error responses and just pass along the page or data that was returned instead. I need to handle this myself.
The reason if it matters, is I am sending SOAP Envelopes, and if the Web Service doesn't like it, it will send an HTTP 500 Response Code, but it also sends a response SOAP Envelope that tells me exactly what is wrong.
Right now to get this response I have to use a Sniffer, or worse since it is HTTPS (ssl) i have to use the jvm's SSL debug mode, and pull the response out of the hex code.
I couldn't find anything about this, so I am afraid I am SOL, just hoping that there might be an obscure "feature" or "property" that can deal with this, that I can't find.
** 10 Duke Dollars to first person to provide a solution that works **Just call the getErrorStream() method to read the error response. Eg.
HttpURLConnection conn = null;
try {
conn = (HttpURLConnection)
new URL("http://www.google.com/givemea404").openConnection();
} catch (Exception e) {
InputStream in = conn.getErrorStream();
int i = in.read();
while (i != -1) {
System.out.print((char) i);
i = in.read();
} -
Error while running ejbc. Fatal error from EJB Compiler ---- Error while pr
Hi!
I was deploying a test application for a session bean with sun 1 studio 5 and I started getting this message while deploying.
I had tested the bean previously and I had no problems.
I found this in the sun app server 7 release notes, but I don't understand what I'm supposed to do...
"Deployment of CMP beans fails.
The following error is thrown because there are no <query-params> entries in the container-managed persistence (CMP) bean in sun-ejb-jar.xml file:
Error while running ejbc. Fatal error from EJB Compiler ---- Error while processing CMP beans.
Solution
Even if it isn't necessary for the CMP beans, add the query-params tag for finders in the sun-ejb-jar.xml file with the empty parameters."
Here is my sun-ejb-jar.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7.0 EJB 2.0//EN" "http://www.sun.com/software/sunone/appserver/dtds/sun-ejb-jar_2_0-0.dtd">
<sun-ejb-jar>
<enterprise-beans>
<name>GestorDoBanco_EJBModule</name>
<ejb>
<ejb-name>Cliente</ejb-name>
<jndi-name>ejb/Cliente</jndi-name>
<pass-by-reference>false</pass-by-reference>
<cmp>
<mapping-properties>pcImpl0/moduleComp1/Data/Cliente.mapping</mapping-properties>
</cmp>
<refresh-period-in-seconds>600</refresh-period-in-seconds>
</ejb>
<ejb>
<ejb-name>ClienteAssociadoAConta</ejb-name>
<jndi-name>ejb/ClienteAssociadoAConta</jndi-name>
<pass-by-reference>false</pass-by-reference>
<cmp>
<mapping-properties>pcImpl0/moduleComp1/Data/ClienteAssociadoAConta.mapping</mapping-properties>
</cmp>
<refresh-period-in-seconds>600</refresh-period-in-seconds>
</ejb>
<ejb>
<ejb-name>Conta</ejb-name>
<jndi-name>ejb/Conta</jndi-name>
<pass-by-reference>false</pass-by-reference>
<cmp>
<mapping-properties>pcImpl0/moduleComp1/Data/Conta.mapping</mapping-properties>
</cmp>
<refresh-period-in-seconds>600</refresh-period-in-seconds>
</ejb>
<ejb>
<ejb-name>GestorDoBanco</ejb-name>
<jndi-name>ejb/GestorDoBanco</jndi-name>
<pass-by-reference>false</pass-by-reference>
</ejb>
<ejb>
<ejb-name>MensagemM003</ejb-name>
<jndi-name>ejb/MensagemM003</jndi-name>
<pass-by-reference>false</pass-by-reference>
<cmp>
<mapping-properties>pcImpl0/moduleComp1/Data/MensagemM003.mapping</mapping-properties>
</cmp>
<refresh-period-in-seconds>600</refresh-period-in-seconds>
</ejb>
<ejb>
<ejb-name>MensagemM003Rejeitada</ejb-name>
<jndi-name>ejb/MensagemM003Rejeitada</jndi-name>
<pass-by-reference>false</pass-by-reference>
<cmp>
<mapping-properties>pcImpl0/moduleComp1/Data/MensagemM003Rejeitada.mapping</mapping-properties>
</cmp>
<refresh-period-in-seconds>600</refresh-period-in-seconds>
</ejb>
<ejb>
<ejb-name>MensagemM012</ejb-name>
<jndi-name>ejb/MensagemM012</jndi-name>
<pass-by-reference>false</pass-by-reference>
<cmp>
<mapping-properties>pcImpl0/moduleComp1/Data/MensagemM012.mapping</mapping-properties>
</cmp>
<refresh-period-in-seconds>600</refresh-period-in-seconds>
</ejb>
<ejb>
<ejb-name>MensagemM012Rejeitada</ejb-name>
<jndi-name>ejb/MensagemM012Rejeitada</jndi-name>
<pass-by-reference>false</pass-by-reference>
<cmp>
<mapping-properties>pcImpl0/moduleComp1/Data/MensagemM012Rejeitada.mapping</mapping-properties>
</cmp>
<refresh-period-in-seconds>600</refresh-period-in-seconds>
</ejb>
<ejb>
<ejb-name>MensagemM103</ejb-name>
<jndi-name>ejb/MensagemM103</jndi-name>
<pass-by-reference>false</pass-by-reference>
<cmp>
<mapping-properties>pcImpl0/moduleComp1/Data/MensagemM103.mapping</mapping-properties>
</cmp>
<refresh-period-in-seconds>600</refresh-period-in-seconds>
</ejb>
<ejb>
<ejb-name>MensagemM112</ejb-name>
<jndi-name>ejb/MensagemM112</jndi-name>
<pass-by-reference>false</pass-by-reference>
<cmp>
<mapping-properties>pcImpl0/moduleComp1/Data/MensagemM112.mapping</mapping-properties>
</cmp>
<refresh-period-in-seconds>600</refresh-period-in-seconds>
</ejb>
<ejb>
<ejb-name>Registo</ejb-name>
<jndi-name>ejb/Registo</jndi-name>
<pass-by-reference>false</pass-by-reference>
<cmp>
<mapping-properties>pcImpl0/moduleComp1/Data/Registo.mapping</mapping-properties>
</cmp>
<refresh-period-in-seconds>600</refresh-period-in-seconds>
</ejb>
<ejb>
<ejb-name>TransaccaoConfirmada</ejb-name>
<jndi-name>ejb/TransaccaoConfirmada</jndi-name>
<pass-by-reference>false</pass-by-reference>
<cmp>
<mapping-properties>pcImpl0/moduleComp1/Data/TransaccaoConfirmada.mapping</mapping-properties>
</cmp>
<refresh-period-in-seconds>600</refresh-period-in-seconds>
</ejb>
<ejb>
<ejb-name>TransaccaoFinalizada</ejb-name>
<jndi-name>ejb/TransaccaoFinalizada</jndi-name>
<pass-by-reference>false</pass-by-reference>
<cmp>
<mapping-properties>pcImpl0/moduleComp1/Data/TransaccaoFinalizada.mapping</mapping-properties>
</cmp>
<refresh-period-in-seconds>600</refresh-period-in-seconds>
</ejb>
<ejb>
<ejb-name>TransaccaoIniciada</ejb-name>
<jndi-name>ejb/TransaccaoIniciada</jndi-name>
<pass-by-reference>false</pass-by-reference>
<cmp>
<mapping-properties>pcImpl0/moduleComp1/Data/TransaccaoIniciada.mapping</mapping-properties>
</cmp>
<refresh-period-in-seconds>600</refresh-period-in-seconds>
</ejb>
<pm-descriptors>
<pm-descriptor>
<pm-identifier>SunONE</pm-identifier>
<pm-version>1.0</pm-version>
<pm-class-generator>com.iplanet.ias.persistence.internal.ejb.ejbc.JDOCodeGenerator</pm-class-generator>
<pm-mapping-factory>com.iplanet.ias.cmp.NullFactory</pm-mapping-factory>
</pm-descriptor>
<pm-inuse>
<pm-identifier>SunONE</pm-identifier>
<pm-version>1.0</pm-version>
</pm-inuse>
</pm-descriptors>
<cmp-resource>
<jndi-name>mysqlpmanager</jndi-name>
<default-resource-principal>
<name>bes</name>
<password>besbes</password>
</default-resource-principal>
</cmp-resource>
</enterprise-beans>
</sun-ejb-jar>
Thanks in advance for any help.
Nunohttp://docs.sun.com/source/817-2175-10/decmp.html
Please go to the above docs and look thru the examples given in it.
Example 2
This query returns all products in a specified price range. It defines two query parameters which are the lower and upper bound for the price: double low, double high. The filter compares the query parameters with the price field:
"low < price && price < high"
The finder element of the sun-ejb-jar.xml file would look like this:
<finder>
<method-name>findInRange</method-name>
<query-params>double low, double high</query-params>
<query-filter>low < price && price <
high</query-filter
</finder>
I hope this hepls. In your case u just have to make it null. -
Error- "Tax code B0 country IN does not exist in procedure TAXINN"
Hi to All,
I'm working on a Import PO. While doing MIRO for planned delivery cost, I'm getting an error "Tax code B0 country IN does not exist in procedure TAXINN"
I've assigned the Tax code to company code, but still I'm not able to solve this problem. Could anybody tell me the areas in which I may have made the mistake?
Thanks & Regards,
PiyushHi Piyush
You assign your tax code to company code at IMG--> Logis General --> Tax on Goods Movemnt --> Basic Settings --> Calculation of excise duty -> Condition type excise determination --> Maintain Tax code to country code
If still problem is not resolved you maintain the all rates to 0 in FTXP of this Tax code.
Regard
Vivek
-- Reward if helpful !!
Maybe you are looking for
-
Digitally signed documents causing Acrobat 9.3.1 to crash
Multiple users at my office are experiencing problems with digitally-signed PDFs. As soon as anyone tries to open the PDFs that have been signed, Acrobat crashes. We're using Acrobat 9.3.1 (32-bit) on 64-bit Windows 7. Reinstalling Acrobat has not
-
Sequence settings changed and digital cinema freezes. what now?
hello there. i'm a new fcp user and i could really use some help on some issues that came up while working on a film project. the material was captured with the camera function of a digital still camera, which resulted in rushes of .avi format, 30 fp
-
I am having trouble Trouble implementing one-way SSL on WebLogic 9.2...
I am having trouble Trouble implementing one-way SSL on WebLogic 9.2. I am using Demo Identity and Demo Trust certificates with a SSL Listen Port Enabled on 7002, and a Two Way Client Cert Behavior of Client Certs Not Requested. I assume that by usin
-
How to convert update,delete statement into select stmt
Hi all, I have a field called dml_stmt, i am getting the dml statement has input from the user. My requirement is, if user is giving "update set col_name = 'xyz' from table_name where codition = 'aa'", before updating the table, i need to g
-
ISE Sponsor Authentication via RADIUS
My client is requesting us to change the way the sponsor users are authenticated and authorized to access the ISE Sponsor Portal. Their like to pass the ISE request to AD through a RADIUS server first. They said "to avoid sending AD credentials to IS