-- xxxxxxxxxxxxxxxxxxxxxxxx Scott Stark Chief Technology Officer JBoss Group, LLC xxxxxxxxxxxxxxxxxxxxxxxx
George Icriverzi wrote:
The CService is packaged in a sar archive along with the jboss-service.xml descriptor.
The sar is put in a jar, and in the jar I have also other classes and descriptors.
The jar, application.xml and jboss-app.xml are packaged in an ear. Anyway the jboss-app.xml is empty, and application.xml mentions the jar :
<module> <ejb>ca.jar</ejb> </module>
Why was this working with jboss-3.0.7 ?
import java.io.FileInputStream; import java.util.Enumeration; import java.util.Iterator; import java.util.jar.Attributes; import java.util.jar.JarFile; import java.util.jar.Manifest; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipInputStream;
/** A little utility that displays the contents of composite jars
*
* @author [EMAIL PROTECTED]
* @version $Revision: 1.2 $
*/
public class ListJar
{
static String[] jarSuffixes = {
".jar", ".zip", ".ear", ".war", ".sar"
};
static String jarPrefix = "+- ";
static String entryPrefix = "| ";
static byte[] buffer = new byte[65535];
static boolean showOnlyArchives = false;
static
{
for(int i = 0; i < 10; i ++)
{
jarPrefix += "+- ";
entryPrefix += "| ";
}
}
static boolean isJar(String name)
{
boolean isJar = false;
for(int s = 0; isJar == false && s < jarSuffixes.length; s ++)
{
String suffix = jarSuffixes[s];
isJar |= name.endsWith(suffix);
}
return isJar;
}
static void processEntry(ZipInputStream zis, ZipEntry entry, int level) throws
Exception
{
String name = entry.getName();
boolean isDirectory = entry.isDirectory();
if( isDirectory == true )
return;
// See if this is a jar archive
if( isJar(name) )
{
System.out.print(jarPrefix.substring(0, 3*level));
System.out.println(name+" (archive)");
try
{
ZipInputStream entryZIS = new ZipInputStream(zis);
processJar(entryZIS, ++ level);
}
catch(Exception e)
{
e.printStackTrace();
}
}
else if( name.endsWith("MANIFEST.MF") )
{
System.out.print(entryPrefix.substring(0, 3*(level-1)));
System.out.print("+- ");
System.out.print(name);
Manifest mf = new Manifest(zis);
Attributes main = mf.getMainAttributes();
String cp = main.getValue(Attributes.Name.CLASS_PATH);
if( cp != null )
{
System.out.print(" Class-Path: ");
System.out.print(cp);
System.out.print(' ');
}
System.out.println();
}
else if( showOnlyArchives == false )
{
System.out.print(entryPrefix.substring(0, 3*(level-1)));
System.out.print("+- ");
System.out.println(name);
}
}
static void processJar(ZipInputStream zis, int level) throws Exception
{
ZipEntry entry;
while( (entry = zis.getNextEntry()) != null )
{
processEntry(zis, entry, level);
}
}
/** List the jar contents
* @param args the command line arguments
*/
public static void main(String[] args) throws Exception
{
String name = args[0];
JarFile jarFile = new JarFile(name);
Manifest mf = jarFile.getManifest();
FileInputStream fis = new FileInputStream(name);
ZipInputStream zis = new ZipInputStream(fis);
System.out.println(name);
processJar(zis, 1);
System.out.println("Done");
}
}
