tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "siegfried" <siegfr...@heintze.com>
Subject RE: Module with moduleId "hello.jar" does not exist.
Date Sat, 23 May 2009 23:08:25 GMT
Sorry for the spam! I had to go to the archives to find David's first
response because it was not in my in box and not in my spam filter
either!

I can deploy just fine now -- at leaset with the hello world
example. To undeploy, however, I have to stop the server and delete
the jar file manually which is tedious!

I moved the location of the server and modified the source code
accordingly. See below for the source and output.

> -----Original Message-----
> From: David Blevins [mailto:david.blevins@visi.com] 
> Sent: Friday, May 22, 2009 12:39 PM
> To: users@openejb.apache.org
> Subject: Re: Module with moduleId "hello.jar" does not exist.
> 
> Going to answer this in your first email regarding not being able to
deploy.
> 
> -David


---output----
Apps path is ok:
C:\cygwin\home\Administrator\openejb.apache.org_ejb3-tutorial\standalone-ser
ver\openejb-3.1\apps  - hello.jar Write and delete ok:
C:\cygwin\home\Administrator\openejb.apache.org_ejb3-tutorial\standalone-ser
ver\openejb-3.1\apps\test.txt Write and delete ok:
C:\cygwin\home\Administrator\openejb.apache.org_ejb3-tutorial\standalone-ser
ver\openejb-3.1\apps\hello.jar ---source----
import java.io.*;
import java.text.*;
import java.util.Date;


/*
 * Begin commands to execute this file using Java with bash
 * if [ `uname` == 'Linux' ]
 * then
 * export CLASSPATH=bin:.
 * else
 * export CLASSPATH=bin\;.
 * fi
 * if [ -e "bin" ]
 * then
 * echo "already have build (bin) directory"
 * else
 * echo "mkdir bin"
 * mkdir bin
 * fi
 * javac -g WriteCheck.java -d bin
 * java  WriteCheck 
 * rm bin/WriteCheck.class
 * End commands to execute this file using Java with bash
 *
 */


public class WriteCheck {

  public static void main(String[] args) throws Exception {

    String[] dirs = {"cygwin", "home", "Administrator",
"openejb.apache.org_ejb3-tutorial", "standalone-server", "openejb-3.1",
"apps"}; 

    File appsPath = new File("C:");

    // Check each part of the path individually
    for (String dir : dirs) {
      appsPath = new File(appsPath, dir);
      if (!appsPath.exists()) throw new Fail("Does not exist: " +
appsPath.getPath()); if (!appsPath.isDirectory()) throw new Fail("Is not a
directory: " + appsPath.getPath()); 
    }

    System.out.println("Apps path is ok: " + appsPath.getPath());

    // List the files in the apps dir
    for (String s : appsPath.list()) {
      System.out.println(" - " + s);
    }

    // Attempt to write a couple files to the apps dir
    writeAndDelete(appsPath, "test.txt");

    writeAndDelete(appsPath, "hello.jar");

  }

  private static void writeAndDelete(File appsPath, String fileName) throws
Exception { 
    File file = new File(appsPath, fileName);
    OutputStream out = new FileOutputStream(file);
    try {
      // Write something simple like the date and time
      DateFormat df = SimpleDateFormat.getDateTimeInstance();
      out.write(df.format(new Date()).getBytes());
      out.flush();
    } catch (IOException e) {
      throw new Fail("Cannot write to file: "+file.getPath(), e);
    } finally {
      out.close();
    }

    try {
      file.delete();
    } catch (Exception e) {
      throw new Fail("Cannot delete file: "+ file.getPath(), e);
    }

    System.out.println("Write and delete ok: "+file.getPath());
  }

  public static class Fail extends Exception {
    public Fail(String message, Throwable cause) {
      super(message, cause);
    }

    public Fail(String message) {
      super(message);
    }
  }
}

Mime
View raw message