users@glassfish.java.net

Re: AppClient/JWS/Derby/Security problems

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Tue, 12 Sep 2006 12:42:55 -0700

Great!

Can you please check that derby drivers are in the classpath?

Also, it's probably derby itself that does getProperty(derby.system.home).
Now, in the appserver all getProperty calls granted read permissions:
grant {
...
     permission java.util.PropertyPermission "*", "read";
...
}
If this is the case, you might need to add a specific permission.

For no drawings, you might need to change toplink logging level to FINER
to see if it reports any problems.

HTH,
-marina

Martin, Ray wrote:
> THANK YOU!!!
>
> Downloaded v1_ur1-b10 - both 'appclient only' and appclient/JWS run my
> apps!!!
>
> But, i am left with a few remnant problems that i would like to request some
> assistance.
>
> 1)Run J2SE application, DrawingAddon.jar
> command line: java -Dderby.system.home=/usr/local/dbHome -jar
> /usr/local/provision/DrawingAddon/dist/DrawingAddon.jar
>
> this runs beautifully - can save and retrieve SVG drawings from Derby. All
> good here.
>
> 2)Run J2SE application, KART.jar
> command line: java -Dderby.system.home=/usr/local/dbHome -jar
> /usr/local/provision/KART/dist/KART.jar
>
> The KART app starts up, an EntityManagerFactory is ready to do work. In the
> KART app, the user clicks on "Visit Addon Store". The DrawingAddon.jar is
> available (was deployed as a web app to Glassfish). When DrawingAddon is
> selected, a URLClassLoader loads the app, DrawingAddon. The user can create
> a new SVG drawing. But, when the user asks for a listing of the drawings in
> the database, there are none. i have a sysOut in the addon classes that
> reports that getProperty(derby.system.home) is /usr/local/dbHome - this is
> correct.
>
> The line that errors is "em = emf.createEntityManager()" where em has been
> declared as "private Entitymanager em;"
>
> i admit that this is not a Glassfish problem. i believe it is a class
> loader / Derby problem - and i ain't got no clue how to fix it. A poke in
> the right direction would be appreciated.
>
> 3) Run 'appclient only', KARTClient.jar
> command line: /usr/local/glassfish/glassfish/bin/appclient -client
> /usr/local/glassfish/glassfish/domains/domain1/generated/xml/j2ee-modules/KA
> RT/KARTClient.jar
>
> The KART app starts up, an EntityManagerFactory is ready to do work. In the
> KART app, the user clicks on "Visit Addon Store". The DrawingAddon.jar is
> available (was deployed as a web app to Glassfish). When DrawingAddon is
> selected, a URLClassLoader loads the app, DrawingAddon. Then i get a brand
> shiny new error - Internal Exception: java.sql.SQLException: No suitable
> driverError Code:0 - followed by more stack trace.
>
> The line that errors is "em = emf.createEntityManager()" where em has been
> declared as "private Entitymanager em;"
>
> i am not saying that this is an appclient problem. It is just interesting
> how much different the error is from step 2 above.
>
> 4) Run appclient/JWS, KARTClient.jar
> URL in browser: http://gateway:8080/KART?prop=DBHome=/usr/local/dbHome
>
> The KART app starts up, an EntityManagerFactory is ready to do work. In the
> KART app, the user clicks on "Visit Addon Store". The DrawingAddon.jar is
> available (was deployed as a web app to Glassfish). When DrawingAddon is
> selected, a URLClassLoader loads the app, DrawingAddon. Then i get a good
> old faithful error - java.securityAccessControlException - stack trace seems
> to imply that Toplink is doing getProperty(derby.system.home).
>
> Can you tell me which blog to read for instruction on setting the
> SecurityManager for appclient/JWS?
>
>
>
>
> -----Original Message-----
> From: Marina.Vatkina_at_Sun.COM [mailto:Marina.Vatkina_at_Sun.COM]
> Sent: Monday, September 11, 2006 7:03 PM
> To: users_at_glassfish.dev.java.net
> Subject: Re: AppClient/JWS/Derby/Security problems
>
>
> Martin,
>
> Can you try it on the latest promoted build?
>
> thanks,
> -marina
>
> Martin, Ray wrote On 09/11/06 15:41,:
>
>>The stack traces are attached files (I hope this is acceptable, if not
>
> I'll
>
>>try placing into body of email). The .trace file is appclient/JWS and
>>appclientOnly as named.
>>
>>thanx.
>>
>>-----Original Message-----
>>From: Marina.Vatkina_at_Sun.COM [mailto:Marina.Vatkina_at_Sun.COM]
>>Sent: Monday, September 11, 2006 6:32 PM
>>To: users_at_glassfish.dev.java.net
>>Subject: Re: AppClient/JWS/Derby/Security problems
>>
>>
>>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/KA
>
>>RT/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.
>>>
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>>
>>------------------------------------------------------------------------
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>