Java.util.Enumeration
Hi all,
java.util.Enumeration is an interface.
but we are able to execute the methods (hasMoreElements, nextElement )defined in this interface.
say for ex:
java.util.Enumeration en =
/* (Some code which returns Enumeation say :*/ Hashtable.keys();
whithout the implementation , we are executng the methods defined in the Enumeration interface. how this is possible?
thanks in advance.
dhanasekaran.
hi,
I posted the code for the method elements from java.util.Vector which returns an Enumeration. This should explain your problem:public Enumeration elements()
return new Enumeration() {
int count = 0;
public boolean hasMoreElements() {
return count < elementCount;
public Object nextElement() {
synchronized (Vector.this) {
if (count < elementCount) {
return elementData[count++];
throw new NoSuchElementException("Vector Enumeration");
}greetings,
Stijn
Similar Messages
-
Import java.util.Enumeration;
Hi, I test a programmer under eclipe
I can import java.util.Enumeration;(error on Enumeration)
and Vector connections = null;
Enumeration enum = connections.elements();
while (enum.hasMoreElements())
do something
I got error Enumeration can't not be resolve/
why?
and how to modify to change it?Hi, I test a programmer under eclipe Maybe should test the program, not the programmer ;-)
-
Java.util.Enumeration & JSP
I'm writeing a JSP that use a Bean.
This bean gas a method like this:
publi static Object[] myMethod(){
Enumeration en = ComPortIdentifier.getPortIdentifiers();
Object[] ob = Collections.list(en).toArray();
return ob;
}when I try to call this method in my own JSP page tomcat (I'm using Tomcat 4.1.24 maybe) mades an exception and I dont know why because if I try to add a main method to the bean for execute the code writed up all works good.
Which is the problem?Hello there,
try this:
public Object[] myMethod()
<% Object[] ob = myBean.myMethod() %>
// where myBean is your bean variable name
You need to give method static modifier when using in main test as the main method is static. You must take it out when using it in your JSP,
if you don't want to, then try
<%@ page language="java" import="MyBean" %>
<% Object[] ob = MyBean.myMethod() %>
// where MyBean is your bean class name
Hope this works - let us know how you get on.
Darren B -
Can't load runtime properties in java.util.logging.LogManager
This should be so easy, what am I doing wrong?
I have the following logging.properties located on my classpath:
handlers=java.util.logging.ConsoleHandler
.level=INFO
java.util.logging.ConsoleHandler.level=INFO
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
Test.level=FINE
Test.handlers=java.util.logging.ConsoleHandlerI have a very simple Test.java file that should load the new properties file and print out the known logger names (ie Test).
I've also tried putting Test.java in a package, it didn't seem to matter.
public class Test {
public Test() {
String name = this.getClass().getName();
//this properties file is should be sitting in same dir as Test class
java.io.InputStream is = this.getClass().getResourceAsStream("logging.properties");
try {
//get log manager instance
java.util.logging.LogManager lm = java.util.logging.LogManager.getLogManager();
//read the new configuration
lm.readConfiguration(is);
//print out list of logger names
java.util.Enumeration e = lm.getLoggerNames();
while (e.hasMoreElements()) {
System.out.println(e.nextElement());
//print logger for this class!
System.out.println("getLogger("+name+"): "+lm.getLogger(name));
} catch (Exception e) {
} finally {
try {
is.close();
is = null;
} catch (Exception e) {}
public static void main(String[] args) {
Test test1 = new Test();
}The output I get from this is a single logger name, and then null for my desired Test logger.
global
getLogger(Test): nullIt seems a logger instance HAS been created for my Test class, I've added the lines below. Though it didn't appear in the logger names enumeration.
java.util.logging.Logger logger = java.util.logging.Logger.getLogger(name);
System.out.println(logger.getName()+"="+logger.getLevel().getName());
logger.severe("severe");
logger.warning("warning");
logger.info("info");
logger.config("config");
logger.fine("fine");
logger.finer("finer");
logger.finest("finest");Output:Test=FINEST
6/10/2003 16:00:01 Test <init>
SEVERE: severe
6/10/2003 16:00:01 Test <init>
WARNING: warning
6/10/2003 16:00:01 Test <init>
INFO: infoObservations:
1) Despite my Test class having the FINEST log level, the default ConsoleHandler had log level of INFO, and hence only up to INFO logged. -
Zip created through java.util.zip but problem in windows XP compress folder
Hi friends,
I am a software developer ,working on java/j2ee.currently i am working in a document management software related to logistics.Here i am facing a problem at the time of open the zip file through windows XP's in built software called "Folder compress".It's creared through java.util.zip.zipoutputstream.but at time of open through xp compress folder software ,it's showing error that "you can't open this file , this file are protected for your computer security" , but when i trying to open it through winzip or winrar, it's not giving any problem.My also specefing the code snippet below :-
ZipOutputStream zip = null;
FileOutputStream fileWriter = null;
try
fileWriter = new FileOutputStream(destZipFile);
zip = new ZipOutputStream(fileWriter);
//required for XP compress
zip.setMethod(ZipOutputStream.DEFLATED);
zip.setLevel(Deflater.DEFAULT_COMPRESSION); //use default level
}catch (Exception ex){
ex.printStackTrace();
System.exit(0);
addFolderToZip("", srcFolder, zip);
try
zip.flush();
zip.close();
zip=null;
fileWriter.close();
fileWriter = null;
}catch (Exception ex)
//ex.printStackTrace();
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.ProcessException","Exception in Zip folder processing");
}I desperately looking for a help regarding this issue , if any body have any solution the please send at this forum.
Thanks,
Chiranjitthis file working file for winzip or winrar there is no problem.i am also sending the whole code of that java file that can help you better.
Program Name: EdocRetrieveServiceSLBean.java
Description: EdocRetrieveService CMP Bean Class
Classes: EdocRetrieveServiceSLBean
Package: net.mlog.edoc.ejb.entity
Modification History
<CR No> <Date> <Modified By> <Comments>
Version 1.0 2005.12.01 Sutapa Ray Create
/** The sequence of methods to be called.
===============================================================================================================================
1. mlogOriginDocumentAudit(String argActionDetails,int argDocumentId,int argActionId,String argActionByUserId)
2. mlogDestinationBatchDownload(Vector TREEDATA,String SessionIDVal,String argUserId)
a) Start DIR --
private String DoFolder(String folderNname)
b) Create the folder
private String CreateFolder(String FolderName,String newFolderPath)
c) Zip the folder
private void zipFolder(String srcFolder, String destZipFile)
d) Add folders to zip file
private void addToZip(String path, String srcFile, ZipOutputStream zip)
e) Add the srcFolder to the zip stream.
private void addFolderToZip(String path, String srcFolder, ZipOutputStream zip)
f) Delete Directory from server
public boolean deleteDir(File dir) {
3. mpsDocumentView(String argUserId,Integer[] argSfxFileId)
4. mlogOriginDocumentView(int argDocumentId,String argUserId)
5. findDocTypeForDocId(Integer argDocId) throws RemoteException;
package net.mlog.edoc.ejb.session;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.ejb.CreateException;
import javax.ejb.ObjectNotFoundException;
import javax.ejb.FinderException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.naming.Context;
import javax.rmi.PortableRemoteObject;
import java.rmi.RemoteException;
//import lib for all entity beans
import net.mlog.edoc.ejb.entity.IDocumentCMP;
import net.mlog.edoc.ejb.entity.IDocumentCMPHome;
import net.mlog.edoc.ejb.entity.IDocumentTypeCMP;
import net.mlog.edoc.ejb.entity.IDocumentTypeCMPHome;
import net.mlog.edoc.ejb.entity.IDocumentAuditCMP;
import net.mlog.edoc.ejb.entity.IDocumentAuditCMPHome;
//import lib for reader class of properties file
import net.mlog.edoc.ejb.session.PropertiesFileReader;
//import lib for user Define File class
import net.mlog.edoc.ejb.Session.EFile;
//import lib for SFXWebClient
import net.mlog.edoc.webservice.sfxWeb.ISFXWebClientSLHome;
import net.mlog.edoc.webservice.sfxWeb.ISFXWebClientSL;
import java.sql.Date;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import java.util.zip.Deflater;
import java.util.Vector;
import java.util.Iterator;
import java.util.Collection;
import java.util.StringTokenizer;
import java.util.Enumeration;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.File;
import java.io.InputStream;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.FileOutputStream;
//import lib for NGP Mail
import javax.jms.Queue;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueConnection;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.JMSException;
import weblogic.jms.extensions.WLQueueSession;
import weblogic.jms.extensions.XMLMessage;
//import javax.mail.*;
//import javax.mail.internet.*;
//import lib for USI
import com.msl.security.USIException;
import com.msl.security.USIServerAPI;
import com.msl.security.UserPolicyData;
import net.msl.util.logging.MLogger;
public class EdocRetrieveServiceSLBean implements SessionBean {
private static final boolean VERBOSE = true;
private SessionContext ctx;
public void ejbActivate() {
public void ejbRemove() {
public void ejbPassivate() {
public void setSessionContext(SessionContext ctx) {
this.ctx = ctx;
public void ejbCreate () throws CreateException {
private static final MLogger logger;
static
logger = MLogger.getLogger(net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.class.getName(), "net/mlog/edoc/ejb/session/eDocRetrieveServiceMessagesXML");
//*********************KEEPING AUDITS OF DOCUMENTS BY MLOG ORIGIN PEOPLE*******************************
* <b>
* Used for Auditing the user action.
* </b>
* This function is called from various functions of eDocController
* <p>
* @param argActionDetails Gives the details of Action in document audit.
* @param argDocumentId gives the Document Id in Document Audit.
* @param argActionId Action Id in Document Audit.
* @param argActionByUserId User Id of the Docment Audit action.
* @return Returns a boolean value. 1 for success, 0 for Failure.
public boolean mlogOriginDocumentAudit(String argActionDetails,int argDocumentId,int argActionId,String argActionByUserId) throws RemoteException
//NGP/JDK Logging
boolean flag=false;
try{
//getting context of the server
InitialContext documentAuditCMPInitialContext=getInitialContext();
Object objDocumentAuditCMPRef=null;
try{
objDocumentAuditCMPRef=documentAuditCMPInitialContext.lookup("DocumentAuditCMPBeanJNDI");
catch(Exception e)
//NGP/JDK Logging if JNDI Not found
//logger.log(Level.SEVERE, "{0} : JNDI not found : {1}",new Object[] {"MSG002","DocumentAuditCMPBeanJNDI"});
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.JNDINotFound","DocumentAuditCMPBeanJNDI not found");
//find the maximum audit id in the Document_Audit table
//Home interface reference of DocumentAuditCMP EJB
//IDocumentAuditCMPHome iDocumentAuditCMPHomeRef=(IDocumentAuditCMPHome)PortableRemoteObject.narrow(objDocumentAuditCMPRef,IDocumentAuditCMPHome.class);
IDocumentAuditCMPHome iDocumentAuditCMPHomeRef=(IDocumentAuditCMPHome)objDocumentAuditCMPRef;
//Remote interface reference of DocumentAuditCMP EJB
IDocumentAuditCMP iDocumentAuditCMPCreateRef=iDocumentAuditCMPHomeRef.create(new Timestamp(System.currentTimeMillis()),argActionDetails,argActionByUserId,new Integer(argActionId),new Integer(argDocumentId));
//set flag to true if Document is audited
flag=true;
}//end of try
catch(Exception expt)
//logger.finer(expt);
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.CreateException","Exception in creating Document Audit record");
return flag;
//*********************BATCH DOWNLOAD OF DOCUMENTS BY MLOG ORIGIN PEOPLE*******************************
* <b>
* Used for Validating the documents.
* </b>
* This function is called from Struts
* <p>
* @param TREEDATA Treeset obtained after search.
* @param SessionIDVal gives the Session Value Id.
* @return Returns a boolean value. 1 for success, 0 for Failure.
public byte[] mlogDestinationBatchDownload(Vector TREEDATA,String SessionIDVal,String argUserId) throws RemoteException
//NGP/JDK Logging
/*FileHandler handler = null;
Logger logger=null;
try
PropertiesFileReader propertiesFileReaderRef=new PropertiesFileReader();
String logFile=propertiesFileReaderRef.getProperties("/edoc.properties","EDOC_LOG");
handler = new FileHandler("eDoc.log",0,1, true);
logger = Logger.getLogger("ErrorMsg");
logger.addHandler(handler);
logger.setLevel(Level.ALL);
}catch(Exception excp)
NGP/JDK Logging warning
logger.log(Level.WARNING, "{0} : Unable to find Resource Bundle File : {1}",new Object[] {"MSG001","ErrorMsg"});
//Remote interface reference of SFXWebClientSL
ISFXWebClientSL iSFXWebClientSLRef=null;
//Home interface reference of SFXWebClientSL
ISFXWebClientSLHome iSFXWebClientSLHomeRef=null;
Vector filePath=new Vector();
byte[] fileContent=null;
String eDocRoot="";
String eDocPathMain="";
String eDocPath="";
File tempRootFileforDelete = null;
if (TREEDATA.capacity() != 0 )
String BLNODirPath="";
String PONODirPath="";
String SONODirPath="";
// added for doc type level--2005.11.27--samar
String docTypeDirPath="";
String filepath="";
try
PropertiesFileReader propertiesFileReaderRef=new PropertiesFileReader();
filepath=propertiesFileReaderRef.getProperties("/edoc.properties","TEMP_FILE_DIR");
logger.finer("File Path:" +filepath);
}catch(Exception excp)
excp.printStackTrace();
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.IOException","TEMP_FILE_DIR property (edoc.properties) not found");
eDocRoot=CreateFolder("eDocTemp",filepath+File.separator);
// added for top level--2005.12.02--samar
//eDocRoot=CreateFolder("eDocTemp",System.getProperty("user.home")+File.separator);
//eDocPath=CreateFolder(SessionIDVal,eDocRoot+File.separator);
Enumeration TREEDATAEn = TREEDATA.elements(); //Setting The Tree Folder
String BLNO="";
String PONO="";
String SONO="";
String DNO ="";
while(TREEDATAEn.hasMoreElements())
StringTokenizer st = new StringTokenizer((TREEDATAEn.nextElement()).toString(),"_");
while (st.hasMoreTokens()) // Extract All the Fields Of Every Vector Element
BLNO = st.nextToken(); // CSBWNO
PONO = st.nextToken(); // PONO
SONO = st.nextToken(); // SONO
DNO = st.nextToken(); // DNO
eDocPathMain=CreateFolder(SessionIDVal,eDocRoot+File.separator);
eDocPath=CreateFolder("eDoc",eDocPathMain+File.separator);
BLNODirPath = CreateFolder(BLNO,eDocPath+File.separator);
PONODirPath = CreateFolder(PONO,BLNODirPath+File.separator);
SONODirPath = CreateFolder(SONO,PONODirPath+File.separator);
// added for doc type level--2005.11.27--samar
docTypeDirPath=CreateFolder(findDocTypeForDocId(new Integer(DNO)),SONODirPath+File.separator);
File tempRootFile=new File(eDocRoot);
tempRootFile.canWrite();
filePath.add(tempRootFile.getParent());
tempRootFileforDelete = tempRootFile;
//File tempeDocPathMainFile=new File(eDocPathMain);
//filePath.add(tempeDocPathMainFile.getParent());
//2005-12-01::code change for top level directory deletion
//File tempFile=new File(eDocPath);//BLNODirPath);
//filePath.add(tempFile.getParent());
filePath.add(eDocPathMain);
filePath.add(eDocPath);
filePath.add(BLNODirPath);
filePath.add(PONODirPath);
filePath.add(SONODirPath);
// added for doc type level--2005.11.27--samar
filePath.add(docTypeDirPath);
/* Access The Data from DataBase Temp Storage with Document Id And Store In This SO Folder */
/*Long Raw*/
try
InitialContext initialContext=new InitialContext();
int sfxid=0;
/*DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
OraclePooledConnection pc = new OraclePooledConnection("jdbc:oracle:thin:hr/hr@essoraclesvr:1521:essorcl","edoc","edoc");
Connection con=new DBCon().Connect();//pc.getConnection();
PreparedStatement pstm=con.prepareStatement("select SFX_FILE_ID from DOCUMENT where DOCUMENT_ID=?");
//getting context of the server
InitialContext documentCMPInitialContext=getInitialContext();
Object objDocumentCMPRef=null;
try{
objDocumentCMPRef=documentCMPInitialContext.lookup("DocumentCMPBeanJNDI");
catch(Exception e)
//logger.log(Level.SEVERE, "{0} : JNDI not found : {1}",new Object[] {"MSG002","DocumentCMPBeanJNDI"});
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.JNDINotFound","DocumentCMPBeanJNDI not found");
//Home interface reference of DocumentCMP EJB
//IDocumentCMPHome iDocumentCMPHomeRef=(IDocumentCMPHome)PortableRemoteObject.narrow(objDocumentCMPRef,IDocumentCMPHome.class);
IDocumentCMPHome iDocumentCMPHomeRef=(IDocumentCMPHome)objDocumentCMPRef;
IDocumentCMP documentCMPRef=null;
//Remote interface reference of DocumentCMP EJB
try{
documentCMPRef=iDocumentCMPHomeRef.findByPrimaryKey(new Integer(DNO));
catch(Exception e)
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.ObjectNotFound","Document Id not found");
/*pstm.setInt(1,Integer.parseInt(DNO));
ResultSet rs1=pstm.executeQuery();
if(rs1.next()){
sfxid=rs1.getInt(1);
sfxid=documentCMPRef.getSfxFileId().intValue();
logger.finer("sfxid==="+sfxid);
String strFile=documentCMPRef.getDocumentName().toString();
//SFX lookup
//InitialContext initialContext=new InitialContext();
Object sfxWebClient=null;
try{
sfxWebClient=initialContext.lookup("SFXWebClientJNDI");
catch(Exception e)
//NGP/JDK logging if JNDI not found
//logger.log(Level.SEVERE, "{0} : JNDI not found : {1}",new Object[] {"MSG002","SFXWebClientJNDI"});
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.JNDINotFound","SFXWebClientJNDI not found");
iSFXWebClientSLHomeRef=(ISFXWebClientSLHome)PortableRemoteObject.narrow(sfxWebClient,ISFXWebClientSLHome.class);
iSFXWebClientSLRef=iSFXWebClientSLHomeRef.create();//SFXWebClient reference creation
if(iSFXWebClientSLRef!=null)
//logger.finer("ffffffff---");
int arrSFXFileId[]=new int[1];
arrSFXFileId[0]=sfxid;
Object objEFile[]=iSFXWebClientSLRef.retrieveDocument(argUserId,arrSFXFileId);
if(objEFile.length>0)
byte b[]=(byte[])objEFile[1];
String f=strFile.substring(strFile.lastIndexOf(File.separator)+1,strFile.length());
// changed(instead of SONODirPath now docTypeDirPath) for doc type level--2005.11.27--samar
FileOutputStream fout=new FileOutputStream(docTypeDirPath+File.separator + f);
//logger.finer("SONODirPath+File.separator + f---"+SONODirPath+File.separator + f);
filePath.add(docTypeDirPath+File.separator + f);
int j;
for(j=0;j<b.length;j++)
fout.write(b[j]);
fout.close();
//for auditing the document
//logger.finer("Document download audited");
boolean flagAudit=mlogOriginDocumentAudit("Document has been downloaded",Integer.parseInt(DNO),5,argUserId);
//logger.finer("Audit complete"+flagAudit);
if(logger.isFinerLoggable()) {
logger.finer("Audit complete"+flagAudit);
//Delete after finish
tempRootFile.delete();
}catch(Exception e)
//e.printStackTrace();
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.ProcessException","Exception in Folder creation processing");
/* End Long Raw */
}// end of while hasMoreTokens
}// end of while hasMoreElements
}else{ }
/* Zip */
try
zipFolder(eDocPath+File.separator,eDocPath+".zip");
}catch(Exception excp)
////logger.finer(excp.toString());
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.ProcessException","Exception in Zip processing");
// send the byte array for the file
String fileName=eDocPath+".zip";
try{
File file=new File(fileName);
InputStream is = new FileInputStream(file);
// Get the size of the file
long length = file.length();
// You cannot create an array using a long type.It needs to be an int type.
// Before converting to an int type,check to ensure that file is not larger than Integer.MAX_VALUE.
//Kept for future requirement if any
if (length > Integer.MAX_VALUE) {
// File is too large
// Create the byte array to hold the data
fileContent = new byte[(int)length];
// Read in the bytes
int offset = 0;
int numRead = 0;
while (offset < fileContent.length
&& (numRead=is.read(fileContent, offset, fileContent.length-offset)) >= 0) {
offset += numRead;
// Ensure all the bytes have been read in
if (offset < fileContent.length) {
throw new IOException("Could not completely read file "+file.getName());
// Close the input stream and return bytes
is.close();
}catch(Exception e){
deleteDir(tempRootFileforDelete);
//trying for deleting folder and zip file
File file=new File(fileName);
if(file.exists())
file.delete();
//logger.finer("File Deleted successfully");
if(file.exists()){
//logger.finer("File Not Deleted ");
/* File FileToDelete = new File(eDocPath+".zip");
boolean DelStatus1 = deleteDir(FileToDelete);
//logger.finer("Deletion 1:"+DelStatus1 );
File FolderToDelete = new File(eDocPath);
boolean DelStatus2 = deleteDir(FolderToDelete);
//logger.finer("Deletion 2:"+DelStatus2);
for(int index=filePath.size()-1;index>=0;index--)
File delFile=new File(filePath.elementAt(index).toString());
//logger.finer(delFile.getAbsolutePath());
if(delFile.exists())
//logger.finer("Before delete---123");
//logger.finer("File Deleted========>"+delFile.delete());
//logger.finer("After delete---123");
//logger.finer(delFile.getAbsolutePath()+"-----------"+delFile.exists());
return fileContent;
/* ***************************Start DIR *********************/
private String DoFolder(String folderNname)
File f;
f = new File(folderNname);
f.mkdir(); // Create The Folder
//f.deleteOnExit(); //R n D to Delete The zip folders only */
return(folderNname+File.separator);
//to create the folder
private String CreateFolder(String FolderName,String newFolderPath)
String NewDir ="";
NewDir=newFolderPath + FolderName;
newFolderPath=DoFolder(NewDir);
return(NewDir);
//To zip the folder
private void zipFolder(String srcFolder, String destZipFile)
ZipOutputStream zip = null;
FileOutputStream fileWriter = null;
try
fileWriter = new FileOutputStream(destZipFile);
zip = new ZipOutputStream(fileWriter);
//required for XP compress
zip.setMethod(ZipOutputStream.DEFLATED);
zip.setLevel(Deflater.DEFAULT_COMPRESSION); //use default level
}catch (Exception ex){
ex.printStackTrace();
System.exit(0);
addFolderToZip("", srcFolder, zip);
try
zip.flush();
zip.close();
zip=null;
fileWriter.close();
fileWriter = null;
}catch (Exception ex)
//ex.printStackTrace();
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.ProcessException","Exception in Zip folder processing");
// File f2= new File(destZipFile);
* Write the content of srcFile in a new ZipEntry, named path+srcFile,of the zip stream
* The result is that the srcFile will be in the path folder in the generated archive.
* @param path String, the relative path with the root archive.
* @param srcFile String, the absolute path of the file to add
* @param zip ZipOutputStram, the stream to use to write the given file.
//the folders are added to zip file
private void addToZip(String path, String srcFile, ZipOutputStream zip)
File folder = new File(srcFile);
//folder.deleteOnExit();
if (folder.isDirectory()) {
addFolderToZip(path, srcFile, zip);
else {
//Transfer bytes from in to out
byte[] buf = new byte[1024];
int len;
FileInputStream in = null;
try {
in = new FileInputStream(srcFile);
// void putNextEntry(ZipEntry e) Begins writing a new ZIP file entry
// and positions the stream to the start of the entry data.
zip.putNextEntry(new ZipEntry(path +File.separator+ folder.getName()));
while ((len = in.read(buf)) > 0)
zip.write(buf, 0, len);
}catch (Exception ex){
ex.printStackTrace();
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.ProcessException","Exception in Adding to Zip Folder");
}finally{
try
//2005-12-01::file pointer close
in.close();
}catch(Exception e){
e.printStackTrace();
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.ProcessException","Exception in Adding to Zip Folder");
folder.delete(); //we addedd for DELETE
* add the srcFolder to the zip stream.
* @param path String, the relatif path with the root archive.
* @param srcFile String, the absolute path of the file to add
* @param zip ZipOutputStram, the stream to use to write the given file.
private void addFolderToZip(String path, String srcFolder, ZipOutputStream zip)
File folder = new File(srcFolder);
folder.canWrite();
//folder.deleteOnExit();
String fileListe[] = folder.list();
try
int i = 0;
while (true)
addToZip(path+File.separator+ folder.getName(), srcFolder+File.separator+fileListe, zip);
i++;
}catch (Exception ex)
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.ProcessException","Exception in Naming after adding to Zip Folder");
/* $$$$$$$$$$$$$$$$$ End Zipping $$$$$$$$$$$$$$$ */
/****************Start Of Deleting Directory from server***********/
public boolean deleteDir(File dir) {
// to see if this directory is actually a symbolic link to a directory,
// we want to get its canonical path
//- that is, we follow the link to the file it's actually linked to
File candir;
try {
candir = dir.getCanonicalFile();
} catch (IOException e) {
return false;
// a symbolic link has a different canonical path than its actual path,
// unless it's a link to itself
if (!candir.equals(dir.getAbsoluteFile())) {
//this file is a symbolic link, and there's no reason for us to follow it,
//because then we might be deleting something outside of the directory we were told to delete
return false;
// now we go through all of the files and subdirectories in the directory and delete them one by one
File[] files = candir.listFiles();
if (files != null) {
for (int i = 0; i < files.length; i++) {
File file = files[i];
//file read only set false
//in case this directory is actually a symbolic link, or it's empty,
//we want to try to delete the link before we try anything
boolean deleted = file.delete();
if (!deleted) {
// deleting the file failed, so maybe it's a non-empty directory
if (file.isDirectory()) deleteDir(file);
// otherwise, there's nothing else we can do
// now that we tried to clear the directory out, we can try to delete it again
return dir.delete();
/************End Of Deleting Directory *********************/
private InitialContext getInitialContext() throws NamingException {
try {
return new InitialContext();
} catch (NamingException ne) {
//logger.finer("Please make sure that the server is running.");
throw ne;
//*****************************WEB SERVICE FILE RETRIEVE IMPLEMENTATION FOR MPS PEOPLE*************************************************
* <b>
* Used for Retrieval of a document.
* </b>
* This function is called from retrieveDocument function of MPStoEdocWebServiceSLBean.
* <p>
* @param argUserId User Id of the user who wants to retrieve the document
* @param argSfxFileId[] Sfx File Id which gives the reference number of the document(s) in the SFX database.
* @return Returns a one dimentional Object array containing a series of file name and file content of the retrieved documents.
public Object[] mpsDocumentView(String argUserId,Integer[] argSfxFileId) throws RemoteException
//NGP/JDK logging
logger.finer("mpsDocumentView called--");
try{
argUserId=argUserId.toUpperCase();
catch(Exception e)
e.printStackTrace();
logger.finer("mpsDocumentView argSfxFileId[0]--"+argSfxFileId[0]);
Object[] searchResult=null;
/*FileHandler handler = null;
Logger logger=null;
int finalIndex=0;
try
//PropertiesFileReader propertiesFileReaderRef=new PropertiesFileReader();
//String logFile=propertiesFileReaderRef.getProperties("/edoc.properties","EDOC_LOG");
//handler = new FileHandler("eDoc.log",0,1, true);
//logger = Logger.getLogger("ErrorMsg");
//logger.addHandler(handler);
//logger.setLevel(Level.ALL);
}catch(Exception excp)
//NGP/JDK Logging warning
//logger.log(Level.WARNING, "{0} : Unable to find Resource Bundle File : {1}",new Object[] {"MSG001","ErrorMsg"});
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.JNDINotFound","PurchaseOrderCMPBeanJNDI not found");
Object objDocumentFile[]=null;
ISFXWebClientSLHome iSFXWebClientSLHomeRef=null;
ISFXWebClientSL iSFXWebClientSLRef=null;
try{
//Locating SFX WEB CLIENT SESSION BEAN
InitialContext initialContext=new InitialContext();
Object sfxWebClient=null;
try{
sfxWebClient=initialContext.lookup("SFXWebClientJNDI");
catch(Exception e)
//NGP/JDK Logging if JNDI not found
//logger.log(Level.SEVERE, "{0} : JNDI not found : {1}",new Object[] {"MSG002","SFXWebClientJNDI"});
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.JNDINotFound","SFXWebClientJNDI not found");
iSFXWebClientSLHomeRef=(ISFXWebClientSLHome)PortableRemoteObject.narrow(sfxWebClient,ISFXWebClientSLHome.class);
//creation of SFX we client
iSFXWebClientSLRef=iSFXWebClientSLHomeRef.create();
int arrSFXFileId[]=new int[argSfxFileId.length];
logger.finer("SFXWebClient created----");
//holds the sequence of SFX file id in the array
//EFile file=new EFile();
//getting context of the server
InitialContext documentCMPInitialContext=getInitialContext();
Object objDocumentCMPRef=null;
int docId=0;
try{
objDocumentCMPRef=documentCMPInitialContext.lookup("DocumentCMPBeanJNDI");
catch(Exception e)
//NGP/JDK Logging if JNDI not found
//logger.log(Level.SEVERE, "{0} : JNDI not found : {1}",new Object[] {"MSG002","DocumentCMPBeanJNDI"});
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.JNDINotFound","DocumentCMPBeanJNDI not found");
//Home interface reference of DocumentCMP EJB
//IDocumentCMPHome iDocumentCMPHomeRef=(IDocumentCMPHome)PortableRemoteObject.narrow(objDocumentCMPRef,IDocumentCMPHome.class);
IDocumentCMPHome iDocumentCMPHomeRef=(IDocumentCMPHome)objDocumentCMPRef;
//find the document id in the Document table from the SFx File Id
for(int index=0;index<argSfxFileId.length;index++)
arrSFXFileId[index]=argSfxFileId[index].intValue();
logger.finer("mpsDocumentView arrSFXFileId[index]--"+arrSFXFileId[index]);
logger.finer("For Document auditing----");
//Remote interface reference of DocumentCMP EJB
IDocumentCMP iDocumentCMPRef=iDocumentCMPHomeRef.findDocIdBySfxId(new Integer(arrSFXFileId[index]));
docId=iDocumentCMPRef.getDocumentId().intValue();
//for document audit
try{
boolean flagAudit=mlogOriginDocumentAudit("Document is Viewed",docId,5,argUserId);
catch(Exception e)
//logger.finer("Document cannot be audited----");
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.ProcessException","Exception in audit processing");
//call the retrieveDocument method for the above array of elements
//Object[] tempObjDocumentFile=iSFXWebClientSLRef.retrieveDocument(argUserId,arrSFXFileId);
//EFile file=new EFile();
//for(int index=0;index<tempObjDocumentFile.length;index++){
// file= (EFile) tempObjDocumentFile[index];
// objDocumentFile[finalIndex++]=file.getDocFileName();
// objDocumentFile[finalIndex++]=file.getDocFileContent();
objDocumentFile=iSFXWebClientSLRef.retrieveDocument(argUserId,arrSFXFileId);
//EFile[] efileArray = (EFile[]) = objDocumentFile;
searchResult = new Object[efileArray.length*2];
for (int i=0;i<efileArray.length;i=i+2)
EFile currentFile = efileArray[i];
searchResult[i] = currentFile.getDocFileName();
searchResult[i+1] = currentFile.getDocFileContent();
searchResult=iSFXWebClientSLRef.retrieveDocument(argUserId,arrSFXFileId);
}//end of try
catch(Exception expt)
//logger.finer(expt);
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.ProcessException","Exception in retrieve from SFX");
//if exception occurs returns null as per initilisation above
//logger.finer("mpsDocumentView size--"+objDocumentFile.length);
return searchResult;
//**************************** FILE RETRIEVE IMPLEMENTATION FOR MLOG PEOPLE*******************************
* <b>
* Used for Retrieval of a document.
* </b>
* This function is called from struts.
* <p>
* @param argDocumentId Documnet Id which gives the ID of the document in the eDoc database..
* @param argUserId User Id of the user who wants to retrieve the document
* @return Returns a one dimentional Object array containing a series of file name and file content of the retrieved documents.
public Object[] mlogOriginDocumentView(int argDocumentId,String argUserId) throws RemoteException
//NGP/JDK Logging
logger.finer("mlogOriginDocumentView called--");
try{
argUserId=argUserId.toUpperCase();
catch(Exception e)
//e.printStackTrace();
logger.log("net.mlog.edoc.ejb.session.EdocRetrieveServiceSLBean.ProcessException","Exception in uppercase");
//logger.finer("mlogOriginDocumentView-- argDocumentId---"+argDocumentId);
/*FileHandler handler = null;
Logger logger=null;
try
//PropertiesFileReader propertiesFileReaderRef=new PropertiesFileReader();
//String logFile=propertiesFileReaderRef.getProperties("/edoc.properties","EDOC_LOG");
//handler = new FileHandler("eDoc.log",0,1, tr -
getting a java.util.zip.zipexception : a device attached to the system is not functioning error - what could cause such an error?
My program finds all zip files in an archive and then searches through them for xls files, which it extracts and re-locates.
I havent even a clue where to look for the cause of this exception but Ill attach at the bottom the code in the general vicitiny of the trigger so that you can get kind of an idea what Im trying to do, and if im lucky, even spot my problem. :) Thanks!!
//zips is an array of zip files
int found = 0;
File[] haveXLs = new File[zips.length];
for (int i = 0; i < zips.length; i++){
String fileName = new String("L:/Vision/Archive/" + zips.getName());
ZipFile archive = new ZipFile(fileName);
String name = zips[i].getName().substring(0,8);
for(Enumeration e = archive.entries(); e.hasMoreElements();){
ZipEntry entry = (ZipEntry) e.nextElement();
if(entry.getName().substring(0,8) == name){
haveXLs[found] = zips[i];
found++;Hey there a few things.
Make sure that you dont use fileseparators like you do. ("/")
Use the separator generated for your system.
Something like:
String sep = System.getProperty("file.separator");
You mentioned it work local, but not network.
Either you have plenty of harddrives or L: is a mapped drive.
Is it working at the mapped drive?
When you say on the network, how are you accessing the files?
Could it be possible for another user to lock a file, so you wont have access to it over the network?
BR.
MagDy -
Java.util.zip.DataFormatException: unknown compression method
I'm trying to decompress data from an oralce database into a file, but I'm getting error. Any assistance would be greatly appreciated .
package com.citi.blob;
import java.sql.*;
import java.io.*;
import java.util.zip.Inflater;
public class PullBlob {
public static void main(String[] args) {
// DB Connection info
String userName="user";
String passWord="password";
//Production Database
String dataBase="ABCD";
//Production URL
String url = "jdbc:oracle:thin:@111.2222.333.444:8080:" + dataBase;
System.out.println("args length is" + args.length);
// Sort out args
if(args.length<2) {
System.out.println("Usage: java PullBLOB product acctnum optional-out-file");
System.exit(1);
String product = args[0];
String acctnum = args[1];
String fileName = null;
if(args.length>=3) {
fileName = args[2];
Connection con = null;
try {
// Establish connection
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection(url, userName, passWord);
Statement stmt = con.createStatement();
// Sort out the output stream
boolean toFile=false;
PrintWriter fout = null;
if(fileName!=null) {
File file = new File(fileName);
FileOutputStream fos = new FileOutputStream(file);
fout = new PrintWriter(fos);
toFile = true;
String query = "SELECT stm_cmp_xml FROM pld_stm WHERE prd_nm = 'JACKS_BOX' and act_num='9988556622'";
System.out.println(query);
ResultSet rs = stmt.executeQuery(query);
// System.out.println("Number of records fetchted " + rs.getFetchSize());
if(rs.next()) {
//Blob xml = rs.getBlob("inv_cmp_xml");
Blob xml = rs.getBlob("stm_cmp_xml");
InputStream in = xml.getBinaryStream();
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
int data;
while ((data = in.read()) != -1) {
byteStream.write((byte)data);
byte[] compressedData = byteStream.toByteArray();
in.close();
Inflater decompressor = new Inflater();
decompressor.setInput(compressedData);
// Create an expandable byte array to hold the decompressed data
ByteArrayOutputStream bos = new ByteArrayOutputStream(compressedData.length);
// Decompress the data
//byte[] buf = new byte[TEMP_BUFFER_SIZE];
// use a 1 meg buffer for improved speed
byte [] buf = new byte[1048576];
while (!decompressor.finished()) {
int count = decompressor.inflate(buf);
bos.write(buf, 0, count);
buf=null;
bos.close();
//Get the decompressed data
byte[] decompressedData = bos.toByteArray();
String stmtXml = new String(decompressedData).trim();
if(toFile) {
fout.println(stmtXml);
else {
System.out.println(stmtXml);
else { // No result
System.out.println("Couldn't find stmt for " + acctnum );
if(fout!=null) fout.close();
catch(Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
finally {
try {
if(con!=null) con.close();
catch(Exception e) {
// Whatever
}here is the output and error I receieve:
args length is3
SELECT stm_cmp_xml FROM pld_stm WHERE prd_nm = 'JACKS_BOX' and act_num='9988556622'
unknown compression method
java.util.zip.DataFormatException: unknown compression method
at java.util.zip.Inflater.inflateBytes(Native Method)
at java.util.zip.Inflater.inflate(Unknown Source)
at java.util.zip.Inflater.inflate(Unknown Source)
at com.citi.blob.PullBlob.main(PullBlob.java:95)Take a look at class ZipFile.
o Create one on your input.
o Get an enumeration of the entries - the headers for your files within the zip file.
o Ask for the input stream of the file you want.
o Read the data - it is unzipped for you. -
OracleLog.properties for java.util.logging
In the Oracle JDBC FAQ the answer to the question "How do I configure java.util.logging to get useful trace output from Oracle JDBC?" <http://otn.oracle.com/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm#36_03> mentions the file "OracleLog.properties" provided in the "demo.zip" file.
I cannot find the file "OracleLog.properties" anywhere?
Any suggestions?
Kindest Regards,
Gerhard HofmannIt seems a logger instance HAS been created for my Test class, I've added the lines below. Though it didn't appear in the logger names enumeration.
java.util.logging.Logger logger = java.util.logging.Logger.getLogger(name);
System.out.println(logger.getName()+"="+logger.getLevel().getName());
logger.severe("severe");
logger.warning("warning");
logger.info("info");
logger.config("config");
logger.fine("fine");
logger.finer("finer");
logger.finest("finest");Output:Test=FINEST
6/10/2003 16:00:01 Test <init>
SEVERE: severe
6/10/2003 16:00:01 Test <init>
WARNING: warning
6/10/2003 16:00:01 Test <init>
INFO: infoObservations:
1) Despite my Test class having the FINEST log level, the default ConsoleHandler had log level of INFO, and hence only up to INFO logged. -
Workshop 9.2 - Web Service Test Client - java.util.NoSuchElementException
I've found an issue with the Web Services Test Client while developing a web service application in the Weblogic Workshop 9.2 tool. The same schema / code in Workshop 8.1 SP4 works okay in its version of the test client.
The error seems to manifest itself, when I add the "addresses" element to the "locations" element.
The error displayed in the weblogic service console is
<BLOCKQUOTE>
java.lang.RuntimeException: java.util.NoSuchElementException
at weblogic.testclient.ConnectionState.createWsdl(ConnectionState.java:63)
at Controller.refreshWsdl(Controller.java:304)
at Controller.begin(Controller.java:173)
at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:878)
at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:808)
at org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:477)
at org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:305)
at org.apache.beehive.netui.pageflow.FlowController.execute(FlowController.java:335)
at org.apache.beehive.netui.pageflow.internal.FlowControllerAction.execute(FlowControllerAction.java:51)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:95)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:2042)
at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors.wrapAction(ActionInterceptors.java:90)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionPerform(PageFlowRequestProcessor.java:2114)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:554)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:851)
at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:630)
at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:157)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3211)
Caused by: java.util.NoSuchElementException
at java.util.AbstractList$Itr.next(AbstractList.java:427)
at weblogic.testclient.RequestTemplate.addSoapForParameter(RequestTemplate.java:341)
at weblogic.testclient.RequestTemplate.addSoapForParameter(RequestTemplate.java:334)
at weblogic.testclient.RequestTemplate.addSoapForParameter(RequestTemplate.java:334)
at weblogic.testclient.RequestTemplate.addSoapForParameter(RequestTemplate.java:334)
at weblogic.testclient.RequestTemplate.addSoapForParameter(RequestTemplate.java:334)
at weblogic.testclient.RequestTemplate.addSoapForParameter(RequestTemplate.java:334)
at weblogic.testclient.RequestTemplate.addSoapForParameter(RequestTemplate.java:334)
at weblogic.testclient.RequestTemplate.addSoapForParameter(RequestTemplate.java:334)
at weblogic.testclient.RequestTemplate.addSoapForParameter(RequestTemplate.java:334)
at weblogic.testclient.RequestTemplate.createMessageBody(RequestTemplate.java:220)
at weblogic.testclient.RequestTemplate.buildRequest(RequestTemplate.java:169)
at weblogic.testclient.RequestTemplate.createRequestTemplate(RequestTemplate.java:103)
at weblogic.testclient.RequestTemplate.<init>(RequestTemplate.java:85)
at weblogic.testclient.WebServiceOperation.<init>(WebServiceOperation.java:120)
at weblogic.testclient.WsdlOperationParser.createOperation(WsdlOperationParser.java:115)
at weblogic.testclient.WebService.createOperation(WebService.java:242)
at weblogic.testclient.WebService.<init>(WebService.java:86)
at weblogic.testclient.Wsdl.parseWsdl(Wsdl.java:127)
at weblogic.testclient.Wsdl.<init>(Wsdl.java:59)
at weblogic.testclient.ConnectionState.createWsdlFromHttpUrl(ConnectionState.java:113)
at weblogic.testclient.ConnectionState.createWsdl(ConnectionState.java:54)
at Controller.refreshWsdl(Controller.java:304)
at Controller.begin(Controller.java:173)
at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:878)
at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:808)
at org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:477)
</BLOCKQUOTE>
The code in the Web Service control is...
<BLOCKQUOTE>
package services;
import javax.jws.WebMethod;
import javax.jws.WebService;
import weblogic.jws.WLHttpTransport;
import au.com.suncorp.services.payment.schema.x0.RequestIdDocument;
import au.com.suncorp.services.payment.schema.x0.VendorDocument;
@WebService(targetNamespace="http://suncorp.com.au/services/payment/wsdl/0")
@WLHttpTransport(serviceUri="services/PaymentService")
public class Payment {
@WebMethod
public RequestIdDocument setupVendor(VendorDocument request) {
System.out.println(request.xmlText());
RequestIdDocument result = RequestIdDocument.Factory.newInstance();
RequestIdDocument.RequestId response = result.addNewRequestId();
response.setCorrelationId("CorrelationId-" + request.getVendor().getName());
return result;
</BLOCKQUOTE>
The XSD schema is as follows....
<BLOCKQUOTE>
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://suncorp.com.au/services/payment/schema/0"
xmlns:tns="http://suncorp.com.au/services/payment/schema/0">
<!-- ***************************************************************** -->
<simpleType name="correlationIdType">
<annotation>
<documentation>
The CorrelationId field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="estTimeIntervalType">
<annotation>
<documentation>
The Estimated Time Interval field.
</documentation>
</annotation>
<restriction base="integer"></restriction>
</simpleType>
<simpleType name="vendorIdType">
<annotation>
<documentation>
The Vendor Id field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="nameType">
<annotation>
<documentation>
The Vendor Name field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="persistenceType">
<annotation>
<documentation>
The Persistence field.
</documentation>
</annotation>
<restriction base="boolean"></restriction>
</simpleType>
<simpleType name="ownerType">
<annotation>
<documentation>
The Owner field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="sourceReferenceType">
<annotation>
<documentation>
The vendor Source Reference field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="abnType">
<annotation>
<documentation>
The vendor ABN field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="countryType">
<annotation>
<documentation>
The Country field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="stateType">
<annotation>
<documentation>
The State field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="cityType">
<annotation>
<documentation>
The City field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="postcodeType">
<annotation>
<documentation>
The Postcode field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="gstRegisteredType">
<annotation>
<documentation>
The GST Registered field.
</documentation>
</annotation>
<restriction base="boolean"></restriction>
</simpleType>
<simpleType name="withHoldingType">
<annotation>
<documentation>
The WithHolding field.
</documentation>
</annotation>
<restriction base="boolean"></restriction>
</simpleType>
<simpleType name="vendorClassType">
<annotation>
<documentation>
The Vendor Class field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="statusType">
<annotation>
<documentation>The Status field.</documentation>
</annotation>
<restriction base="string">
<enumeration value="ACTIVE">
<annotation>
<documentation>an enumerated value.</documentation>
</annotation>
</enumeration>
<enumeration value="INACTIVE">
<annotation>
<documentation>an enumerated value.</documentation>
</annotation>
</enumeration>
</restriction>
</simpleType>
<simpleType name="locationIdType">
<annotation>
<documentation>
The Location Id field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="effectiveDateType">
<annotation>
<documentation>
The Effective Date field.
</documentation>
</annotation>
<restriction base="dateTime"></restriction>
</simpleType>
<simpleType name="addressIdType">
<annotation>
<documentation>
The AddressId field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="addressType">
<annotation>
<documentation>
The Address field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="contactIdType">
<annotation>
<documentation>
The ContactId field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="contactMethodType">
<annotation>
<documentation>
The Address field.
</documentation>
</annotation>
<restriction base="string">
<enumeration value="FAX">
<annotation>
<documentation>an enumerated value.</documentation>
</annotation>
</enumeration>
<enumeration value="PHONE">
<annotation>
<documentation>an enumerated value.</documentation>
</annotation>
</enumeration>
<enumeration value="EMAIL">
<annotation>
<documentation>an enumerated value.</documentation>
</annotation>
</enumeration>
</restriction>
</simpleType>
<simpleType name="dispatchMethodType">
<annotation>
<documentation>
The Dispatch Method field.
</documentation>
</annotation>
<restriction base="string">
<enumeration value="EFT">
<annotation>
<documentation>an enumerated value.</documentation>
</annotation>
</enumeration>
<enumeration value="FAX">
<annotation>
<documentation>an enumerated value.</documentation>
</annotation>
</enumeration>
<enumeration value="EMAIL">
<annotation>
<documentation>an enumerated value.</documentation>
</annotation>
</enumeration>
</restriction>
</simpleType>
<simpleType name="currencyType">
<annotation>
<documentation>
The Currency field.
</documentation>
</annotation>
<restriction base="boolean"></restriction>
</simpleType>
<simpleType name="payGroupType">
<annotation>
<documentation>
The Pay Group field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="payHoldType">
<annotation>
<documentation>
The Pay Hold field.
</documentation>
</annotation>
<restriction base="boolean"></restriction>
</simpleType>
<simpleType name="freightTermsType">
<annotation>
<documentation>
The Freight Terms field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="payHandlingType">
<annotation>
<documentation>
The Pay Handling field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="delayDaysType">
<annotation>
<documentation>
The Delay Days field.
</documentation>
</annotation>
<restriction base="integer"></restriction>
</simpleType>
<simpleType name="payFromBankType">
<annotation>
<documentation>
The Pay From Bank field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="paymentInstructionsType">
<annotation>
<documentation>
The Payment Instructions field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="paymentTermsType">
<annotation>
<documentation>
The Payment Terms field.
</documentation>
</annotation>
<restriction base="string">
<enumeration value="COD">
<annotation>
<documentation>an enumerated value.</documentation>
</annotation>
</enumeration>
<enumeration value="SEVEN_DAYS">
<annotation>
<documentation>an enumerated value.</documentation>
</annotation>
</enumeration>
<enumeration value="FOURTEEN_DAYS">
<annotation>
<documentation>an enumerated value.</documentation>
</annotation>
</enumeration>
<enumeration value="TWENTYONE_DAYS">
<annotation>
<documentation>an enumerated value.</documentation>
</annotation>
</enumeration>
<enumeration value="THIRTY_DAYS">
<annotation>
<documentation>an enumerated value.</documentation>
</annotation>
</enumeration>
</restriction>
</simpleType>
<simpleType name="paymentMethodType">
<annotation>
<documentation>
The Payment Method field.
</documentation>
</annotation>
<restriction base="string">
<enumeration value="EFT">
<annotation>
<documentation>an enumerated value.</documentation>
</annotation>
</enumeration>
<enumeration value="CHEQUE">
<annotation>
<documentation>an enumerated value.</documentation>
</annotation>
</enumeration>
</restriction>
</simpleType>
<simpleType name="payBankIdType">
<annotation>
<documentation>
The PayBankId field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="descriptionType">
<annotation>
<documentation>
The Pay Bank Description field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="bankIdType">
<annotation>
<documentation>
The BankId field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="branchIdType">
<annotation>
<documentation>
The BranchId field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<simpleType name="bankAccountType">
<annotation>
<documentation>
The BankAccount field.
</documentation>
</annotation>
<restriction base="string"></restriction>
</simpleType>
<!-- ***************************************************************** -->
<complexType name="payBankDetailsType">
<sequence>
<element name="payBankId" type="tns:payBankIdType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="description" type="tns:descriptionType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="bankId" type="tns:bankIdType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="branchId" type="tns:branchIdType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="bankAccount" type="tns:bankAccountType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="effectiveDate" type="tns:effectiveDateType" maxOccurs="1" minOccurs="0" nillable="true"></element>
</sequence>
</complexType>
<complexType name="paymentDetailsType">
<sequence>
<element name="paymentTerms" type="tns:paymentTermsType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="paymentMethod" type="tns:paymentMethodType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="dispatchMethod" type="tns:dispatchMethodType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="payGroup" type="tns:payGroupType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="currency" type="tns:currencyType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="payHold" type="tns:payHoldType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="freightTerms" type="tns:freightTermsType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="payHandling" type="tns:payHandlingType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="delayDays" type="tns:delayDaysType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="payFromBank" type="tns:payFromBankType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="paymentInstructions" type="tns:paymentInstructionsType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="bankDetails" type="tns:payBankDetailsType" maxOccurs="1" minOccurs="1"></element>
</sequence>
</complexType>
<complexType name="contactDetailsType">
<sequence>
<element name="contactId" type="tns:contactIdType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="effectiveDate" type="tns:effectiveDateType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="name" type="tns:nameType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="contactMethod" type="tns:contactMethodType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="dispatchMethod" type="tns:dispatchMethodType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="status" type="tns:statusType" maxOccurs="1" minOccurs="1"></element>
</sequence>
</complexType>
<complexType name="arrayOfContactDetails">
<sequence>
<element name="contact" type="tns:contactDetailsType" maxOccurs="unbounded" minOccurs="0"></element>
</sequence>
</complexType>
<complexType name="addressDetailsType">
<sequence>
<element name="addressId" type="tns:addressIdType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="effectiveDate" type="tns:effectiveDateType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="name" type="tns:nameType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="address" type="tns:addressType" maxOccurs="1" minOccurs="1"></element>
<element name="postcode" type="tns:postcodeType" maxOccurs="1" minOccurs="1"></element>
<element name="city" type="tns:cityType" maxOccurs="1" minOccurs="1"></element>
<element name="state" type="tns:stateType" maxOccurs="1" minOccurs="1"></element>
<element name="country" type="tns:countryType" maxOccurs="1" minOccurs="1"></element>
<element name="contacts" type="tns:arrayOfContactDetails" maxOccurs="1" minOccurs="0"></element>
</sequence>
</complexType>
<complexType name="arrayOfAddressDetails">
<sequence>
<element name="address" type="tns:addressDetailsType" maxOccurs="unbounded" minOccurs="0"></element>
</sequence>
</complexType>
<complexType name="locationDetailsType">
<sequence>
<element name="locationId" type="tns:locationIdType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="effectiveDate" type="tns:effectiveDateType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="orderingVendorId" type="tns:vendorIdType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="invoicingVendorId" type="tns:vendorIdType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="remittingVendorId" type="tns:vendorIdType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="returningVendorId" type="tns:vendorIdType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="status" type="tns:statusType" maxOccurs="1" minOccurs="1"></element>
<element name="paymentDetails" type="tns:paymentDetailsType" maxOccurs="1" minOccurs="1"></element>
<element name="addresses" type="tns:arrayOfAddressDetails" maxOccurs="1" minOccurs="0"></element>
</sequence>
</complexType>
<complexType name="arrayOfLocationDetails">
<sequence>
<element name="location" type="tns:locationDetailsType" maxOccurs="unbounded" minOccurs="0"></element>
</sequence>
</complexType>
<!-- ***************************************************************** -->
<element name="Vendor">
<complexType mixed="true">
<annotation>
<documentation>
The Vendor request object.
</documentation>
</annotation>
<sequence>
<element name="vendorId" type="tns:vendorIdType" maxOccurs="1" minOccurs="1"></element>
<element name="name" type="tns:nameType" maxOccurs="1" minOccurs="1"></element>
<element name="persistence" type="tns:persistenceType" maxOccurs="1" minOccurs="1" default="true"></element>
<element name="owner" type="tns:ownerType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="sourceReference" type="tns:sourceReferenceType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="corporateVendorId" type="tns:vendorIdType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="abn" type="tns:abnType" maxOccurs="1" minOccurs="0" nillable="true"></element>
<element name="country" type="tns:countryType" maxOccurs="1" minOccurs="1" default="AUS"></element>
<element name="gstRegistered" type="tns:gstRegisteredType" maxOccurs="1" minOccurs="0" nillable="true" default="true"></element>
<element name="withHolding" type="tns:withHoldingType" maxOccurs="1" minOccurs="0" nillable="true" default="false"></element>
<element name="status" type="tns:statusType" maxOccurs="1" minOccurs="1" default="ACTIVE"></element>
<element name="vendorClass" type="tns:vendorClassType" maxOccurs="1" minOccurs="1"></element>
<element name="locations" type="tns:arrayOfLocationDetails" maxOccurs="1" minOccurs="0"></element>
</sequence>
</complexType>
</element>
<element name="RequestId">
<complexType mixed="true">
<annotation>
<documentation>The typical response object for requests.
</documentation>
</annotation>
<sequence>
<element name="correlationId" type="tns:correlationIdType" maxOccurs="1" minOccurs="1"></element>
<element name="estTimeInterval" type="tns:estTimeIntervalType" maxOccurs="1" minOccurs="0" nillable="true" default="24"></element>
</sequence>
</complexType>
</element>
</schema>
</BLOCKQUOTE>Hi Paul
I believe there is some issue with the TestClient.
Instead to test, can you please try this?
1) Right click on Payment.java and choose Webservices -> generate wsdl
2) Right click on the wsdl and choose Webservices -> Test with WebServices Explorer.
3) Click on setVendor method
4) Enter the request parameters
Sample one:
<ns:Vendor xmlns="http://www.openuri.org/" xmlns:ns="http://suncorp.com.au/services/payment/schema/0">
<vendorId xmlns="">Vendor Id</vendorId>
<name xmlns="">My correlation Id</name>
<persistence xmlns="">false</persistence>
<country xmlns="">USA</country>
<status xmlns="">ACTIVE</status>
<vendorClass xmlns="">VendorClass</vendorClass>
</ns:Vendor>
5) Hit the button 'Go'. The entire soap response will be displayed in the bottom.
I have tested this and it works fine.
Output I got:
<m:setupVendorResponse xmlns:m="http://suncorp.com.au/services/payment/wsdl/0">
<RequestId xmlns="http://suncorp.com.au/services/payment/schema/0">
<correlationId>CorrelationId-My correlation Id</correlationId>
</RequestId>
</m:setupVendorResponse>
Thanks,
Vimala -
SQLJ Iterator vs java.util.Iterator
Hi -
I'm trying to start using SQLJ a bit more, and I was wondering if anybody had some code samples for implementing a java.util.Collection or java.util.Iterator interface for a SQLJ Iterator? Lots of my utility code works on the standard collection/iterator/enumeration trio. Any great ideas out there for putting a standard interface on a SQLJ iterator?
Thanks!
-best-darr-
nullSounds intriguing - other than a similarity of name, these currently do not have anything in common.
There is one approach currently available to you: you can subclass the iterator class to provide your own functionality and use that subclass. See:
http://technet.oracle.com/tech/java/sqlj_jdbc/htdocs/sqlj-primer06i.htm
Source is in the distribution in:
.../sqlj/demo/SubclassIterDemo.sqlj
Your take -if I understand correctly - on this is to have the SQLJ translator automatically create implementations of the the various collection types from an iterator when you specify:
#sql iterator Iter implements SomeCollectionType (...);
In that case I am still unsure as to what the elements of the collection are. -
I need to retrieve an Object[] of all keys in java.util.Hashtable
public abstract class ArrayFunctionality {
* Construct {@link java.lang.Object} array of keys from {@link java.util.Hashtable}
* @param h {@link java.util.Hashtable}
* @return array {@link java.lang.String}
* @throws java.lang.IndexOutOfBoundsException Exception thrown if initial {@link java.lang.Object} array paramater cannot be indexed
public static Object[] arrayKeys(Hashtable<Object, Object> h) throws IndexOutOfBoundsException {
Vector<Object> v = new Vector<Object>();
Enumeration keys = h.keys();
while (keys.hasMoreElements()) v.add(keys.nextElement());
return v.toArray();
// HOWEVER, this occurs with Hashtable<String, String> attrs:
if (hasSetHashtable) String[] keyArray = ArrayFunctionality.arrayKeys(attrs);
// DOES NOT COMPILE: ".class expected - not a statement"I am not understanding why this is occurring, please advise, I'm lost on this one.
Thanx
PhilI still don't understand what you mean but it now
works..
I am sorry I just don't understand the difference
between
if (hasSetHashtable) {
String[] keyArray;
keyArray = ArrayFunctionality.arrayKeys(attrs);
}AND
if (hasSetHashtable) {
String[] keyArray =
ArrayFunctionality.arrayKeys(attrs);PhilThere is no difference between those two you posted. The difference is between
String[] keyArray;
if (...) {
keyArray = ArrayFunctionality.arrayKeys(attrs);
}and
if (...) {
String[] keyArray;
keyArray = ArrayFunctionality.arrayKeys(attrs);
}In the first, the keyArray will exist outside of the scope of the if statement. In the second, the keyArray will no longer exist once you leave the if statement. Which is the same thing jbish said. -
Error while deploying a web service whose return type is java.util.Date
Hi
I have written a simple web service which takes in a date input (java.util.Date) and returns the same date back to the client.
public interface Ping extends Remote
* A simple method that pings the server to test the webservice.
* It sends a datetime to the server which returns the datetime.
* @param pingDateRequest A datetime sent to the server
* @returns The original datetime
public Date ping(Date pingDateRequest) throws RemoteException;
The generation of the Web service related files goes smoothly in JDeveloper 10g. The problem arises when I try to deploy this web service on the Oracle 10g (10.0.3) OC4J standalone. it gives me the following error on the OC4J console :
E:\Oracle\oc4j1003\j2ee\home\application-deployments\Sachin-TradingEngineWS-WS\
WebServices\com\sachin\tradeengine\ws\Ping_Tie.java:57: ping(java.util.Date) in com.sachin.tradeengine.ws.Ping cannot be applied to (java.util.Calendar) _result = ((com.sachin.tradeengine.ws.Ping) getTarget()).ping
(myPing_Type.getDate_1());
^
1 error
04/03/23 17:17:35 Notification ==> Application Deployer for Sachin-TradingEngineWS-WS FAILED: java.lang.InstantiationException: Error compiling :E:\Oracle\oc4j1003\j2ee\home\applications\Sachin-TradingEngineWS-WS\WebServices: Syntax error in source [ 2004-03-23T17:17:35.937GMT+05:30 ]
I read somewhere that the conversion between java to xml datatype and vice versa fails for java.util.Date, so it is better to use java.util.Calendar. When I change the code to return a java.util.Calendar then the JDeveloper prompts me the following failure:
Method Ping: the following parameter types do not have an XML Schema mapping and/or serializer specified : java.util.Calendar.
This forces me to return a String data.
I would appreciate if someone can help me out.
Thanks
Sachin Mathias
Datamatics Ltd.Hi
I got the web service working with some work around. But I am not sure it this approach would be right and good.
I started altogether afresh. I did the following step :
1. Created an Interface (Ping.java) for use in web Service as follows :
public interface Ping extends Remote{
public java.util.Date ping(java.util.Date pingDateRequest)
throws RemoteException;
2. Implemented the above interface in PingImpl.java as follows :
public class PingImpl implements Ping
public java.util.Date ping(java.util.Date pingDateRequest) throws RemoteException {
System.out.println("PingImpl: ping() return datetime = " + pingDateRequest.toString());
return pingDateRequest;
3. Compiled the above 2 java files.
4. Generated a Stateless Java Web Service with the help of JDeveloper. This time the generation was sucessful.(If I had "java.util.Calendar" in place of "java.util.Date" in the java code of the above mentioned files the web service generation would prompt me for error)
5. After the generation of Web Service, I made modification to the Ping interface and its implementing class. In both the files I replaced "java.util.Date" with "java.util.Calendar". The modified java will look as follows :
Ping.Java
=========
public interface Ping extends Remote{
public java.util.Calendar ping(java.util.Calendar pingDateRequest)
throws RemoteException;
PingImpl.Java
================
public class PingImpl implements Ping
public java.util.Calendar ping(java.util.Calendar pingDateRequest) throws RemoteException {
System.out.println("PingImpl: ping() return datetime = " + pingDateRequest.toString());
return pingDateRequest;
6. Now I recompile both the java files.
7. Withour regenerating the Web Service I deploy the Web Service on OC4j 10.0.3 from JDeveloper. This time the deployment was sucessful.(The Deployment fails if I don't follow the step 5.)
8. Now I generated a Stub from JDeveloper and accessed the stub from a client. It works fine. Here if you see the Stub code it takes java.util.Date as a parameter and returns a java.util.Date. (Mind you I am accepting a java.util.Calendar and returning the same in my Web Service interface. Step 5)
The confusing thing is the Serialization and Deserialization of Data from Client java data to Soap message and Soap message to Server java data.
From Client to SOAP :
java.util.Date to datetime
From SOAP to Server :
datetime to java.util.Calendar
From Server to SOAP :
java.util.Calendar to datetime
From SOAP to Client :
datetime to java.util.Date (I am not able to understand this part of the conversion)
Any help or inputs would be appreciated.
Thanks
Sachin Mathias -
Error-java.util.ResourceBundle.throwMissingResourceException
hi all,
im implementing a report for reporting empty filder..
i got an error while running the report in portal.
i got this error..
unexpected error accessing report com.sap.km.reporting.SimpleReport@641ffc: java.util.MissingResourceException: Can't find bundle for base name com.sap.km.reporting.SimpleReport, locale en_IE
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:839)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:729)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:579)
at com.sap.km.reporting.SimpleReport.getDisplayName(SimpleReport.java:68)
at com.sapportals.wcm.repository.manager.reporting.monitor.ReportComponent$ReportWrapper.getDisplayName(ReportComponent.java:294)
at com.sapportals.wcm.repository.manager.reporting.types.RPReportHandler$DisplayNameGen.getProperty(RPReportHandler.java:160)
at com.sapportals.wcm.repository.manager.reporting.types.RPPropHandler.getProperties(RPPropHandler.java:110)
at com.sapportals.wcm.repository.manager.reporting.types.RPPropHandler.getProperties(RPPropHandler.java:143)
at com.sapportals.wcm.repository.manager.reporting.RPPropertyManager.getProperties(RPPropertyManager.java:89)
at com.sapportals.wcm.repository.ResourceImpl.internalGetProperties(ResourceImpl.java:3699)
at com.sapportals.wcm.repository.ResourceImpl.internalGetPropertiesExtended(ResourceImpl.java:1343)
at com.sapportals.wcm.repository.ResourceImpl.getProperties(ResourceImpl.java:1308)
at com.sapportals.wcm.repository.CollectionImpl.getChildren(CollectionImpl.java:383)
at com.sapportals.wcm.service.resourcelistfilter.cm.ResourceListFilter.getChildren(ResourceListFilter.java:425)
at com.sapportals.wcm.rendering.collection.cm.InternalTree.getChildren(InternalTree.java:1868)
at com.sapportals.wcm.rendering.collection.cm.InternalTree.getFirstCallOpenResources(InternalTree.java:1142)
at com.sapportals.wcm.rendering.collection.cm.InternalTree.getFirstCallOpenResources(InternalTree.java:1172)
at com.sapportals.wcm.rendering.collection.cm.InternalTree.buildNewTree(InternalTree.java:704)
at com.sapportals.wcm.rendering.collection.cm.InternalTree.renderTree(InternalTree.java:852)
at com.sapportals.wcm.rendering.collection.cm.InternalTree.render(InternalTree.java:546)
at com.sapportals.wcm.rendering.collection.cm.InternalTree.buildContent(InternalTree.java:2295)
at com.sapportals.wcm.control.util.components.base.BaseCompositeComponent.buildComposition(BaseCompositeComponent.java:196)
at com.sapportals.htmlb.AbstractCompositeComponent.preRender(AbstractCompositeComponent.java:33)
at com.sapportals.htmlb.Container.preRender(Container.java:118)
at com.sapportals.htmlb.Container.preRender(Container.java:118)
at com.sapportals.htmlb.Container.preRender(Container.java:118)
at com.sapportals.htmlb.Container.preRender(Container.java:118)
at com.sapportals.htmlb.AbstractCompositeComponent.preRender(AbstractCompositeComponent.java:34)
at com.sapportals.htmlb.Container.preRender(Container.java:118)
at com.sapportals.htmlb.Container.preRender(Container.java:118)
at com.sapportals.htmlb.Container.preRender(Container.java:118)
at com.sapportals.portal.htmlb.PrtContext.render(PrtContext.java:413)
at com.sapportals.htmlb.page.DynPage.doOutput(DynPage.java:237)
at com.sapportals.wcm.portal.component.base.KMControllerDynPage.doOutput(KMControllerDynPage.java:130)
at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:129)
at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
at com.sapportals.wcm.portal.component.base.ControllerComponent.doContent(ControllerComponent.java:73)
at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:646)
at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240)
at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)
at java.security.AccessController.doPrivileged(Native Method)
at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:160)
could anyone provide me a solution for this..
Regards,
VinothSee Error -Can't find bundle ,locale en_US
-
Unable to capture messages from java.util.logging
I have a class called (Caller.java) which invokes a method called foo from another java class(Util.java) using reflection API.Now this method foo logs messages using Java's logger.My requirement is to call foo for 3 times from Caller and capture/redirect the log messages into 3 log files.
But only the first log file is capturing the log messages(from logger) and other two are not ?
Plz suggest if I am doing somethin wrong here ?
Caller.java
package project2;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.lang.reflect.Method;
public class Caller {
public Caller() {
public static void main(String[] args) throws Exception {
Caller caller = new Caller();
for (int i = 0 ;i<3 ;i++ ) {
caller.createLogStream(i);
System.setOut(caller.getPs());
System.setErr(caller.getPs());
/*****************Invoking Util.java*****************************/
Class clas = Class.forName("project2.Util");
Method m = clas.getMethod("foo",null);
Object obj =clas.newInstance();
m.invoke(obj,null);
public void createLogStream(int i) throws FileNotFoundException {
ps = new PrintStream(new File(System.getenv("HOME")+File.separator+"MyLog"+i+".log"));
public void closeLogStream(){
ps.close();
ps = null;
private PrintStream ps = null;
public PrintStream getPs() {
return ps;
} Util.java
package project2;
import java.util.logging.Logger;
public class Util {
Logger logger = null;
public Util() {
logger = Logger.getLogger(this.getClass().getName());
public void foo(){
System.out.println("Hello out stream");
System.err.println("Hello error stream");
logger.info("This is an information");
logger.warning("This is a warning message");
logger.severe("This is fatal!! ");
}First Log file MyLog0.log:
Hello out stream
Hello error stream
Feb 16, 2009 7:55:55 PM project2.Util foo
INFO: This is an information
Feb 16, 2009 7:55:55 PM project2.Util foo
WARNING: This is a warning message
Feb 16, 2009 7:55:55 PM project2.Util foo
SEVERE: This is fatal!!
Feb 16, 2009 7:55:55 PM project2.Util foo
INFO: This is an information
Feb 16, 2009 7:55:55 PM project2.Util foo
WARNING: This is a warning message
Feb 16, 2009 7:55:55 PM project2.Util foo
SEVERE: This is fatal!!
Feb 16, 2009 7:55:55 PM project2.Util foo
INFO: This is an information
Feb 16, 2009 7:55:55 PM project2.Util foo
WARNING: This is a warning message
Feb 16, 2009 7:55:55 PM project2.Util foo
SEVERE: This is fatal!! Other 2 log files have only this much
Hello out stream
Hello error streamA stale Connection Factory or Connection Handle may be used in SOA 11g
Regards,
Anuj -
Using List Class in java.awt / java.util ?
have a program that:
import java.util.*;
List list = new LinkedList();
list = new ArrayList();
... read a file and add elements to array
use a static setter
StaticGettersSetters.setArray(list);
next program:
import java.awt.*;
public static java.util.List queryArray =
StaticGettersSetters.getArray();
If I don't define queryArray with the package and class, the compiler
gives an error that the List class in java.awt is invalid for queryArray.
If I import the util package, import java.util.*; , the compiler
gives an error that the list class is ambiguous.
Question:
If you using a class that exists in multiple packages, is the above declaration of queryArray the only way to declare it ?
Just curious...
Thanks for your help,
YAM-SSMSo what you have to do is explicitly tell the compiler which one you really want by spelling out the fully-resolved class name:
import java.awt.*;
import java.sql.*;
import java.util.*;
public class ClashTest
public static void main(String [] args)
java.util.Date today = new java.util.Date();
java.util.List argsList = Arrays.asList(args);
System.out.println(today);
System.out.println(argsList);
}No problems here. - MOD
Maybe you are looking for
-
Jdev 11.1.2.3.0 problem?
hi folks, just i know installed. jdev 11.1.2.3.0( Build JDEVADF_11.1.2.3.0_GENERIC_120914.0223.6276.1). as per video i followed. i cant able to see the mobile application in adf while creating a project. am scared. being long time taken to download.,
-
Hello everybody, I already purchased Laptopo with the following specifications: - HP Pavilion DV6-6160 SE Entertainment Notebook PC - Operating System is windows 7 64-bit - Error message : an error occurred while attempting to read the boot configura
-
HT201401 connecting to bluetooth automobile
I am having trouble connecting to bluetooth in a 2010 Prius with my new iphone 5
-
Need Help All Files in ACR look VERY Bad
The best way I can explain it is my RAW file's look like a GIF file. Mostly in the darker tones/shodows of the files. I have run some "process of elimination" tests to try to isolate where the challange is coming from. 1. Raw Files are stll good, I h
-
Invoke External Link on a Dialog Window
What's the easiest way of invoking an external link (ex: http://www.google.com) in a modal Dialog window. I want to achieve something like the select input text component, but for external links that in our case will be external applications. Do I ne