users@glassfish.java.net

Re: AppClient/JWS/Derby/Security problems

From: Tim Quinn <Timothy.Quinn_at_Sun.COM>
Date: Fri, 08 Sep 2006 15:47:34 -0500

Martin, Ray wrote:
> Should i set EntityManagerFactory in my main class, then inject the static
> class down through each object until arriving at the class (DataAccessImpl)
> where EntityManagerFactory will be used to create an EntityManager?
>
That's one way. It certainly makes explicit where the factory will be
used. It does create "tramp data," information passed as an argument to
a method that doesn't itself use the info but only passes it further
along.

Another way you might consider would be to create a public static
getEMF() method on MyMainClass (assuming that's the name of the client
main class where you've declared the private static annotated emf
variable). Then DataAccessImpl could invoke MyMainClass.getEMF() which
would just return the emf variable's value. This approach removes the
tramp data problem but creates a dependency of DataAccessImpl on
MyMainClass which you may not like. Then again, that might not bother
you; you might prefer that to adding the tramp argument to the
intervening method invocations.


- Tim
> -----Original Message-----
> From: Timothy.Quinn_at_Sun.COM [mailto:Timothy.Quinn_at_Sun.COM]
> Sent: Thursday, September 07, 2006 6:29 PM
> To: armart3_at_tycho.ncsc.mil
> Cc: Sanjeeb Kumar Sahoo; Marina Vatkina; users_at_glassfish.dev.java.net
> Subject: Re: AppClient/JWS/Derby/Security problems
>
>
> Hello, again, Martin.
>
> A couple of added notes...
>
> Marina mentioned that toplink-essentials.jar will need to be in the
> classpath. That's true and in addition the appclient command and the
> Java Web Start support in GlassFish takes care of that for you
> automatically. I need to double-check that the Java Web Start piece
> does so correctly in 9.0 b48 which is what you are using. The current
> code base definitely includes it, and the app client command has
> included that JAR for some time so you should be okay there.
>
> You should not see any difference between specifying -mainclass on the
> command line and omitting that option and specifying Main-Class in the
> manifest of the app client jar. Either way should work.
>
> One other detail, following up on Sahoo's comment: Annotations in app
> clients work only on items declared in the main class and they must be
> static, not instance, items. It is the Java EE spec that imposes this
> restriction, so the app client container honors it.
>
> - Tim
>
> Sanjeeb Kumar Sahoo wrote:
>
>> Hi Martin,
>>
>> I have a couple of questions regarding the issue you are facing while
>> running your application using appclient container.
>>
>> 1. You mentioned that you emf is *null* even when you annotated it
>> with @PersistenceUnit. Where is this emf defined? It has to be defined
>> in the main class only.
>>
>> 2. Can you send us the revised appclient command that you run now?
>>
>> To start with, don't use -mainclass option to appclient. Specify
>> Main-Class in manifest.mf of the client jar.
>>
>> Thanks,
>> Sahoo
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>