Compiling error on Java I/O
My first time to write a very simple Java progam. Any one could help me on this comipling error? Thanks in advance!
Compiling ERROR:
================
C:\java\class>javac hw01.java
hw01.java:43: cannot resolve symbol
symbol : variable in
location: class hw01
while((line = in.readLine()) != null ) {
^
1 error
SOURCE CODE:
============
* Program name: hw01.java
* Author:
* Description: Simple I/O and computation
* Date: 12/08/2002
* compile: javac hw01.java
* usage: java hw01 <infile> <utfile>
* <infile> - input file
* operator operand1 operand2
* ex. + 1 1
* <outfile> - output file
* operand1 operator operand2 = result
* ex. 1 + 1 = 2
import java.io.*;
import java.util.*;
public class hw01 {
// Open input file and output file
public static void main(String[] args) throws IOException {
if (args.length == 2) {
// Open File for Reading
File inFile = new File(args[0]);
FileReader in = new FileReader(inFile);
// Open File for Writing
File outFile = new File(args[1]);
FileWriter out = new FileWriter(outFile);
} else {
System.out.println("java command <arg1> <arg2>");
// Get operation, operand1 and operand2 for each line
String line = null;
while((line = in.readLine()) != null ) {
//String op; String op1; String op2; String result;
// Get operation and operands
//stringTokenizer t = new StringTokenizer(line);
//op = t.nextToken().charAt(0);
//op1 = Integer.valueOf(t.nextToken()).intValue();
//op2 = Integer.valueOf(t.nextToken()).intValue();
// Compute math operation
//if( op == '+' ) {
// result = op1 + op2;
// } else if( op == '-' ) {
// result = op1 - op2;
//} else if( op == '*' ) {
// result = op1 * op2;
//} else if( op == '/' ) {
// result = op1 / op2;
// Print out the result
//system.out.println(op1 + op + op2 + "=" + result);
// Close infile
// in.close();
// System.out.println("");
// Close outFile
// out.close();
The compiling error is fixed. The revised working source code hw01.java is provided below. Can someone help the remining question below?
PROBLEM/Question:
=================
The output only goes to the console. How code should be changed to allow output to a specified file from command line.
SOURCE FILE (without Compiling error):
=====================================
* Program name: hw01.java
* Author:
* Description: Simple I/O and computation
* Date: 12/08/2002
* compile: javac hw01.java
* usage: java hw01 <infile> <utfile>
* example: java hw01 hw1data.txt hw1out.txt
* <infile> - input file
* operator operand1 operand2
* ex. + 1 1
* <outfile> - output file
* operand1 operator operand2 = result
* ex. 1 + 1 = 2
import java.io.*;
import java.util.*;
public class hw01 {
// Open input file and output file
public static void main(String[] args) throws IOException {
FileReader in = null;
FileWriter out = null;
BufferedReader br = null;
System.out.println("input File Name = " + args[0]);
System.out.println("output File Name = " + args[1]);
if (args.length == 2) {
// Open File for Reading
File inFile = new File(args[0]);
in = new FileReader(inFile);
br = new BufferedReader(in);
// Open File for Writing
File outFile = new File(args[1]);
out = new FileWriter(outFile);
} else {
System.out.println("java command <arg1> <arg2>");
// Get operation and operands for each line
String line = null;
char op;
int op1, op2;
int result = 0;
while((line = br.readLine()) != null ) {
// Get operation and operands
StringTokenizer t = new StringTokenizer(line);
op = t.nextToken().charAt(0);
op1 = Integer.valueOf(t.nextToken()).intValue();
op2 = Integer.valueOf(t.nextToken()).intValue();
// Compute math operation and print result
if( op == '+' ) {
result = op1 + op2;
System.out.println(op1 + " + " + op2 + " = " + result);
} else if( op == '-' ) {
result = op1 - op2;
System.out.println(op1 + " - " + op2 + " = " + result);
} else if( op == '*' ) {
result = op1 * op2;
System.out.println(op1 + " * " + op2 + " = " + result);
} else if( op == '/' ) {
result = op1 / op2;
System.out.println(op1 + " / " + op2 + " = " + result);
// Close infile
in.close();
// Close outFile
out.close();
}
Similar Messages
-
Class with objects compile error in Java 1.5.0 and 1.4.2.05
Hi, I have some problems with creating objects to my java program.
See below:
JAVA, creating new class object.
class AccountTest {
public static void main(String[]args) {
Account olesAccount = new Account(123456676756L, "Ole Olsen", 2300.50);
olesAccount.deposit(1000.0); //Input of 1000$ to account
double balance = olesAccount.findBalance(); //Ask object about balance!
System.out.println("Balance: " +balance);
ERRORS, from compiler (javac):
AccountTest.java:7: cannot find symbol
symbol : class Account
location: class AccountTest
Account olesAccount = new Account(123456676756L, "Ole Olsen", 2300.50);
^
AccountTest.java:7: cannot find symbol
symbol : class Account
location: class AccountTest
Account olesAccount = new Account(123456676756L, "Ole Olsen", 2300.50);
^
2 errors
This error occurs with both java 1.5.0 RC and 1.4.2.05
*/Assuming you haven't forgotten to compile the Account class, tt seems to be a problem with visibility. Are you sure your classpath is set up correctly and that the class Account is visible to the AccountTest driver?
I'd try moving the Account out of whatever package it's in right now and making it public. Then, restrict acces from there. -
[ SOLVED ] Compile Error with Java Fonts & IntelliJ
Hi All
I have now got a new problem when i compile a flex project. Yesterday inorder to get the IJ Interface font smoothing sorted, i had to add this line to my ~/.bashrc file
_JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on
But now when i go to run a flex project, i get the following error message
Information:Using built-in compiler shell, up to 4 parallel threads
See compiler settings at File | Settings | Compiler | Flex Compiler page
Information:Starting Flex compiler:
/opt/java/jre/bin/java -Dapplication.home=/home/julian/SDK/flex_sdk_4.5.0.17855 -Xmx384m -Dsun.io.useCanonCaches=false -Duser.language=en -Duser.region=en -Xmx1024m -classpath /opt/idea-IU-98.311/plugins/flex/lib/flex-compiler.jar:/home/julian/SDK/flex_sdk_4.5.0.17855/lib/flex-compiler-oem.jar com.intellij.flex.compiler.FlexCompiler 48936
Information:Compilation completed with 2 errors and 0 warnings
Information:2 errors
Information:0 warnings
Error:Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on
Error:java.net.SocketException: Socket closed
Error:java.net.ConnectException: Connection refused
Error: at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at java.net.Socket.<init>(Socket.java:375)
at java.net.Socket.<init>(Socket.java:218)
at com.intellij.flex.compiler.FlexCompiler.openSocket(FlexCompiler.java:35)
at com.intellij.flex.compiler.FlexCompiler.main(FlexCompiler.java:70)
Any suggestions, besides disabling the _JAVA_OPTION again ?
Many Thanks
Last edited by whitetimer (2010-11-14 17:24:11)-Dawt.useSystemAAFontSettings=on needs to be added to the end of file
idea.vmoptions -
"catch is unreachable" compiler error with java try/catch statement
I'm receiving a compiler error, "catch is unreachable", with the following code. I'm calling a method, SendMail(), which can throw two possible exceptions. I thought that the catch statements executed in order, and the first one that is caught will execute? Is their a change with J2SE 1.5 compiler? I don't want to use a generic Exception, because I want to handle the specific exceptions. Any suggestions how to fix? Thanks
try {
SendMail(....);
} catch (MessagingException e1) {
logger.fine(e1.toString());
} catch (AddressException e2) {
logger.fine(e2.toString());
public String SendMail(....) throws AddressException,
MessagingException {....I found the problem:
"A catch block handles exceptions that match its exception type (parameter) and exception types that are subclasses of its exception type (parameter). Only the first catch block that handles a particular exception type will execute, so the most specific exception type should come first. You may get a catch is unreachable syntax error if your catch blocks do not follow this order."
If I switch the order of the catch exceptions the compiler error goes away.
thanks -
Compile error import java.util.map$entry
Hi,
I am trying to compile code which imports the following package
import java.util.Map$Entry.
The error thrown up is : cant resolve symbol Map$Entry. Why is there a $ in the package import path and is there some configuration required to compile the file.
I am not allowed to change the code. Does anyone have an idea on how this problem can be solved.
Thanks and regards
Kumar VellalBtw java docs for the interface are available at:
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Map.Entry.html
Changing the import should probably help compile the code, but without changing the import .. need to check. This is just from what i remember now. Lets see if anyone else comments on this. -
Compilation error in java for struts application.
Hello,
I'm a newbie in java and struts, i was trying a simple struts application given in "struts complete reference".This is my code of its Controller class(Action class):-
package com.jamesholmes.struts;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public final class SearchAction extends Action
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws Exception
EmployeeSearchService service = new EmployeeSearchService();
ArrayList results;
SearchForm searchForm = (SearchForm) form;
//Perform employee search based on what criteria was entered.
String name = searchForm.getName();
if(name != null && name.trim().length() > 0)
results = service.searchByName(name);
else
results = service.searchBySsNum(searchForm.getSsNum().trim());
//place search results in SearchForm for access by jsp.
searchForm.setResults(results);
//Forward control to this Action's input page.
return mapping.getInputForward();
Now problem is when i'm compiling this java file i'm getting error"can not resolve symbol" for the instances i'm creating for SearchForm(view class) and EmployeeSearchService(model class).can any one help me how to resolve this error. I've tried importing those classes explicitly also, but error gets increased this way.Tht problem is solved, it was a mistake frm my side in compilation precedure.Anyway, now the real error-After i compiled and created the war file of application, i was running it in tomcat and got this Error, it is i guess a server sprcific error which i am unable to understand., can any one now help me solving this out?????Error is this :-
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
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
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)
root cause
java.lang.NullPointerException
org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:521)
org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:436)
org.apache.struts.taglib.html.LinkTag.calculateURL(LinkTag.java:495)
org.apache.struts.taglib.html.LinkTag.doStartTag(LinkTag.java:353)
org.apache.jsp.index_jsp._jspx_meth_html_link_0(index_jsp.java:96)
org.apache.jsp.index_jsp._jspService(index_jsp.java:69)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
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.27 logs.
Apache Tomcat/5.0.27 -
Compilation error when java 5.0 features are used.
Hi,
I modified the make script in my project to use JDK 1.5.0_11 compiler. instead of 1.4.2 compiler. But when I run the make script, it is throwing errors for all the JDK 1.5.0 features like for-each construct, auto-boxing etc..
Please let me know if I am issing anything.
It compiles successfully in my IDE.
Thanks,
RavikumarMultiply crossposted.
-
Compile Error in Enhanced For Loop
I'm learning generic collections and for practice wrote a simple class that uses a HashMap to store data. However, I'm getting a compile error for the code that accesses the HashMap. The error and code for my class follow.
Can anyone help?
Thanks...
=====================
The compile error:
=====================
MapDict.java:37: package Map does not exist for( Map.Entry entry : glossary.entrySet() ) ^1 error=======================
The code for my class:
=======================
import java.util.Scanner;
import java.util.HashMap;
public class MapDict
HashMap<String, String> glossary = new HashMap<String, String>();
public void getEntries()
Scanner sc = new Scanner( System.in ).useDelimiter("\n");
String moreEntries = "y";
String word = "";
String definition = "";
while ( moreEntries.toUpperCase().equals( "Y") )
System.out.print("Enter word: ");
word = sc.next();
System.out.print("Enter definition: ");
definition = sc.next();
glossary.put( word, definition);
System.out.print("Another glossary item? (y/n) ");
moreEntries = sc.next();
public void displayEntries()
System.out.println( glossary.size() );
// Here is where the compile error occurs:
for( Map.Entry entry : glossary.entrySet() )
System.out.println( "\nWord: " + entry.getKey() + " Definition: " + entry.getValue() );
}import java.util.Scanner;
import java.util.HashMap;I don't see java.util.Map or java.util.Map.Entry listed here.... -
Compile Error with ResultSet.CONCUR_UPDATEABLE
Hi All,
I get the following compile error
"CopyTable.java [49:1] cannot resolve symbol
symbol : variable CONCUR_UPDATEABLE
location: interface java.sql.ResultSet
Statement DestStmt = DestDB.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATEABLE);
^
1 error"
Is there a simple answer to this?
RGDS
RichardYou must type : CONCUR_UPDATABLE not CONCUR_UPDATEABLE
-
Compile error with action listener, ioexception
Hello, i have a (very basic) swing class which (basically) starts the whole program going as soon as you press a button.
Now somewhere down in the program, i have some file handling, so java makes you write 'throws IOException" all the way through your code.
Now i tried to do that in my swing class but i get the following compile error:
"BaseGui.java": Error #: 463 : method actionPerformed(java.awt.event.ActionEvent) in class BaseGui cannot implement method actionPerformed(java.awt.event.ActionEvent) in interface java.awt.event.ActionListener, implemented method does not throw java.io.IOException at line 31, column 15
I tried changing the "throws IOException" for some trying and catching, but to no avail. Any ideas what the problem could be?never mind, i figured this one out.
Thanks anyway. -
JDialog unknown compiler error?
Hello,
I wrote this basic code to learn the use of JDialogs, the problem is when I tried to add the model and title to the Dialog class constructor, I got this compiler error:
TestGUI.java:24: cannot resolve symbol
symbol : constructor TestDialog (TestGUI)
location: class TestDialog
TestDialog testdialog = new TestDialog(TestGUI.this);
Could anyone see the problem?
Thank you
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TestGUI implements ActionListener{
static JPanel contentPane;
static JMenuBar menuBar;
static JMenuItem item;
static JButton link;
TestGUI(){
contentPane = new JPanel(new FlowLayout(FlowLayout.CENTER,30,30));
link = new JButton("Link");
link.addActionListener(this);
contentPane.add(link);
public void actionPerformed(ActionEvent e){
String actionCommand = e.getActionCommand();
if(actionCommand.compareTo("Link")==0){
TestDialog testdialog = new TestDialog(TestGUI.this);
testdialog.setVisible(true);
public static void main(String args[]){
JFrame frame = new JFrame("Test GUI");
TestGUI object = new TestGUI();
frame.setJMenuBar(menuBar);
frame.setContentPane(contentPane);
frame.addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e)
{System.exit(0);}});
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
class TestDialog extends JDialog implements ActionListener{
TestDialog(JFrame parent){
super(parent, "Test dialog", true);
JPanel panel = new JPanel();
panel.add(new Label("Working"));
getContentPane().add(panel);
pack();
public void actionPerformed(ActionEvent e){
String actionCommand = e.getActionCommand();
}TestDialog has only the constructor: TestDialog(JFrame parent)
you call: new TestDialog(TestGUI.this);
but TestGUI doesn't inherit from JFrame! -
This still doesn't compile, I ran a debug on this an this is what I got--->
Exception occurred: java.lang.ClassNotFoundException (uncaught) thread="main", java.net.URLC
lassLoader$1.run(), line=200, bci=72
Compile error--->
HelloWorld.java:2: '{' expected
public class HelloWorld() {
^
HelloWorld.java:6: '}' expected
^
2 errors..
Can someone please help me...
////////OLD MESSAGE//////////
/ I am trying to compile this below, unfortunately it won't compile due to errors.
/ I know this should work, just don't understand why it wont.. Can anyone help?
/ Here is the source:
/ //Hello World
/ public class HelloWorld() {
/ public static void main(String[] args) {
/ System.out.printIn("Hello World");
/ I am using the jdk1.3.1 with a path set to:
/ set PATH="c:\jdk1.3.1\bin"
/ Re: Compile Error
/ Author: mbishop78
/ Also include:
/ SET CLASSPATH="c:\jdk1.3.1\jre\lib\rt.jar;."
/ Java needs to know where to look for your classes including the default
/ libraries and the current directory you're compiling from.
/ Michael BishopStill doesn't work, this one shouldn't need to be
edited,
it is straight out of the book.You did not copy it right, then:
1. "HelloWorld()" should be "HelloWorld"
2. "printIn" should be "println" (as in "print line') -
Compilation error - _Object
Hi,
I am trying to build a simple HelloWorld program using the jCOM stuff. I'm getting
the following compilation errors:
HelloWorld.java:26: cannot resolve symbol
symbol : class _Object
location: class big.red.HelloWorld
public class HelloWorld implements com.linar.jintegra.RemoteObjRef, _HelloWorld,
_Object, IHelloWorld {
^
HelloWorld.java:34: cannot resolve symbol
symbol : class _ObjectProxy
location: class big.red.HelloWorld
private ObjectProxy d_ObjectProxy = null;
^
HelloWorld.java:41: cannot resolve symbol
symbol : class _Object
location: class big.red.HelloWorld
public Object getAsObject() { return d__ObjectProxy; }
^
HelloWorld.java:26: big.red.HelloWorld should be declared abstract; it does not
define getJintegraDispatch() in big.red.HelloWorld
public class HelloWorld implements com.linar.jintegra.RemoteObjRef, _HelloWorld,
_Object, IHelloWorld {
^
HelloWorld.java:115: cannot resolve symbol
symbol : class _ObjectProxy
location: class big.red.HelloWorld
d__ObjectProxy = new ObjectProxy(d_HelloWorldProxy);
^
HelloWorld.java:126: cannot resolve symbol
symbol : class _ObjectProxy
location: class big.red.HelloWorld
d__ObjectProxy = new _ObjectProxy(obj);
^
6 errors
Anyone know where these classes are?
Thanks.
CarrinI'm using WLS7.0, so I shouldn't need the jintegra.jar file, right? Everything
should be in the weblogic.jar file I thought.
Thanks
Carrin
"Atit" <[email protected]> wrote:
>
Hi,
Just make sure that, your jintegra.jar file is in the classpath or
not?
Thanks,
Atit.
"carrin" <[email protected]> wrote:
Hi,
I am trying to build a simple HelloWorld program using the jCOM stuff.
I'm getting
the following compilation errors:
HelloWorld.java:26: cannot resolve symbol
symbol : class _Object
location: class big.red.HelloWorld
public class HelloWorld implements com.linar.jintegra.RemoteObjRef,_HelloWorld,
_Object, IHelloWorld {
^
HelloWorld.java:34: cannot resolve symbol
symbol : class _ObjectProxy
location: class big.red.HelloWorld
private ObjectProxy d_ObjectProxy = null;
^
HelloWorld.java:41: cannot resolve symbol
symbol : class _Object
location: class big.red.HelloWorld
public Object getAsObject() { return d__ObjectProxy; }
^
HelloWorld.java:26: big.red.HelloWorld should be declared abstract;it
does not
define getJintegraDispatch() in big.red.HelloWorld
public class HelloWorld implements com.linar.jintegra.RemoteObjRef,_HelloWorld,
_Object, IHelloWorld {
^
HelloWorld.java:115: cannot resolve symbol
symbol : class _ObjectProxy
location: class big.red.HelloWorld
d__ObjectProxy = new ObjectProxy(d_HelloWorldProxy);
^
HelloWorld.java:126: cannot resolve symbol
symbol : class _ObjectProxy
location: class big.red.HelloWorld
d__ObjectProxy = new _ObjectProxy(obj);
^
6 errors
Anyone know where these classes are?
Thanks.
Carrin -
Hi Folks,
Is there a limitation in BEA's web services implementation? I have a simple web
service that returns an array of java objects. However I am calling another middle
tier API that returns a Set. I convert this Set into array of object and return
it via the web service.
However the .jws file that implements the webservice does not compile. I get the
following error message:
java.util.Set is an interface. This interface is not supported.
Is there a limitation on using Collections within the .jws file? If that is the
case it is a severe limitation.
Note my Web Service API returns an array of java objects with no collections in
them.
SanjayHello,
Generic java collections can only be handled in a very generic, weakly
typed manner.
Take a look at the
http://workshop.bea.com/xmlbeans/guide/conXMLBeansSupportBuiltInSchemaTypes.html
and also
http://workshop.bea.com/xmlbeans/guide/conJavaTypesGeneratedFromUserDerived.html
You might also ask your question to the XMLBeans newsgroup:
http://newsgroups.bea.com/cgi-bin/dnewsweb?cmd=xover&group=weblogic.developer.interest.xmlbeans
Regards,
Bruce
Sanjay wrote:
>
Hi Folks,
Is there a limitation in BEA's web services implementation? I have a simple web
service that returns an array of java objects. However I am calling another middle
tier API that returns a Set. I convert this Set into array of object and return
it via the web service.
However the .jws file that implements the webservice does not compile. I get the
following error message:
java.util.Set is an interface. This interface is not supported.
Is there a limitation on using Collections within the .jws file? If that is the
case it is a severe limitation.
Note my Web Service API returns an array of java objects with no collections in
them.
Sanjay -
Bursting Java Concurrent Program Class Compiling Error
Hi,
I am trying to compile the Java Class that Tim has provided in his blog to create the Bursting JCP. I am using R12, so that would be XMLP 5.6.3. As far as I can work out the patch that has been developed for the seeded Bursting JCP is not yet available for R12, so I am trying to create one myself from Tim's examples.
I do not pretend to be a Java expert, or even pretend to have more than and very very very basic knowledge of it, so I am hoping someone will be able to tell me why I am getting the following error when I try to compile it:
$ javac XMLPReportBurst.java
XMLPReportBurst.java:220: cannot find symbol
symbol : constructor OADocumentProcessor(java.io.InputStream,java.io.InputStream,java.lang.String)
location: class oracle.apps.xdo.oa.util.OADocumentProcessor
OADocumentProcessor dp = new OADocumentProcessor(ctlFile,fis,"/home/applmgr/tmp");
^
1 error
The Java Class that I am using can be seen below, and the error seems to be occurring at line 220:
package oracle.apps.xdo.oa.cp;
import java.sql.SQLException;
import java.sql.Connection;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import oracle.jdbc.driver.OracleResultSet;
import oracle.jdbc.driver.OraclePreparedStatement;
import oracle.jdbc.driver.OracleCallableStatement;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.util.NameValueType;
import oracle.apps.fnd.util.ParameterList;
import oracle.apps.fnd.cp.request.CpContext;
import oracle.apps.fnd.cp.request.ReqCompletion;
import oracle.apps.fnd.cp.request.LogFile;
import oracle.apps.fnd.cp.request.JavaConcurrentProgram;
import oracle.apps.fnd.cp.request.RemoteFile;
import oracle.apps.xdo.XDOException;
import oracle.apps.xdo.oa.util.OADocumentProcessor;
import oracle.apps.xdo.batch.BurstingListener;
import java.util.Properties;
import java.util.Vector;
public class XMLPReportBurst implements JavaConcurrentProgram, BurstingListener
public static final String RCS_ID=
"$Header: JCP4XMLPublisher.java 115.34 2006/01/09 16:54:58 bgkim noship $";
public static final boolean RCS_ID_RECORDED =
VersionInfo.recordClassVersion(RCS_ID, "oracle.apps.xdo.oa.cp");
// Global Reference to pCpContext
private CpContext ccntxt;
private LogFile lfile;
private boolean debug = false;
private Connection mJConn;
public void runProgram(CpContext pCpContext)
lfile = pCpContext.getLogFile();
lfile.writeln("XML Report Publisher 5.0",0);
ccntxt = pCpContext;
// get the JDBC connection object
mJConn = pCpContext.getJDBCConnection();
// get parameter list object from CpContext
ParameterList lPara = pCpContext.getParameterList();
// get ReqCompletion object from CpContext
ReqCompletion lRC = pCpContext.getReqCompletion();
String Params = null;
int lrequestId = 0;
String ltemplatecode = null;
String lApplShortName = null;
String lLocale = null;
String lDebug = "N";
String lOutFormat = null;
String tmplLang = null;
String tmplTerr = null;
int reqid = pCpContext.getReqDetails().getRequestId();
// Parse Parameters
while (lPara.hasMoreElements())
NameValueType aNVT = lPara.nextParameter();
Params += aNVT.getName() + ":" + aNVT.getValue();
if ( aNVT.getName().equals("ReportRequestID") )
lrequestId = Integer.parseInt(aNVT.getValue());
else if ( aNVT.getName().equals("DebugFlag") )
lDebug = aNVT.getValue();
debug = (lDebug.equals("Y")) ? true : false;
if (debug)
lfile.writeln("Request ID: "+reqid ,1);
lfile.writeln("All Parameters: " + lPara.getString(),1);
lfile.writeln("Report Req ID: "+ lrequestId,1);
lfile.writeln("Debug Flag: " + lDebug,1);
try
lfile.writeln("Updating request description",0);
String lSqls = "update FND_CONCURRENT_REQUESTS " +
"set DESCRIPTION='Bursting ' || " +
" ( select USER_CONCURRENT_PROGRAM_NAME " +
" from FND_CONC_REQ_SUMMARY_V " +
" where request_id= :1 ) " +
"where request_id = :2 ";
OracleCallableStatement lStmt2 =
(OracleCallableStatement)mJConn.prepareCall(lSqls);
lStmt2.setInt(1,lrequestId);
lStmt2.setInt(2,reqid);
lStmt2.execute();
lStmt2.close();
mJConn.commit();
if (debug) lfile.writeln("Updated description",0);
/* Obtain Input xml file from RemoteFile object by lrequestId */
lfile.writeln("Retrieving XML request information",0);
lSqls = "select OUTFILE_NODE_NAME, OUTFILE_NAME from " +
"FND_CONCURRENT_REQUESTS " +
"where request_id= :1";
OraclePreparedStatement lStmt1 =
(OraclePreparedStatement)mJConn.prepareStatement(lSqls);
lStmt1.setInt(1,lrequestId);
OracleResultSet lRslt = (OracleResultSet)lStmt1.executeQuery();
lRslt.next();
String cNode=lRslt.getString(1);
String outf=lRslt.getString(2);
lRslt.close();
lStmt1.close();
if (debug) lfile.writeln("Node Name:" + cNode,1);
lfile.writeln("Preparing parameters",0);
// PDF output file (Outfile of this request)
String outputfilename = pCpContext.getOutFile().getFileName();
if (debug) lfile.writeln(lOutFormat+" output =" + outputfilename, 1);
OutputStream fout = new FileOutputStream(outputfilename);
RemoteFile rf = new RemoteFile (pCpContext, cNode, outf, "TEXT");
String inputfilename = rf.getFile().getAbsolutePath();
if (debug) lfile.writeln("inputfilename =" + inputfilename, 1);
if ( inputfilename == null || inputfilename.equals("") )
lRC.setCompletion(ReqCompletion.ERROR,
"Error has occured. Please check the log file");
// Input stream from XML data file ( Outfile of XML generating request)
InputStream fis = new FileInputStream(inputfilename);
InputStream ctlFile = new FileInputStream("\\home\\applmgr\\InvoiceBatchBurst.xml");
lfile.writeln("Starting burst ...",1);
OADocumentProcessor dp = new OADocumentProcessor(ctlFile,fis,"/home/applmgr/tmp");
lfile.writeln("Bursting initiated ... ",1);
dp.registerListener(this);
lfile.writeln("Listener created ...",1);
Properties prop= new Properties();
lfile.writeln("Properties set ...",1);
prop.put("user-variable:EMAILP","[email protected]");
dp.setConfig(prop);
lfile.writeln("Config set ...",1);
dp.process();
lfile.writeln("Bursting complete",1);
fis.close();
fout.close();
lRC.setCompletion(ReqCompletion.NORMAL, "Request Completed Normal");
catch (SQLException e)
lfile.writeln("--SQLException",1);
//lfile.writeln(e.getMessage(),1);
lfile.writeln(getErrorStack(e),1);
lRC.setCompletion(ReqCompletion.ERROR, e.getMessage());
catch (XDOException e)
lfile.writeln("--XDOException",1);
//lfile.writeln(e.getMessage(),1);
//lfile.writeln(sw.toString(),1);
lfile.writeln(getErrorStack(e),1);
lRC.setCompletion(ReqCompletion.ERROR, e.getMessage());
catch (Exception e)
lfile.writeln("--Exception",1);
lfile.writeln(e.getMessage(),1);
lfile.writeln(getErrorStack(e),1);
lRC.setCompletion(ReqCompletion.ERROR, e.getMessage());
finally
pCpContext.releaseJDBCConnection();
private String getErrorStack(Exception exc) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
try
exc.printStackTrace(pw);
pw.flush();
pw.close();
sw.close();
return sw.toString();
catch (Exception e)
return null;
public void beforeProcess(){
if (debug) lfile.writeln("==============Start of Bursting Process=================",0);
public void afterProcess()
if (debug) lfile.writeln("==============End of Bursting Process=================",0);
public void beforeProcessRequest(int requestIndex)
if (debug)
lfile.writeln(" ========Start of Process Request",0);
lfile.writeln(" Request Index +requestIndex",0);
public void afterProcessRequest(int requestIndex)
if (debug) lfile.writeln(" ========End of Process Request",0);
public void beforeProcessDocument(int requestIndex,int documentIndex)
if (debug){
lfile.writeln(" ========Start of Process Document",0);
lfile.writeln(" Request Index "+requestIndex,0);
lfile.writeln(" Document Index " +documentIndex,0);
public void afterProcessDocument(int requestIndex,int documentIndex,Vector documentOutputs)
if (debug){
lfile.writeln(" ========End of Process Document",0);
lfile.writeln(" Outputs :"+documentOutputs,0);
public void beforeDocumentDelivery(int requestIndex,int documentIndex,String deliveryId)
if (debug){
lfile.writeln(" ========Start of Delivery",0);
lfile.writeln(" Request Index "+requestIndex,0);
lfile.writeln(" Document Index " +documentIndex,0);
lfile.writeln(" DeliveryId " +deliveryId,0);
public void afterDocumentDelivery(int requestIndex,int documentIndex,String deliveryId,Object deliveryObject,Vector attachments)
if (debug){
lfile.writeln(" ========End of Delivery",0);
lfile.writeln(" Attachments : "+attachments,0);
I hope you can help me as this is an on going issue for me that I need to try and get resolved.
I look forward to hearing any suggestions.
Regards,
CjHi,
Yes you have one more field in the Data Definition tab that reads Bursting Control File just after the 3 you mentioned .You can upload the control file here.
However both this functionality and the Bursting Concurrent Program will be available once you have applied the patch for 5.6.3..
I've been looking too for anyone who has a writeup on the the way this Program can be used.As of now I am just following the Read Me available with this Patch.
It has some samples...
Let me know if this helps.
Regards,
Lavina
Maybe you are looking for
-
No video in quicktime with windows vista
so, im trying to add video to my ipod so im told i have to buy quicktime pro, so i do. now it won't even play anything to convert it to anything to play on.. well anything. some files will play sound but no video, others will play nothing at all. its
-
How to work with SYSFAIL in Queues
Hi I am working on monitoring part, when the messages are sturcked in the queue with a queue status of SYSFAIL. How can we handle this. How to process the failed message as well as blocked messages in the queues. Thanks, Ram
-
Apple Tv HDMI to receiver then to LCD Tv, Apple Tv HDMI to receiver then to LCD Tv
Has anyone here hooked up thier Apple TV from the Unit to their Home Theater Receiver in then to HDMI Out to TV In? Instead of using a Optical Cable?
-
How to apply style sheet to design page
hi all, i have a discussion, how to apply a style sheet to design page in webdynpro. thanks vikash
-
There's a cross in the battery-icon..;what does that mean?
well,everything is in the subject...thank you for every little help,i'm new in using a mac,and i'm aware that maybe this question seems completely stupid to some of you!:) thx