users@glassfish.java.net

RE: GlassFish V2.1.1 to V3 migration - JCA ClassLoader problem

From: Martin Gainty <mgainty_at_hotmail.com>
Date: Thu, 3 Jun 2010 13:55:21 -0400

<!-- a typical rar (resource archive) is the jms-service -->
<!-- lets take a quick look at the jms-service resource defined in domain.xml -->
 
      <jms-service addresslist-behavior="random" addresslist-iterations="3" default-jms-host="default_JMS_host" init-timeout-in-seconds="60" reconnect-attempts="3" reconnect-enabled="true" reconnect-interval-in-seconds="5" type="EMBEDDED">
        <jms-host admin-password="password" admin-user-name="username" host="localhost" name="default_JMS_host" port="8676"/>
      </jms-service>


<!-- if i unjar the contents of $GF_HOME\lib\install\applications\jmsra\imqjmsra.jar i can see the /META-INF/ra.xml -->
<!-- where the contents of ra.xml describes the config-property for the resourceadapter which will be used for (jms) connector -->

<connector xmlns="http://java.sun.com/xml/ns/j2ee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
           http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
           version="1.5">
    <description>Sun Java System Message Queue JMS Resource Adapter</description>
    <display-name>Sun Java System Message Queue 4.1 Java EE Resource Adapter for JMS</display-name>
    <vendor-name>Sun Microsystems, Inc.</vendor-name>
    <eis-type>Java Message Service v 1.1</eis-type>
    <resourceadapter-version>4.1 Beta</resourceadapter-version>

    <resourceadapter>
        <resourceadapter-class>
            com.sun.messaging.jms.ra.ResourceAdapter
        </resourceadapter-class>
        <config-property>
                <config-property-name>
                ConnectionURL
                </config-property-name>
                <config-property-type>
                java.lang.String
                </config-property-type>
                <config-property-value>
                mq://localhost:8676/
                </config-property-value>
        </config-property>
        <config-property>
                <config-property-name>
                UserName
                </config-property-name>
                <config-property-type>
                java.lang.String
                </config-property-type>
                <config-property-value>
                guest
                </config-property-value>
        </config-property>
        <config-property>
                <config-property-name>
                Password
                </config-property-name>
                <config-property-type>
                java.lang.String
                </config-property-type>
                <config-property-value>
                guest
                </config-property-value>
        </config-property>
        <outbound-resourceadapter>
            <connection-definition>
                <managedconnectionfactory-class>
                    com.sun.messaging.jms.ra.ManagedConnectionFactory
                </managedconnectionfactory-class>
                <config-property>
                    <config-property-name>AddressList</config-property-name>
                    <config-property-type>java.lang.String</config-property-type>
                    <config-property-value>localhost</config-property-value>
                </config-property>
                <config-property>
                    <config-property-name>UserName</config-property-name>
                    <config-property-type>java.lang.String</config-property-type>
                    <config-property-value>guest</config-property-value>
                </config-property>
                <config-property>
                    <config-property-name>Password</config-property-name>
                    <config-property-type>java.lang.String</config-property-type>
                    <config-property-value>guest</config-property-value>
                </config-property>
                <connectionfactory-interface>
                    javax.jms.ConnectionFactory
                </connectionfactory-interface>
                <connectionfactory-impl-class>
                    com.sun.messaging.jms.ra.ConnectionFactoryAdapter
                </connectionfactory-impl-class>
                <connection-interface>
                    javax.jms.QueueConnection
                </connection-interface>
                <connection-impl-class>
                    com.sun.messaging.jms.ra.ConnectionAdapter
                </connection-impl-class>
            </connection-definition>
            <connection-definition>
                <managedconnectionfactory-class>
                    com.sun.messaging.jms.ra.ManagedConnectionFactory
                </managedconnectionfactory-class>
                <config-property>
                    <config-property-name>AddressList</config-property-name>
                    <config-property-type>java.lang.String</config-property-type>
                    <config-property-value>localhost</config-property-value>
                </config-property>
                <config-property>
                    <config-property-name>UserName</config-property-name>
                    <config-property-type>java.lang.String</config-property-type>
                    <config-property-value>guest</config-property-value>
                </config-property>
                <config-property>
                    <config-property-name>Password</config-property-name>
                    <config-property-type>java.lang.String</config-property-type>
                    <config-property-value>guest</config-property-value>
                </config-property>
                <connectionfactory-interface>
                    javax.jms.QueueConnectionFactory
                </connectionfactory-interface>
                <connectionfactory-impl-class>
                    com.sun.messaging.jms.ra.ConnectionFactoryAdapter
                </connectionfactory-impl-class>
                <connection-interface>
                    javax.jms.QueueConnection
                </connection-interface>
                <connection-impl-class>
                    com.sun.messaging.jms.ra.ConnectionAdapter
                </connection-impl-class>
            </connection-definition>
            <connection-definition>
                <managedconnectionfactory-class>
                    com.sun.messaging.jms.ra.ManagedConnectionFactory
                </managedconnectionfactory-class>
                <config-property>
                    <config-property-name>AddressList</config-property-name>
                    <config-property-type>java.lang.String</config-property-type>
                    <config-property-value>localhost</config-property-value>
                </config-property>
                <config-property>
                    <config-property-name>UserName</config-property-name>
                    <config-property-type>java.lang.String</config-property-type>
                    <config-property-value>guest</config-property-value>
                </config-property>
                <config-property>
                    <config-property-name>Password</config-property-name>
                    <config-property-type>java.lang.String</config-property-type>
                    <config-property-value>guest</config-property-value>
                </config-property>
                <connectionfactory-interface>
                    javax.jms.TopicConnectionFactory
                </connectionfactory-interface>
                <connectionfactory-impl-class>
                    com.sun.messaging.jms.ra.ConnectionFactoryAdapter
                </connectionfactory-impl-class>
                <connection-interface>
                    javax.jms.TopicConnection
                </connection-interface>
                <connection-impl-class>
                    com.sun.messaging.jms.ra.ConnectionAdapter
                </connection-impl-class>
            </connection-definition>
            <transaction-support>
                XATransaction
            </transaction-support>
            <authentication-mechanism>
                <authentication-mechanism-type>
                    BasicPassword
                </authentication-mechanism-type>
                <credential-interface>
                    javax.resource.spi.security.PasswordCredential
                </credential-interface>
            </authentication-mechanism>
            <reauthentication-support>
                false
            </reauthentication-support>
        </outbound-resourceadapter>
        <inbound-resourceadapter>
            <messageadapter>
                <messagelistener>
                    <messagelistener-type>
                        javax.jms.MessageListener
                    </messagelistener-type>
                    <activationspec>
                        <activationspec-class>
                            com.sun.messaging.jms.ra.ActivationSpec
                        </activationspec-class>
                        <required-config-property>
                            <config-property-name>
                                destination
                            </config-property-name>
                        </required-config-property>
                        <required-config-property>
                            <config-property-name>
                                destinationType
                            </config-property-name>
                        </required-config-property>
                    </activationspec>
                </messagelistener>
            </messageadapter>
        </inbound-resourceadapter>
        <adminobject>
            <adminobject-interface>javax.jms.Queue
            </adminobject-interface>
            <adminobject-class>
            com.sun.messaging.Queue
            </adminobject-class>
            <config-property>
                <config-property-name>
                Name
                </config-property-name>
                <config-property-type>
                java.lang.String
                </config-property-type>
                <config-property-value>
                </config-property-value>
            </config-property>
            <config-property>
                <config-property-name>
                Description
                </config-property-name>
                <config-property-type>
                java.lang.String
                </config-property-type>
                <config-property-value>
                </config-property-value>
            </config-property>
        </adminobject>
        <adminobject>
            <adminobject-interface>
            javax.jms.Topic
            </adminobject-interface>
            <adminobject-class>
            com.sun.messaging.Topic
            </adminobject-class>
            <config-property>
                <config-property-name>
                Name
                </config-property-name>
                <config-property-type>
                java.lang.String
                </config-property-type>
                <config-property-value>
                </config-property-value>
            </config-property>
            <config-property>
                <config-property-name>
                Description
                </config-property-name>
                <config-property-type>
                java.lang.String
                </config-property-type>
                <config-property-value>
                </config-property-value>
            </config-property>
        </adminobject>
    </resourceadapter>
</connector>


<!-- to create the resource use create-resource-ref -->
asadmin> create-resource-ref
Usage: create-resource-ref [--terse=false] [--echo=false] [--interactive=true] [--host localhost] [--port 4848|4849] [--secure|-s=true] [--user admin_user] [--passwordfile

file_name] [--target target(Default server)] [--enabled=true] reference_name


<!-- to list the services that are running: -->
asadmin> list server.resources *
server.jms-service

 

hth
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.



 

> Date: Thu, 3 Jun 2010 22:26:21 +0530
> From: Sahoo_at_Sun.COM
> To: users_at_glassfish.dev.java.net
> Subject: Re: GlassFish V2.1.1 to V3 migration - JCA ClassLoader problem
>
> I don't think you have to change the way you package classes. As per the
> new spec, if an app uses a standalone RAR, then RAR classes are visible
> to the app. It seems your WAR is not declaring a dependency on the RAR.
> How does the WAR use the resources exposed by the RAR? Does it not use
> resource-ref?
>
> Sahoo
>
> On Thursday 03 June 2010 10:27 PM, glassfish_at_javadesktop.org wrote:
> > Looking through my code I see that my web app uses my custom implementation classes of JCA interfaces such as Connection, ConnectionFactory, Interaction, InteractionSpec, etc. I could probably change the code to reference these objects using the interface type, because those interfaces should be on the classpath.
> >
> > Really the only classes that my web app needs to access from inside the .RAR are classes that implement the Record interface, and any model objects that those classes use.
> >
> > I'm going to try the following:
> >
> > 1) Move classes that implement Record into a separate .jar file that is not bundled inside the .RAR or .WAR file. I'll place this new .jar file in /domain1/lib. I'll also move model objects that the Records use into this new .jar.
> >
> > 2) Change my web app to use only JCA interfaces when loading a connection from JNDI, setting up an interaction and executing it.
> >
> > Hopefully that works, I'll let you know.
> > [Message sent by forum member 'rdelaplante']
> >
> > http://forums.java.net/jive/thread.jspa?messageID=472620
> >
> > ---------------------------------------------------------------------
> > 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
>
                                               
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4