users@glassfish.java.net

Re: AppClient/JWS/Derby/Security problems

From: Tim Quinn <Timothy.Quinn_at_Sun.COM>
Date: Wed, 06 Sep 2006 15:16:27 -0500

Hello, Ray.

I have been out of the office for several days and am only now catching
up on things. I will be reading through this thread carefully and hope
to have something to offer soon.

Sorry for the delay.

- Tim

Martin, Ray wrote:
> A) USING APPCLIENT
> i was ecstatic, i had nailed my problem. Step #5 in Mr. Sahoo's blog (link
> provided by Mr. Vatkina in this thread) was different than what i was doing.
> i'm winnin' over this problem - WRONG.
>
> When running appclient, i was passing the -client parameter with the
> directory to where my development client jar was located not the deployed
> jar in the Glassfish directory as shown in Mr. Sahoo's blog. i corrected my
> error - AND - absolutely no difference - the problem remains exactly the
> same. i still get the "at
> oracle.toplink.essentials.exceptions.ValidationException.currentLoaderNotVal
> id(ValidationException.java:1865)" when the following line gets called:
>
> emf=Persistence.createEntityManagerFactory("SVG_drawings");
>
> emf is declared as follows:
>
> private static EntityManagerFactory emf; - with no annotation.
>
> this is different than the annotation shown in Mr. Sahoo's blog.
>
> so, i did:
> @PersistenceUnit(unitName="SVG_drawings")
> private static EntityManagerFactory emf;
>
> now when using 'emf' as in:
> em = emf.createEntityManager();
>
> i also tried:
> @PersistenceContext(unitName="SVG_drawings")
> private static EntityManagerFactory emf;
>
> again when using 'emf' - it is null;
>
> i have always found this to be the case - using annotation, 'emf' is null.
> Creating 'emf' from Persistence works - because, keep in mind that i have
> this application working - using Derby - in stand alone mode. It is only
> when i try to use it within Glassfish's appclient that things go down hill
> for me.
>
> B) USING JWS/APPCLIENT
> 'A' above is a secondary goal. Running appclient and Java Web Start is my
> primary goal. I am not able to pass security parameters that are necessary
> to set system parameters. I followed Mr. Quinn's suggestion, but it did not
> work for me.
>
> Note that running APPCLIENT alone - SecurityManager is null, running
> JWS/APPCLIENT - SecurityManager is ON according to a logger stating:
> INFO:SecurityManager is ON.
>
> What am i doing wrong that i cannot get Mr. Quinn's suggestion of setting
> the hyperlink as follows:
> http://gateway:8080/KART/?arg=-jwsPolicyTemplate&arg=file:///usr/local/provi
> sion/KART/policy/KART.policy
>
> In KART.policy, i have given AllPermissions to KARTClient.jar deployed in
> Glassfish.
>
>
>
> -----Original Message-----
> From: Marina.Vatkina_at_Sun.COM [mailto:Marina.Vatkina_at_Sun.COM]
> Sent: Friday, September 01, 2006 6:58 PM
> To: users_at_glassfish.dev.java.net
> Subject: Re: AppClient/JWS/Derby/Security problems
>
>
> Does it mean that /usr/local/glassfish/galssfish/bin/appclient solves the
> provider problem? I don't think that do not need -javaagent with appclient
> container - the link below doesn't mention it.
>
> For use with JWS you'll need to add toplink-essentials.jar to the classpath.
>
> I'll also be back on Tuesday :).
>
> regards,
> -marina
>
> Martin, Ray wrote:
>
>> yes, went I attempt to run from the command line with no JWS, I run the
>> <glassfish-install>/bin/appclient. And I do not seem to need any
>>
> additional
>
>> jar files.
>>
>> Command line:
>> /usr/local/glassfish/galssfish/bin/appclient
>> -javaagent:/usr/local/galssfish/glassfish/lib/toplink-essentials-agent.jar
>> -DjwsPolicyTemplate=/usr/local/provision/KART/policy/KART.policy -client
>> /usr/local/provision/KART/dist/KART.jar -mainclass kart.Main
>>
>> Of course my main interest is appclient/JWS combined, but certainly, I can
>> learn things from the command line.
>>
>> I have started looking at the link that you provided. Thanx.
>>
>> I am gonna step out of work in just a little. I'll be back on Tuesday -
>> have no Internet at home - yuk - someday.
>>
>> Thanx for you help, have a great weekend.
>>
>> -----Original Message-----
>> From: Marina.Vatkina_at_Sun.COM [mailto:Marina.Vatkina_at_Sun.COM]
>> Sent: Friday, September 01, 2006 6:18 PM
>> To: users_at_glassfish.dev.java.net
>> Subject: Re: AppClient/JWS/Derby/Security problems
>>
>>
>> Are you using <glassfish-install>/bin/appclient to run your AppClient?
>> It should have all required jars in the classpath. here is a useful blog
>> on this:
>>
>>
> http://weblogs.java.net/blog/ss141213/archive/2006/03/using_java_pers_1.html
>
>> -marina
>>
>> Martin, Ray wrote:
>>
>>
>>> My understanding is that AppClient is a container for my client code.
>>>
>>> All persistence units MUST be handled by KART (the substrate) at a single
>>> point in the code. An addon says "here is the name of my DataAccessImpl
>>> (and Data Entity classes - happens to be hard coded for now in
>>> persistence.xml)". KART says "thank you very much" and then KART does a
>>> class load on the DataAccessImpl and Toplink makes the tables according to
>>> the Data Entity classes - at least that is how it is supposed to work.
>>>
>> When
>>
>>
>>> the addon, DrawingEditor, is run stand alone (testing before running as an
>>> addon), the class, DataAccessImpl does the reading and writing with the
>>> database after Toplink has made sure the tables are created.
>>>
>>> A "bad spot" in my design is that addons must specify their Data Entity
>>> classes. I am cheating to get started and am manually building
>>> persistence.xml. This is not good - KART, the substrate, must know at
>>> runtime how to create tables for the addon. This represents a real flaw
>>>
>> in
>>
>>
>>> my design at the moment.
>>>
>>> But, if I could just get it to stand up for now, I can figure out how to
>>> dynamically get Toplink to create tables at runtime later on.
>>>
>>> If my typing is correct, this is persistence.xml:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <!--
>>> Document : persistence.xml
>>> Created on : August 10, 2006, 1:44 PM
>>> Author : armart3
>>> Description:
>>> Purpose of the document follows.
>>> -->
>>> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
>>> version="1.0">
>>> <persistence-unit name="SVG_drawings" transaction-type="RESOURCE_LOCAL">
>>> <provider>
>>> oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
>>> </provider>
>>> <class>draw.resources.entity.DrawingObjects</class>
>>> <class>draw.resources.entity.DrawingStore</class>
>>> <properties>
>>> <property name="toplink.jdbc.driver"
>>> value="org.apache.derby.jdbc.EmbeddedDriver" />
>>> <property name="toplink.jdbc.url"
>>> value="jdbc:derby:derbyDB/;create=true" />
>>> <property name="toplink.jdbc.user"
>>> value="user1" />
>>> <property name="toplink.jdbc.password"
>>> value="user1" />
>>>
>>> <property name="toplink.logging.level"
>>> value="INFO" />
>>>
>>> <property name="toplink.ddl-generator" value="create-tables" />
>>> </properties>
>>> </persistence-unit>
>>> </persistence>
>>>
>>> THANK YOU SO MUCH!
>>>
>>> -----Original Message-----
>>> From: Marina.Vatkina_at_Sun.COM [mailto:Marina.Vatkina_at_Sun.COM]
>>> Sent: Friday, September 01, 2006 5:32 PM
>>> To: users_at_glassfish.dev.java.net
>>> Subject: Re: AppClient/JWS/Derby/Security problems
>>>
>>>
>>> Don't panic :).
>>>
>>> Do you access PU from an appclient only, or from other parts of the code?
>>> Which persistence provider are you using? Can you post your
>>>
>> persistence.xml?
>>
>>
>>> thanks,
>>> -marina
>>>
>>> Martin, Ray wrote:
>>>
>>>
>>>
>>>> Problem:
>>>> Application (with embedded database deployed to Glassfish as an AppClient
>>>> and run from a link of a JSP that has been deployed as an Enterprise App
>>>>
>>> to
>>>
>>>
>>>
>>>> Glassfish) throws javax.persistence.PersistenceException: No Persistence
>>>> provider for EntityManager named SVG_Drawings at
>>>>
>>>>
>>>
> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:89
>
>>>> )
>>>>
>>>> Call for help:
>>>> I really need some help. I am stuck with these problems and I need an
>>>> expert to poke me in the right direction.
>>>>
>>>> Apologies:
>>>> I am working on a stand alone test bed that has no Internet access,
>>>> therefore, it is very difficult to send stack traces and code snippets.
>>>>
> I
>
>>>> am sorry.
>>>>
>>>> Background:
>>>> Using Java 1.5.0_06-b05
>>>> Using Glassfish 9.0-b48
>>>> Using Netbeans 5.0
>>>> Using Derby 10.1.2.1 (embedded database)
>>>> Using Toplink (from Glassfish lib)
>>>> Using FreePastry 1.4.4 (structured peer-to-peer overlay)
>>>> Using GLIPSGraffiti (Apache SVG editor)
>>>> Prepared to use jTssWrapper (JNI to Trousers)
>>>> Prepared to use Trousers (IBM Trusted Software Stack for attestation,
>>>>
> etc)
>
>>>> Prepared to use JESS (reasoning)
>>>> Prepared to use OWL/RDF (semantics and ontology)
>>>> Prepared to use JADE 3.3 (agent software)
>>>>
>>>> Purpose:
>>>> Test bed is used to demonstrate Java Security, SELinux MAC, TNC (Trusted
>>>> Network Connect), and showcase Java technology. I have been working on
>>>>
>>> this
>>>
>>>
>>>
>>>> demonstration for a couple of months.
>>>>
>>>> A little about the design:
>>>> There are several Netbeans' projects:
>>>> KART (Knowledge Awareness Response Tool) - J2SE desktop application, a
>>>> substrate that contains data persistence (Derby) and data communications
>>>> (FreePastry). KART receives addons in the perspective that Mozilla uses
>>>> addons. KART has a classloader for loading the addons. KART is deployed
>>>>
>>> to
>>>
>>>
>>>
>>>> Glassfish as an AppClient. KART contains persistence.xml.
>>>>
>>>> ChatEditor - simple addon that allows users at endpoints on the
>>>>
> structured
>
>>>> overlay to send text messages back and forth. This addon has no data
>>>> persistence requirements.
>>>>
>>>> DrawingEditor - an addon requiring data persistence and data
>>>>
>>> communications.
>>>
>>>
>>>
>>>> This addon is based on the GLIPS SVG editor. GLIPS was modified to
>>>>
>>> persist
>>>
>>>
>>>
>>>> to the database instead of the filesystem.
>>>>
>>>> SecurityAuditor - an addon in its infancy, will need data persistence and
>>>> data communications. Will use nmap and SNMP to collect layer 2 data.
>>>>
>>> Will
>>>
>>>
>>>
>>>> use JESS for decision processing.
>>>>
>>>> Addons - a web application. All jar files of addons are placed into this
>>>> project. The war file from this project is deployed as a web application
>>>>
>>> to
>>>
>>>
>>>
>>>> Glassfish
>>>>
>>>> AddonInterfaces - a J2SE application that contains the interface classes
>>>> required by addons to interface with KART. So, these files are the
>>>> 'contract' between KART and addons.
>>>>
>>>> Provision - a J2EE application used to showcase JSF and JSP. The ear
>>>>
> file
>
>>>> of Provision is deployed to Glassfish as an enterprise application.
>>>> Admittedly, Provision does not yet do much EJB - only Web-Module at the
>>>> moment. But, Provision is planned to do policy loads (both operational
>>>>
>>> and
>>>
>>>
>>>
>>>> security (both OS and Java)) using EJB functionality
>>>>
>>>> A little about operation:
>>>> After everything is deployed to Glassfish correctly, users can access
>>>> Provision's web page, ServiceLocator.jsp, and click on the KART link.
>>>> AppClient/JWS does its thing and the substrate is available on the user's
>>>> desktop. There is a button, "Visit Addon Store". When the user selects,
>>>> she is provided with a list of addons. ChatEditor can be selected and
>>>>
>>> users
>>>
>>>
>>>
>>>> at structured overlay endpoints can chat. SecurityAuditor can be
>>>>
> selected
>
>>>> in addition to ChatEditor (or ChatEditor could have been shutdown). The
>>>> SecurityAuditor GUI stands up, but the addon needs lots of work and does
>>>>
>>> not
>>>
>>>
>>>
>>>> do much for now - but it is okay. DrawingEditor will also stand up and
>>>>
>>> the
>>>
>>>
>>>
>>>> user can edit SVG drawings - IF I comment out the data persistence.
>>>>
>>>> More problem discussion:
>>>> As described at the beginning of this (too long) email,
>>>>
>>> EntityManagerFactory
>>>
>>>
>>>
>>>> does not know how to start - probably because I do not know how to tell
>>>> AppClient how/where to use my persistence.xml. Of course, this problem
>>>>
> is
>
>>>> only seen if I comment out setting my Derby home property. I learned how
>>>>
>>> to
>>>
>>>
>>>
>>>> set a policy to AppClient from Mr. Quinn's explanation on Feb 7 at this
>>>> link: http://forums.java.net/jive/thread.jspa?messageID=80035&tstart=0
>>>>
> (I
>
>>>> requested a login, but I am not able to post to that forum) At the
>>>>
>>> moment,
>>>
>>>
>>>
>>>> KART.jar is not signed - I have seen it written that JWS will not use
>>>> permissions unless the jar is signed. When I sign KART.jar, JWS says
>>>>
> that
>
>>>> it cannot verify - and I have not figured out what to do about that. I
>>>>
>>> have
>>>
>>>
>>>
>>>> tried running at the command line using AppClient - this blows a
>>>>
> different
>
>>>> error than trying AppClient/JWS. The 'AppClient only' way blows an
>>>>
>>>>
>>>
> oracle.toplink.essentails.exception.ValidationException.currentLoaderNotVali
>
>>>> d - maybe as soon as I get my other problems fixed with AppClient/JWS, it
>>>> too will blow that error.
>>>>
>>>> I have some sys outs in KART to watch classloaders so that I can learn
>>>>
>>> more
>>>
>>>
>>>
>>>> about what AppClient does. But, AppCLient/JWS will not allow me to make
>>>>
>>> the
>>>
>>>
>>>
>>>> getClassLoader() call because of permissions.
>>>>
>>>> Plea:
>>>> I am so lost with all of this AppClient/JWS stuff. I am doing web
>>>>
>>> searches
>>>
>>>
>>>
>>>> like a wild man - but, I can't find much. Please help me get past these
>>>> humps in the road.
>>>>
>>>> PS
>>>> I feel Ruby and .Net howling at my heels as I run into this massive
>>>> roadblock with my Java showcase.
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>> ---------------------------------------------------------------------
>> 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
>
>