users@glassfish.java.net

Re: GF 3.1.1: Deployment Error for JEE 1.4 style EJB module

From: Hong Zhang <hong.hz.zhang_at_oracle.com>
Date: Wed, 19 Oct 2011 11:20:04 -0400

Hi, Bernhard
   At the end of that section, it says:
Top level JAR files that are processed by a deployment tool should not
contain Class-Path entries; such entries would, by definition, reference
other files external to the deployment unit. A deployment tool is not
required to process such external references.

  So you can use this mechanism when the ejb module is inside ear, but
not when it's a standalone module.

  Unfortunately there is no standard way of packaging library jars
inside the standalone ejb jar today (unlike for WEB, there is
WEB-INF/lib). The only current portable way of packaging library jars
for standalone ejb jar is to make it an ear. We have provided this
feedback to the spec lead already, hopefully there will be something
standard for this in the next version of the spec.

   Thanks,

- Hong


On 10/19/2011 3:41 AM, Bernhard Thalmayr wrote:
> Hi Hong, would you mind explaining how an EJB-JAR has to be created
> including 'bundled libraries'
>
> I read the following section (8.2.1) of JEE 5 specification
>
> "A JAR format file (such as a .jar file, .war file, or .rar file) may
> reference a .jar file or directory by naming the referenced .jar file
> or directory in a Class-Path header in the referencing JAR file’s
> Manifest file. The referenced .jar file or directory is named using a
> URL relative to the URL of the referencing
> JAR file. The Manifest file is named META-INF/MANIFEST.MF in the JAR
> file. The Class-Path entry in the Manifest file is of the form
> Class-Path: list-of-jar-files-or-directories-separated-by-spaces"
>
> If I interpret this correctly the following would be ok ....
>
> META-INF/
> META-INF/MANIFEST.MF
> META-INF/ejb-jar.xml
> META-INF/sun-ejb-jar.xml
> ejb1.jar (including META-INF/MANIFEST.MF with Class-Path: utility.jar)
> utility.jar
>
>
> If I run 'verifier' tool for the EJB-JAR it shows
> 'ClassNotFoundException' for the class mentioned in ejb-jar as value
> for 'ejb-class'.
>
> Thanks a lot for your guidance.
>
> Regards,
> Bernhard
>
> On Sat, Oct 15, 2011 at 3:10 AM, Hong Zhang <hong.hz.zhang_at_oracle.com
> <mailto:hong.hz.zhang_at_oracle.com>> wrote:
>
> Please see the deploy man page for compatibility property.
>
> http://download.oracle.com/docs/cd/E18930_01/html/821-2433/deploy-1.html#scrolltoc
>
> Since 3.*, we started to enforce jar visibility rules of Java EE
> spec to encourage the writing of portable application. Including
> library jars inside standalone ejb jar is not a portable packaging
> specified by the Java EE spec, so we no longer support that by
> default. But we support it through the compatibilty flag for
> product backward compatibility.
>
> - Hong
>
>
> On 10/14/2011 3:19 AM, Bernhard Thalmayr wrote:
>
> Thanks for the pointer Hong,
>
> the ejb-jar looks as follows ...
>
> META-INF/
> META-INF/MANIFEST.MF
> META-INF/ejb-jar.xml
> META-INF/sun-ejb-jar.xml
> com.test
> com.test....(EJB-related class-files)
> utilities.jar
>
> MANIFEST.MF has
> Class-Path: utilities.jar
>
> I created this EJB module using NB 6.9.1
>
> Deployment works using the 'compatibility flag'.
>
> I tried to read most of the related documentation ... would
> you mind pointing me to the one I obviously have not read?
>
> Thanks again,
> Bernhard
>
> On 10/13/2011 10:33 PM, Hong Zhang wrote:
>
> Where is the utility.jar packaged in the ejb module?
>
> Try to deploy the ejb jar with the compatibility flag to
> see if it makes
> a difference:
> asadmin deploy --property compatibility=v2 foo.jar
>
> Bernhard Thalmayr wrote:
>
> Hi experts,
> I'm trying to deploy a simple EJB module (consisting
> of a basic
> stateless session bean).
>
> The stateless session bean uses a class from an
> utility jar, packaged
> into the module.
>
> When trying to deploy it using 'asadmin' I get the error
>
> "remote failuer: Error occured during deployment:
> Exception while
> loading the app : EJB Container initialization error.
> Please see
> server.log for more details."
>
> Unfortunately there's no information in the server.log
> at all.
>
> Even if I set loglevel for '....container.ejb' and
> '...tools.deployment' to 'FINER' nothing shows up in
> the log.
>
> I suspect it's a classloading issue.
>
> If put the following entry in MANIFEST.MF
>
> "Class-Path: <utility-jar>"
>
> Any pointers available?
>
> TIA,
> Bernhard
>
>
>
>
>
>