users@glassfish.java.net

[gf-users] Re: EJB module uses remote interface in a different JAR

From: Will Hartung <willh_at_mirthcorp.com>
Date: Wed, 25 Feb 2015 17:03:33 -0800

Put the interface in to a separate library jar file.

Bundle the EJB jar and library jar file together in to an EAR file,
and deploy that.

Then use the library jar file in the client. For example, if it's a
WAR client, just put it in it lib folder.

You do not want to be putting application libraries in to the
Glassfish classpaths.


On Wed, Feb 25, 2015 at 4:32 PM, William <streetpoet_at_163.com> wrote:
> for my own opinion, you must copy compiled interface classes(not impl) into your own jar thus you can use remote ejb directly in your code by using @EJB annotation.
> of course the remote ejb should be deployed on glassfish before.
>
> William
> 2015/2/26
>
>> On Feb 26, 2015, at 7:46 AM, thufir <hawat.thufir_at_gmail.com> wrote:
>>
>> The EJB module I built uses a remote interface. Because that remote interface is in a different JAR, that library JAR containing the interface must be placed in Glassfish first so that the EJB module (JAR) can find the library? Or, rather, so that Glassfish can find that library for the EJB.
>>
>> I'm getting an error:
>>
>> Error in annotation processing: {0}.
>> java.lang.NoClassDefFoundError: net/bounceme/doge/greeter/ejb/GreeterRemote
>>
>>
>> which I take to mean that Glassfish cannot find the class GreeterRemote because it's not on the classpath...for the EJB?
>>
>> How do I add the library to glassfish for the EJB?
>>
>>
>> I googled and found:
>>
>> http://www.coderanch.com/t/507913/EJB-JEE/java/Glassfish-return-java-lang-NoClassDefFoundError
>>
>> which I think is the exact problem, but that solution didn't seem to work for me; he puts the library JAR in:
>>
>> <glassfish_home>/domains/domain1/lib
>>
>>
>> I don't mind reading the glassfish manuals, but thought I'd ask here before digging through them.
>>
>>
>>
>> thanks,
>>
>> Thufir
>
>

-- 
This message, and any documents attached hereto, may contain confidential 
or proprietary information intended only for the use of the addressee(s) 
named above or may contain information that is legally  privileged. If you 
are not the intended addressee, or the person responsible for delivering it 
to the intended addressee, you are hereby notified that reading, 
disseminating, distributing or copying this message is strictly prohibited. 
If you have received this message by mistake, please immediately notify us 
by replying to the message and delete the original message and any copies 
immediately thereafter.  Thank you for your cooperation.