users@glassfish.java.net

Re: AppClient/JWS/Derby/Security problems

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Mon, 11 Sep 2006 15:32:23 -0700

Martin,

Do you have a complete stack trace?

thanks,
-marina

Martin, Ray wrote On 09/11/06 15:18,:
> Adding a little more information:
>
> In 'Note B' of my previous email, I stated that it is not necessary to
> create the EntityManagerFactory in the main class. I should have stated
> that to be a fact outside of appclient and appclient/JWS use. I was
> referring to an application outside of appclient. I do not know how
> things should be arranged within appclient, but the experts have said
> that EntityManagerFactory creation should be in the main class.
>
> I do know that now that I have my EntityManagerFactory creation in the
> main class both 'appclient only' and appclient/JWS are saying the same
> error. I never knew an error could look so good, but I was glad to see
> the functionality between 'appclient only' and appclient/JWS converge
> for my application.
>
> Both 'appclient only' and appclient/JWS throw the error:
> ValidationException.currentLoaderNotValid(ValidationException.java:1865)
>
> PLEASE, help me to get over this hurdle. Any ideas what to look for?
>
> -----Original Message-----
> *From:* Martin, Ray [mailto:armart3_at_tycho.ncsc.mil]
> *Sent:* Monday, September 11, 2006 5:42 PM
> *To:* 'users_at_glassfish.dev.java.net'
> *Subject:* RE: AppClient/JWS/Derby/Security problems
>
> From suggestions in this thread of placing EntityManagerFactory
> in the main class, I figured that I needed to step back and learn
> more about that suggestion.
>
> I took my application (happens to be KART) and placed the following
> into Main.java (main class provided by Netbeans):
> @PersistenceUnit(unitName="SVG_drawings")
> private static EntityManagerFactory emf;
>
> this does NOT work!!! emf is NULL (this info must be referenced
> with persistence.xml that I provided in this thread).
>
> i replaced the two lines above with:
> private static EntityManagerFactory emf;
>
> later in code in main class (could have all been on one line):
> emf = Persistence.createEntityManagerFactory("SVG_drawings");
>
> this WORKS!!!
>
> more lessons learned:
> I could run the KART app within Netbeans but not at the command line.
>
> In Netbeans, I right clicked on Main and selected Run File - the
> project would run as stated above. See Note A below.
>
> At the command line, I typed the following:
> java -jar /usr/local/provision/KART/dist/KART.jar
>
> this always blew an error saying:
> Internal Exception: SQL Exception: Failed to start database
> 'derbyDB' ...
>
> I agonized for hours. Finally, I typed
> java -Dderby.system.home=/usr/local/dbHome -jar
> /usr/local/provision/KART/dist/KART.jar
>
> TADA!!!! it runs.
>
> Next, I deploy KART to Glassfish. Then, at the command line, I type:
> /usr/local/glassfish/glassfish/bin/appclient -client
> /usr/local/glassfish/glassfish/domains/domain1/generated/xml/j2ee-modules/KART/KARTClient.jar
>
> it throws the
> error: ValidationException.currentLoaderNotValid(ValidationException.java:1865)
>
>
> Question: Is there a command line parameter to pass to appclient
> similar to the '-Dderby.system.home' for the java command line and
> the '?prop=DBHome=/usr/local/dbHome' for the browser URL for
> appclient/JWS ?
>
>
>
> Note A: Even though the application ran from within Netbeans, it
> was still not pointing to the directory that I wanted.
>
> Note B: It is NOT necessary to place the EntityManagerFactory lines
> in the main class. I have tested and the line work equally well in
> any class of the project.
>
>