Java.util.zip Exception - please HELP!

I have a java program which updates some zip-jar files (in fact OpenOffice files).
It works fine on Window 2000 jdk 1.4.2,
but on Netware with jdk 1.4.2 at receive the exception like this:
java.util.zip.ZipException: invalid entry crc-32
( expected 0xffffffff543978 but got 0xec543978 )
What can be the problem? Any idea is mutch appreciated.
It makes me crazzy.

any idea? Thanks.

Similar Messages

  • Java.util.Zip Exception

    Hi All
    I am trying to deploy an ear which contains a session
    bean .I have added some jars to the ear which are required  for the hibernate.
    At the time of the deploying i am getting the follwing
    error
    Please giude me to solve this problem
    Thanks and Regards
    Satyam
    10/09/02 05:35:58 -  EAR file uploaded to server for 2781ms.
    10/09/02 05:43:12 -  ERROR: Not deployed. Deploy Service returned ERROR:
                         java.rmi.RemoteException: Error while getting the internal libraries of application sap.com/SampleHibernateEar in operation deploy..
                         Reason: The system cannot find the file specified; nested exception is:
                              java.util.zip.ZipException: The system cannot find the file specified
                              at com.sap.engine.services.deploy.server.DeployServiceImpl.deploy(DeployServiceImpl.java:478)
                              at com.sap.engine.services.deploy.server.DeployServiceImplp4_Skel.dispatch(DeployServiceImplp4_Skel.java:1555)
                              at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:294)
                              at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:183)
                              at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:119)
                              at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
                              at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
                              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:94)
                              at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
                         Caused by: java.util.zip.ZipException: The system cannot find the file specified
                              at java.util.zip.ZipFile.open(Native Method)
                              at java.util.zip.ZipFile.<init>(ZipFile.java:112)
                              at java.util.jar.JarFile.<init>(JarFile.java:127)
                              at java.util.jar.JarFile.<init>(JarFile.java:65)
                              at com.sap.engine.services.deploy.ear.jar.EARReader.getAdditionalLibrariesEntries(EARReader.java:788)
                              at com.sap.engine.services.deploy.server.application.DeployUtilTransaction.commonBegin(DeployUtilTransaction.java:281)
                              at com.sap.engine.services.deploy.server.application.DeploymentTransaction.begin(DeploymentTransaction.java:296)
                              at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:290)
                              at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhases(ApplicationTransaction.java:323)
                              at com.sap.engine.services.deploy.server.DeployServiceImpl.makeGlobalTransaction(DeployServiceImpl.java:3033)
                              at com.sap.engine.services.deploy.server.DeployServiceImpl.deploy(DeployServiceImpl.java:463)
                              ... 10 more
                         For detailed information see the log file of the Deploy Service.
    10/09/02 05:43:12 -  ***********************************************************
    Sep 2, 2010 5:43:12 AM   Info: End of log messages of the target system.
    Sep 2, 2010 5:43:12 AM   Info: ***** End of SAP J2EE Engine Deployment (J2EE Application) *****
    Sep 2, 2010 5:43:12 AM   Error: Aborted: development component 'SampleHibernateEar'/'sap.com'/'localhost'/'2006.09.01.17.09.15':
    Caught exception during application deployment from SAP J2EE Engine's deploy service:
    java.rmi.RemoteException: Error while getting the internal libraries of application sap.com/SampleHibernateEar in operation deploy..
    Reason: The system cannot find the file specified; nested exception is:
         java.util.zip.ZipException: The system cannot find the file specified
    (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)
    Sep 2, 2010 5:43:12 AM   Info: J2EE Engine is in same state (online/offline) as it has been before this deployment process.
    Sep 2, 2010 5:43:12 AM   Error: -
    At least one of the Deployments failed -

    Hi Satya,
    Does your EAR contain EJB jar from EJB project? You can try to open EAR file with zip and check.
    Best regards, Maksim Rashchynski.

  • Java.util.zip: how to save file type

    HI,
    I have a written a program that zips PDF files and sends them as an attachment via email. This have been running daily for the last 1.5 years with no problems. Recently, some email providers have been striping the attachments or refusing the email, because I have used two file suffix on the attachment, e.g report.pdf.zip. I did this so that when the file is unzipped the .pdf extension remains and file is recognised, otherwise the document is treated as plain text or unknown format. How can I include the filetype in the zipped file, so that I can have report.pdf become report.zip, then when the user unzips the file has report.zip become report.pdf. I know the filetype is stored in the zip header, but I don't know how to do this using java.util.zip. Any help would be appreciated.
    Mike

    You see, zip files are inherently dumb. They don't "actually" have a file system in the strictest sense. The zip file format merely associates a String ID with some bytes. It's all on the client side where the magic happens. if I have three zip entries in a file, these are the entry names.
    1.) somedir/myfile.txt
    2.) someotherdir/myfile.txt
    3.) README
    when a client "unzipper" see these names, it realizes that "/" is a directory separator, so it makes the appropriate directories and places the bytes into files of that given name.
    So all you should have to do is make the zip entry with a name that ends in .pdf The client should do the rest.

  • Java.util.zip.ZipException: invalid entry size error --  help required

    Hi all
    I am sure this error would have been posted many number of times, but I would really appreciate if someone could help me with my problem. I am working on reading data from a .zip file, which in it has ~5GB data. All I am performing is a read operation through the piece of code specified below. This code worked well for .zip files handling till ~2.5GB
    FileInputStream fis = new FileInputStream(filename);
    BufferedInputStream bis = new BufferedInputStream(fis);
    ZipInputStream zis = new ZipInputStream(bis);
    StreamTokenizer tok = new StreamTokenizer( zis );
    ZipEntry entry;
    while((entry = zis.getNextEntry()) != null)
    \\read from the zip file through the streamTokenizer
    I just print what I read through the program, on the console.
    But the error I get is
    java.util.zip.ZipException: invalid entry size (expected 4294967295 but got 2117536490 bytes)
    at java.util.zip.ZipInputStream.readEnd(Unknown Source)
    at java.util.zip.ZipInputStream.read(Unknown Source)
    at java.util.zip.InflaterInputStream.read(Unknown Source)
    at java.io.StreamTokenizer.read(Unknown Source)
    at java.io.StreamTokenizer.nextToken(Unknown Source)
    at ZipFileStreams.getMessages(ZipFileStreams.java:677)
    at ZipFileStreams.main(ZipFileStreams.java:814)
    Could anybody give me hints as to what am I missing and where am i going wrong. Any help would be appreciated.
    Thanks

    Hi,
    I get the same exception while reading a ZIP file. The size if the ZIP file is just 82KB but I am reading it over FTP not sure if it makes any difference. I am using JDK 1.4.2_05. Here is the code I am trying to execute.
    public class TestFTP {
    public static void main( String[] argv ) throws Exception {
    String inboundPath = "/transfer/inbound/";
    FTPClient ftp = new FTPClient();
    ftp.connect("123");
    ftp.login( "123", "123" );
    ftp.changeWorkingDirectory(inboundPath);
    FTPFile[] zipFiles = ftp.listFiles("*.zip");
    TelnetClient telnetClient;
    for(int i=0;i<zipFiles.length;i++){   
    System.out.println(zipFiles.getName());
    ZipInputStream zis = new ZipInputStream(ftp.retrieveFileStream(zipFiles[i].getName()));
    for (ZipEntry entry = zis.getNextEntry(); entry != null; entry = zis.getNextEntry()){           
    System.out.println(entry.getName());
    The error message is
    java.util.zip.ZipException: invalid entry size (expected 10291 but got 10233 bytes)
         at java.util.zip.ZipInputStream.readEnd(ZipInputStream.java:367)
         at java.util.zip.ZipInputStream.read(ZipInputStream.java:141)
         at java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:91)
         at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:69)
         at test.TestFTP.main(TestFTP.java:41)
    Exception in thread "main"
    Please let me know if you were able to fix the problem.
    Thanks

  • Java.util.zip.ZipException: Is a directory- weblogic exception comming

    I am getting following exception while deploying the web application in weblogic Enviornment, on Sun solaris 5.8, please help:
    <Jul 11, 2008 5:39:07 PM EDT> <Error> <J2EE> <BEA-160131> <Error deploying fotrd: with deployment error Could not load fotrd and nested error weblogic.management.DeploymentException: [HTTP:101062][ServletContext(id=175067,name=,context-path=/)] Error reading Web application "/export/enterprise-docs/fo2oli/citioliprodfix/po2trd/deploy/po2trd.ear/fotrd.war".
    java.util.zip.ZipException: Is a directory
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.><init>(ZipFile.java:111)
    at java.util.jar.JarFile.<init>(JarFile.java:127)
    at java.util.jar.JarFile.<init>(JarFile.java:65)
    at weblogic.servlet.internal.WebAppServletContext.getDescriptorLoader(WebAppServletContext.java:1443)
    at weblogic.servlet.internal.WebAppServletContext.<init>(WebAppServletContext.java:492)
    at weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:621)
    at weblogic.j2ee.WebAppComponent.deploy(WebAppComponent.java:121)
    at weblogic.j2ee.Application.addComponent(Application.java:322)
    at weblogic.j2ee.J2EEService.addDeployment(J2EEService.java:162)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:337)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:202)
    at weblogic.management.mbeans.custom.WebServer.addWebDeployment(WebServer.java:132)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:755)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:734)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:516)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
    at weblogic.management.internal.RemoteMBeanServerImpl.private_invoke(RemoteMBeanServerImpl.java:990)
    at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBeanServerImpl.java:948)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:948)
    at weblogic.management.internal.MBeanProxy.invokeForCachingStub(MBeanProxy.java:475)
    at weblogic.management.configuration.WebServerMBean_Stub.addWebDeployment(WebServerMBean_Stub.java:2596)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:289)
    at weblogic.management.mbeans.custom.DeploymentTarget.addDeployments(DeploymentTarget.java:597)
    at weblogic.management.mbeans.custom.DeploymentTarget.updateServerDeployments(DeploymentTarget.java:575)
    at weblogic.management.mbeans.custom.DeploymentTarget.updateDeployments(DeploymentTarget.java:241)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:755)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:734)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:516)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
    at weblogic.management.internal.RemoteMBeanServerImpl.private_invoke(RemoteMBeanServerImpl.java:990)
    at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBeanServerImpl.java:948)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:948)
    at weblogic.management.internal.MBeanProxy.invokeForCachingStub(MBeanProxy.java:475)
    at weblogic.management.configuration.ServerMBean_Stub.updateDeployments(ServerMBean_Stub.java:7731)
    at weblogic.management.deploy.slave.SlaveDeployer.updateServerDeployments(SlaveDeployer.java:1321)
    at weblogic.management.deploy.slave.SlaveDeployer.resume(SlaveDeployer.java:339)
    at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.resume(DeploymentManagerServerLifeCycleImpl.java:229)
    at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:136)
    at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:965)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:360)
    at weblogic.Server.main(Server.java:32)

    Could it be that you are trying to install from an exploded version of your war files? It looks like WebLogic thinks it's a war file but it seems to be a directory... You might try to rename those directories to anything that's not .war and .ear.

  • URGENT HELP about java.util.zip.ZipException: invalid entry CRC

    I have a program (JAVA of course) packet on JAR with fat-jar eclipse plugin. This program work well in all my computers except two. On these two computers I receive a java.util.zip.ZipException: invalid entry CRC.
    Both computers have the last version of java, but one is Windows and the other is Linux.
    Any help to find the source of this problem??
    Thanks in advance.

    Sorry, I give poor information about this problem.
    This is the full error showed when I execute this command: java -jar app.jar
    Unable to load resource: java.util.zip.ZipException: invalid entry CRC (expected 0x358054d7 but got 0x7dc370ba)
    java.util.zip.ZipException: invalid entry CRC (expected 0x358054d7 but got 0x7dc370ba)
    at java.util.zip.ZipInputStream.read(Unknown Source)
    at java.util.jar.JarInputStream.read(Unknown Source)
    at java.io.FilterInputStream.read(Unknown Source)
    at com.simontuffs.onejar.JarClassLoader.copy(JarClassLoader.java:818)
    at com.simontuffs.onejar.JarClassLoader.loadBytes(JarClassLoader.java:383)
    at com.simontuffs.onejar.JarClassLoader.loadByteCode(JarClassLoader.java:371)
    at com.simontuffs.onejar.JarClassLoader.loadByteCode(JarClassLoader.java:362)
    at com.simontuffs.onejar.JarClassLoader.load(JarClassLoader.java:305)
    at com.simontuffs.onejar.JarClassLoader.load(JarClassLoader.java:224)
    at com.simontuffs.onejar.Boot.run(Boot.java:224)
    at com.simontuffs.onejar.Boot.main(Boot.java:89)
    Exception in thread "main" java.lang.ClassNotFoundException: com.intarex.wizard.IWizard
    at com.simontuffs.onejar.JarClassLoader.findClass(JarClassLoader.java:497)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at com.simontuffs.onejar.Boot.run(Boot.java:240)
    at com.simontuffs.onejar.Boot.main(Boot.java:89)
    app.jar is a JAR file created with fat-jar eclipse plugin, to make easier to generate a JAR file with all dependencies.
    I think that is not a code related problem, because this program is executed in several computers without errors.
    I trasport this JAR to the client computer via HTTP.
    I'm trying to find clues to find the origin of this problem.
    Thanks.

  • Webb Exception - java.util.zip.ZipException: error in opening zip file

              I am tring to run my Servlet with myWAR.war. So I started first installing the CookieCounter example that came with weblogic, I did exactly as the document said but I getting the following exception:
              Thu Jan 04 11:26:45 MST 2001:<E> <HTTP> Error reading Web application '/weblogic/myserver/cookieWar.war'
              java.util.zip.ZipException: error in opening zip file
              at java.util.zip.ZipFile.open(Native Method)
              at java.util.zip.ZipFile.<init>(ZipFile.java:69)
              at weblogic.utils.jar.JarFile.<init>(JarFile.java:57)
              at weblogic.utils.jar.JarFile.<init>(JarFile.java:44)
              at weblogic.t3.srvr.HttpServer.loadWARContext(HttpServer.java:582)
              at weblogic.t3.srvr.HttpServer.initServletContexts(HttpServer.java, Compiled Code)
              at weblogic.t3.srvr.HttpServer.start(HttpServer.java:388)
              at weblogic.t3.srvr.T3Srvr.start(T3Srvr.java, Compiled Code)
              at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:827)
              at java.lang.reflect.Method.invoke(Native Method)
              at weblogic.Server.startServerDynamically(Server.java:99)
              at weblogic.Server.main(Server.java:65)
              at weblogic.Server.main(Server.java:55)
              at weblogic.NTServiceHelper.run(NTServiceHelper.java:19)
              at java.lang.Thread.run(Thread.java:479)
              Has anybody encountered the problem before I created the jar using jar cvf cookieWar.war cookie- under the command line
              

    I have seen problems like this in the past. When you create your war file, try using "jar
              cv0f" so that the jar file won't be compressed...
              mark bouchard wrote:
              > I am having this same error... the strange thing is i have two different ear files...
              > one of them works, the other doesn't. there are NO differences between them according
              > to Araxis Merge... both will deploy, and both show servlets as being registered,
              > but i can only call the servlets from one...
              >
              > what is BEA's suggested way of creating an ear file? on NT and on UNIX please....
              >
              > use the java.util.zip methods? or use a utility like jar or winzip? Personally,
              > i've found this deployment to be HIGHLY flakey at best.... my same ear files
              > deploy perfectly with iPlanet's app server.
              >
              > Mark Spotswood <[email protected]> wrote:
              > >I think this is basically the same as a file not found error.
              > >The error message says it can't open the file. Its looking
              > >for the file under: /weblogic/myserver/cookieWar.war
              > >Make sure the file is in that directory/readable, etc.
              > >--
              > >mark
              > >
              > >Paul Garduno wrote:
              > >
              > >> Just to let you know, I am getting the same error message. I haven't
              > >worked on it but hope to at some point. I would like to know if the
              > >Weblogic people have seen this error.
              > >>
              > >> Paul Garduno
              > >>
              > >> bionic99 wrote:
              > >>
              > >> > I am tring to run my Servlet with myWAR.war. So I started first installing
              > >the CookieCounter example that came with weblogic, I did exactly as
              > >the document said but I getting the following exception:
              > >> > Thu Jan 04 11:26:45 MST 2001:<E> <HTTP> Error reading Web application
              > >'/weblogic/myserver/cookieWar.war'
              > >> > java.util.zip.ZipException: error in opening zip file
              > >> > at java.util.zip.ZipFile.open(Native Method)
              > >> > at java.util.zip.ZipFile.<init>(ZipFile.java:69)
              > >> > at weblogic.utils.jar.JarFile.<init>(JarFile.java:57)
              > >> > at weblogic.utils.jar.JarFile.<init>(JarFile.java:44)
              > >> > at weblogic.t3.srvr.HttpServer.loadWARContext(HttpServer.java:582)
              > >> > at weblogic.t3.srvr.HttpServer.initServletContexts(HttpServer.java,
              > >Compiled Code)
              > >> > at weblogic.t3.srvr.HttpServer.start(HttpServer.java:388)
              > >> > at weblogic.t3.srvr.T3Srvr.start(T3Srvr.java, Compiled Code)
              > >> > at weblogic.t3.srvr.T3Srvr.main(T3Srvr.java:827)
              > >> > at java.lang.reflect.Method.invoke(Native Method)
              > >> > at weblogic.Server.startServerDynamically(Server.java:99)
              > >> > at weblogic.Server.main(Server.java:65)
              > >> > at weblogic.Server.main(Server.java:55)
              > >> > at weblogic.NTServiceHelper.run(NTServiceHelper.java:19)
              > >> > at java.lang.Thread.run(Thread.java:479)
              > >> >
              > >> > Has anybody encountered the problem before I created the jar using
              > >jar cvf cookieWar.war cookie- under the command line
              > >
              

  • Re: RE: Re: Webb Exception - java.util.zip.ZipException: error in opening zip

    Instead of uploading the servlet via the WL Console, try FTPing it into the
              applications directory and starting up WL
              "robert wright" <[email protected]> wrote in message
              news:3b96bd64$[email protected]..
              > I am having this problem as well has anyone found a solution?
              

    I have the same problem using FTP and hotdeploy, when i try to upload the application, half of the times it fails with the "error in opening zip file
              at java.util.zip.ZipFile.open(Native Method)
              at java.util.zip.ZipFile.<init>(Unknown Source)"
              I dont know why it happens, it seemed that was needed more space, but now, it has enough space for everything in everywhere...
              Has anybody another idea?
              

  • Help Immediately -  java.util.zip.ZipException

    We are migrating EP6 SP2 P5 to NW04 on Unix HP-UX 11.11.
    We immediately launched the KMC migration and it comes up and the hour glasses endlessly. 
    We are migration the customers Production system and need some ideas of what might be wrong ASAP.
    Thanks - Here are the lines of the log files:
    1123871674779#INFO.- Reports button clicked at MainMigrationFrame
    1123871674781#INFO.- SAP System Name is
    1123871674781#INFO.- using tool version 6.90.20050627170305.0000/2693
    1123871674781#INFO.- using system installation at /usr/sap
    1123871674785#INFO.- Processing migration info
    1123871674820#INFO.- java.util.zip.ZipException: oversubscribed dynamic bit lengths tree

    folks if you get this error, it means your input file was not copied in binary mode.  Our mistake.

  • What cause this error: java.util.zip.ZipException: invalid literal/lengths?

    Hi all,
    Our application produces this error in the logs: (our JDEV is 11.1.1.4.0, WLS 10.3)
    org.apache.myfaces.trinidadinternal.renderkit.core.CoreResponseStateManager _restoreSerializedView
    SEVERE:
    java.util.zip.ZipException: invalid literal/lengths set
    at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:147)
    at java.util.zip.GZIPInputStream.read(GZIPInputStream.java:92)
    at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2266)
    at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2279)
    at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2750)
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:780)
    at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
    I have googled this error for hours and search the forum here, but no luck. Can someone please shed some light on this error? Thanks in advance!
    Shawn

    Hi Shawn,
    Please refer the below thing i found. Hope this may help you in moving forward in resolving. I hope this issue has occured when you are deploying your application WAR.
    ======================================================================================
    Method: read()
    Class: at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:147)
    The above class comes in your exception hierarchy above.
    Reads uncompressed data into an array of bytes. This method will block until some input can be decompressed.
    Throws:
    ZipException - if a ZIP format error has occurred
    ====================================
    This also points that your WAR file is corrupt.
    Class: GZIPInputStream
    IOException - if an I/O error has occurred or the compressed input data is corrupt
    Thanks,

  • Error in deploying p6.ear on WebLogic: java.util.zip.ZipException: invalid entry CRC

    Hello,
    We're trying to install Primavera EPPM 8.3 and test it on our server but having troubles in deploying p6 application.
    We have successfully installed the following prerequisites:
    - WebLogic 11g
    - JDK1.7.0_45 and setting JAVA_HOME path=C:\Program Files\Java\jdk1.7.0_45 in enviornmental variables
    - Downloading wsdl4j-1.6.2.jar for web services
    - Running the setup.exe file (located in PEPPM path\Disk1\install\setup.exe
    - Successfully finished the setup and running the Configuration Wizard.
    - Successfully created the database using Microsoft SQL Server 2008 database
    - Successfully creating a new WebLogic domain.
    - We didn't install BI publisher nor any content repository ( would this affect running the primavera application? )
    - In the configuration wizard summary we can see everything is marked successfully except the "Start Web Logic" step it showed an error and a message indicating that we should start it manually ( however, the domain is successfully created ).
    Next, we run the startWebLogic.cmd file in our new created domain, then we run startNodeManager.cmd from WebLogic common/bin directory.
    We can access the WebLogic administration panel successfully but no "p6" application in the deployments.
    So, we click "install" then open the p6 directory and deploy it without errors.
    But when when starting the P6 server and then try to start p6 application, it failed with the following error message:
    java.util.zip.ZipException: invalid entry CRC (expected 0xa0a67af0 but got 0xef73b950)
    Can you please help us to solve this? Please note that every other deployment is running correctly except p6.

    The cause of errors was a dying Westen Digital drive, specially the 48G partition reserved only for $ORACLE_BASE (/dev/sdb3 mounted on /opt/oracle).
    A simple quick scan of unmounted partition (badblocks -v /dev/sdb3) reported more than thousand new bad blocks (compared to the last scan six months ago). Although I strongly believe, specially in the case of WDC drives, that the best utility to "repair" bad blocks is the one that opens a window and prints the message: "Go to the nearest shop and buy a new drive", I was very curious to prove my suspicion just on this drive. After zero-filling the partition with dd, then formatting it (mke2fs -cc) and mounting again, the 11g installation and database creation (on the same partition) successfully completed, performing fast and smoothly. To make sure it was not a casual event, I repeated the installation once again with full success. The database itself is working fine (by now). Well, the whole procedure took me more than four hours, but I'm pretty satisfied. I learned once again - stay away from Western Digital. As Oracle cannot rely on dying drive, my friend is going tomorrow to spend a 150+ euro on two 250G Seagate Barracudas and replace both WDC drives, even though the first drive seems to be healthy.
    In general there is no difference between loading correct data from good disk into bad memory and loading the incorrect data from dying disk into good memory. In both cases the pattern is damaged. For everyone who runs into the problem similar to this, and the cause cannot be easily determined, the rule of thumb must be:
    1. test memory and, if it shows any error, check sockets and test memory modules individually
    2. check disks for bad blocks regardless of the result of memory testing
    Therefore I consider your answer being generally correct.
    Regards
    NJ

  • Cannot extract Zip file with Winzip after zipping with java.util.zip

    Hi all,
    I write a class for zip and unzip the text files together which can be zip and unzip successfully with Java platform. However, I cannot extract the zip file with Winzip or even WinRAR after zipping with Java platform.
    Please help to comment, thanks~
    Below is the code:
    =====================================================================
    package myapp.util;
    import java.io.* ;
    import java.util.TreeMap ;
    import java.util.zip.* ;
    import myapp.exception.UserException ;
    public class CompressionUtil {
      public CompressionUtil() {
        super() ;
      public void createZip(String zipName, String fileName)
          throws ZipException, FileNotFoundException, IOException, UserException {
        FileOutputStream fos = null ;
        BufferedOutputStream bos = null ;
        ZipOutputStream zos = null ;
        File file = null ;
        try {
          file = new File(zipName) ; //new zip file
          if (file.isDirectory()) //check if it is a directory
         throw new UserException("Invalid zip file ["+zipName+"]") ;
          if (file.exists() && !file.canWrite()) //check if it is readonly
         throw new UserException("Zip file is ReadOnly ["+zipName+"]") ;
          if (file.exists()) //overwrite the existing file
         file.delete();
          file.createNewFile();
          //instantiate the ZipOutputStream
          fos = new FileOutputStream(file) ;
          bos = new BufferedOutputStream(fos) ;
          zos = new ZipOutputStream(bos) ;
          this.writeZipFileEntry(zos, fileName); //call to write the file into the zip
          zos.finish() ;
        catch (ZipException ze) {
          throw ze ;
        catch (FileNotFoundException fnfe) {
          throw fnfe ;
        catch (IOException ioe) {
          throw ioe ;
        catch (UserException ue) {
          throw ue ;
        finally {
          //close all the stream and file
          if (fos != null)
         fos.close() ;
          if (bos != null)
         bos.close();
          if (zos != null)
         zos.close();
          if (file != null)
         file = null ;
        }//end of try-catch-finally
      private void writeZipFileEntry(ZipOutputStream zos, String fileName)
          throws ZipException, FileNotFoundException, IOException, UserException {
        BufferedInputStream bis = null ;
        File file = null ;
        ZipEntry zentry = null ;
        byte[] bArray = null ;
        try {
          file = new File(fileName) ; //instantiate the file
          if (!file.exists()) //check if the file is not exist
         throw new UserException("No such file ["+fileName+"]") ;
          if (file.isDirectory()) //check if the file is a directory
         throw new UserException("Invalid file ["+fileName+"]") ;
          //instantiate the BufferedInputStream
          bis = new BufferedInputStream(new FileInputStream(file)) ;
          //Get the content of the file and put into the byte[]
          int size = (int) file.length();
          if (size == -1)
         throw new UserException("Cannot determine the file size [" +fileName + "]");
          bArray = new byte[(int) size];
          int rb = 0;
          int chunk = 0;
          while (((int) size - rb) > 0) {
         chunk = bis.read(bArray, rb, (int) size - rb);
         if (chunk == -1)
           break;
         rb += chunk;
          }//end of while (((int)size - rb) > 0)
          //instantiate the CRC32
          CRC32 crc = new CRC32() ;
          crc.update(bArray, 0, size);
          //instantiate the ZipEntry
          zentry = new ZipEntry(fileName) ;
          zentry.setMethod(ZipEntry.STORED) ;
          zentry.setSize(size);
          zentry.setCrc(crc.getValue());
          //write all the info to the ZipOutputStream
          zos.putNextEntry(zentry);
          zos.write(bArray, 0, size);
          zos.closeEntry();
        catch (ZipException ze) {
          throw ze ;
        catch (FileNotFoundException fnfe) {
          throw fnfe ;
        catch (IOException ioe) {
          throw ioe ;
        catch (UserException ue) {
          throw ue ;
        finally {
          //close all the stream and file
          if (bis != null)
         bis.close();
          if (file != null)
         file = null ;
        }//end of try-catch-finally
    }

    Tried~
    The problem is still here~ >___<
    Anyway, thanks for information sharing~
    The message is:
    Cannot open file: it does not appear to be a valid archive.
    If you downloaded this file, try downloading the file again.
    The problem may be here:
    if (fos != null)
    fos.close() ;
    if (bos != null)
    bos.close();
    if (zos != null)
    zos.close();
    if (file != null)
    file = null ;
    The fos is closed before bos so the last buffer is not
    saved.
    zos.close() is enough.

  • 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,
    Chiranjit

    this 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

  • Error(5): java.util.zip.ZipException: invalid entry size (expected 2875 but

    Hi all!
    I'm getting this error when I try to execute my application in JDeveloper: Error(5): java.util.zip.ZipException: invalid entry size (expected 2875 but got 2845 bytes)
    This started to happen after I had checkout my application to CVSNT.
    Any help?
    P.S. I'm using JDeveloper 10.1.3 with CVSNT 2.5

    My cvswrappers file (CVSNT):
    *.cab -kb
    *.class -kb
    *.doc -kb
    *.dll -kb
    *.ear -kb
    *.exe -kb
    *.exp -kb
    *.fla -kb
    *.gif -kb
    *.gz -kb
    *.jar -kb
    *.jpg -kb
    *.jpeg -kb
    *.lib -kb
    *.msi -kb
    *.mso -kb
    *.pdf -kb
    *.pfw -kb
    *.png -kb
    *.ppt -kb
    *.sit -kb
    *.swf -kb
    *.tar -kb
    *.tlb -kb
    *.vsd -kb
    *.xls -kb
    *.war -kb
    *.wmz -kb
    *.zip -kb Via Tortoise client I can add and commit zip (jar) files in binary format and everything is OK.
    If I do that via Jdev, anybody who checkout that module from cvs have zip exception, because JDev didnt sent in binary format. How to setup that?
    Thanx
    Message was edited by:
    vpetreski

  • Java.util.zip.ZipException Error

    I created a jar file, and put in C:\tools
    C:\tools>java -jar myjar.jar is working fine
    However, if I try to run myjar.jar in other directories, then I have problems.
    I already set the classpath:
    SET CLASSPATH=.;%CLASSPATH%;C:\tools\myjar.jar;
    Here's the error. Any ideas???
    C:\>java -jar myjar.jar
    Exception in thread "main" java.util.zip.ZipException: The system cannot find th
    e file specified
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:112)
    at java.util.jar.JarFile.<init>(JarFile.java:117)
    at java.util.jar.JarFile.<init>(JarFile.java:55)

    You always need to specify a proper file name when you use the -jar switch. If you are not in c:\tools you have to run with "java -jar c:\tools\myjar.jar".
    Setting the classpath in particular doesn't help becuase the file name given to the -jar switch will override all settings for classpath. http://java.sun.com/j2se/1.4/docs/tooldocs/findingclasses.html#userclass
    But since you now have myjar.jar in your classpath, you can run the application from any directory with "java your.main.ClassName" :)

Maybe you are looking for

  • Simple button applet help

    ok, i'm working on a project involving buttons, and i finished it and it compiles fine, but when i run the applet (using textpad), nothign shows up. i decided to make a new applet of only the frame and buttons, and i got the same problem. here is the

  • I cannot modify the condition value or delete the condition in po.

    Dear All, My client created a PO and completed the GR, IR steps. Then she realized that something wrong in the pricing. Then she reversed the IR and GR documents. She still cannot be able to modify a condition type in PO. The field to delete for cond

  • JMS Sender Channel: Linked Error

    Hi All, I'm working on a synchronous JMS to Proxy scenario. I have created Sender JMS channel. In RWB, the status of the channel is error. The error is: Channel Error occured. Detailed error (if any): JMS error: MQJMS1024: session closed, Linked erro

  • Default selection of link bar control

    Hi All, I have a problem in my application. I have a link bar control in my app for navigation. And i want to make it selected without clicking an indiviual item. I dispetched a item click event of link bar manually, it works properly and it navigate

  • Button navigation... Again.

    I have 3 buttons inside a movieclip, which I want to navigate to the main timeline. For one of the buttons, this is the code in the timeline: homeheading.whyroll_btn.addEventListener(MouseEvent.CLICK, gotoNextFrame); function gotoNextFrame (evt: Mous