users@glassfish.java.net

RE: AppClient/JWS/Derby/Security problems

From: Martin, Ray <armart3_at_tycho.ncsc.mil>
Date: Fri, 1 Sep 2006 17:59:00 -0400

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