I'm using RC1 (jboss-3.0.0RC1_tomcat-4.0.3).
Beans used: UserSession, User, Sequence and
SequenceSession. In the web application: only
UserSession.
ejb-jar.xml:
...
<!--
SequenceSession
Implements a primary key generator.
By Jonathan Weedon at Borland Corporation.
-->
<session>
<ejb-name>SequenceSession</ejb-name>
<home>org.myrpg.atlas.ejb.SequenceSessionHome</home>
<remote>org.myrpg.atlas.ejb.SequenceSession</remote>
<local-home>org.myrpg.atlas.ejb.SequenceSessionLocalHome</local-home>
<local>org.myrpg.atlas.ejb.SequenceSessionLocal</local>
<ejb-class>org.myrpg.atlas.ejb.SequenceSessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<env-entry>
<description>Number of retries (default:
5).</description>
<env-entry-name>retryCount</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>5</env-entry-value>
</env-entry>
<env-entry>
<description>Increment number (default:
10).</description>
<env-entry-name>blockSize</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type>
<env-entry-value>10</env-entry-value>
</env-entry>
</session>
<!--
UserSession
-->
<session>
<ejb-name>UserSession</ejb-name>
<home>org.myrpg.atlas.ejb.UserSessionHome</home>
<remote>org.myrpg.atlas.ejb.UserSession</remote>
<ejb-class>org.myrpg.atlas.ejb.UserSessionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
<!--
ENTITY BEANS
-->
<!--
User
-->
<entity>
<ejb-name>User</ejb-name>
<home>org.myrpg.atlas.ejb.UserHome</home>
<remote>org.myrpg.atlas.ejb.User</remote>
<local-home>org.myrpg.atlas.ejb.UserLocalHome</local-home>
<local>org.myrpg.atlas.ejb.UserLocal</local>
<ejb-class>org.myrpg.atlas.ejb.UserBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>UserBean</abstract-schema-name>
<cmp-field><field-name>pk</field-name></cmp-field>
<cmp-field><field-name>firstName</field-name></cmp-field>
<cmp-field><field-name>lastName</field-name></cmp-field>
<cmp-field><field-name>eMail</field-name></cmp-field>
<cmp-field><field-name>age</field-name></cmp-field>
<cmp-field><field-name>question</field-name></cmp-field>
<cmp-field><field-name>answer</field-name></cmp-field>
<cmp-field><field-name>login</field-name></cmp-field>
<cmp-field><field-name>password</field-name></cmp-field>
<cmp-field><field-name>role</field-name></cmp-field>
<cmp-field><field-name>status</field-name></cmp-field>
<primkey-field>pk</primkey-field>
</entity>
<!--
Sequence
By Jonathan Weedon at Borland Corporation.
-->
<entity>
<ejb-name>Sequence</ejb-name>
<home>org.myrpg.atlas.ejb.SequenceHome</home>
<remote>org.myrpg.atlas.ejb.Sequence</remote>
<local-home>org.myrpg.atlas.ejb.SequenceLocalHome</local-home>
<local>org.myrpg.atlas.ejb.SequenceLocal</local>
<ejb-class>org.myrpg.atlas.ejb.SequenceBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>SequenceBean</abstract-schema-name>
<cmp-field><field-name>index</field-name></cmp-field>
<cmp-field><field-name>name</field-name></cmp-field>
<primkey-field>name</primkey-field>
</entity>
...
<!--
ASSEMBLY DESCRIPTOR
-->
<assembly-descriptor>
<!--
SESSION BEANS
-->
<container-transaction>
<method>
<ejb-name>SequenceSession</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<!--
ENTITY BEANS
-->
<container-transaction>
<method>
<ejb-name>Sequence</ejb-name>
<method-name>getValueAfterIncrementingBy</method-name>
</method>
<trans-attribute>RequiresNew</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
=======================================================
jboss-web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<!--
SESSION BEANS
-->
<ejb-ref>
<ejb-ref-name>ejb/UserSession</ejb-ref-name>
<jndi-name>myrpg-atlas/UserSession</jndi-name>
</ejb-ref>
</jboss-web>
=======================================================
jboss.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jboss>
<secure>false</secure>
<container-configurations />
<resource-managers />
<enterprise-beans>
<!--
SESSION BEANS
-->
<session>
<ejb-name>SequenceSession</ejb-name>
<jndi-name>myrpg-atlas/SequenceSession</jndi-name>
<configuration-name></configuration-name>
</session>
<session>
<ejb-name>UserSession</ejb-name>
<jndi-name>myrpg-atlas/UserSession</jndi-name>
<configuration-name></configuration-name>
</session>
<!--
ENTITY BEANS
-->
<entity>
<ejb-name>User</ejb-name>
<jndi-name>myrpg-atlas/User</jndi-name>
<configuration-name></configuration-name>
</entity>
<entity>
<ejb-name>Sequence</ejb-name>
<jndi-name>myrpg-atlas/Sequence</jndi-name>
<configuration-name></configuration-name>
</entity>
</enterprise-beans>
</jboss>
=======================================================
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>Atlas</servlet-name>
<servlet-class>org.myrpg.atlas.Atlas</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Atlas</servlet-name>
<url-pattern>/atlas</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- ### EJB References (java:comp/env/ejb) -->
<!--
SESSION BEANS
-->
<ejb-ref>
<ejb-ref-name>ejb/UserSession</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>org.myrpg.atlas.ejb.UserSessionHome</home>
<remote>org.myrpg.atlas.ejb.UserSession</remote>
</ejb-ref>
</web-app>
=======================================================
What are my mistakes???
Thanks in advance !
Wonder Sonic
--- Wim Praet <[EMAIL PROTECTED]> a �crit�: > which
version are u using? RC1, 2, 3?
> are both beans bound in jndi, under that name?
>
>
> ----- Original Message -----
> From: "wonder sonic" <[EMAIL PROTECTED]>
> To: "Wim Praet" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Tuesday, May 28, 2002 5:06 PM
> Subject: Re: Re[8]: [JBoss-user] [HELP] Is there
> someone to help me?
>
>
> > Theorically, I'm using an embedded Tomcat and I'm
> > aware
> > of the local/remote interface problems.
> > But it seems I don't use it properly :(
> > I have no working example.
> > Now my code is as follow:
> >
> > public void setSessionContext(
> > SessionContext
> sessionContext
> > )
> > {
> > try
> > {
> > Context namingContext = new
> > javax.naming.InitialContext();
> >
> > sequenceSessionLocal = (
> > (SequenceSessionLocalHome)
> > namingContext.lookup(
> > "myrpg-atlas/SequenceSession" )
> > ).create();
> >
> > userLocalHome = (UserLocalHome)
> > namingContext.lookup(
> "myrpg-atlas/User"
> > );
> > }
> > catch( CreateException ce )
> > {
> > throw new EJBException( ce );
> > }
> > catch( NamingException ne )
> > {
> > throw new EJBException( ne );
> > }
> > }
> >
> > But I encounter the exception:
> > java.rmi.ServerException: $Proxy42; nested
> exception
> > is:
> > java.lang.ClassCastException: $Proxy42
> > at
> >
>
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor
> .java:119)
> > ...
> > Caused by: java.lang.ClassCastException: $Proxy42
> > at
> >
>
org.myrpg.atlas.ejb.UserSessionBean.setSessionContext(UserSessionBean.java:7
> 2)
> > at
> >
>
org.jboss.ejb.StatelessSessionEnterpriseContext.(StatelessSessionEnterpriseC
> ontext.java:47)
> > at
> >
>
org.jboss.ejb.plugins.StatelessSessionInstancePool.create(StatelessSessionIn
> stancePool.java:61)
> > at
> >
>
org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:208
> )
> > at
> >
>
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSe
> ssionInstanceInterceptor.java:63)
> > at
> >
>
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor
> .java:96)
> >
> > any clue?
> >
> > tia,
> > wondersonic
> >
> > --- Wim Praet <[EMAIL PROTECTED]> a �crit : >
> If
> > you are using embedded tomcat, you should not set
> > > context like
> > >
> > >
> > > Properties props =
> > > (Properties)System.getProperties().clone();
> > > props.setProperty(
> > > "java.naming.factory.initial",
> > > "org.jnp.interfaces.NamingContextFactory" );
> > > props.setProperty(
> > >
> "java.naming.provider.url","jnp://localhost:1099" );
> > > props.setProperty(
> > >
> >
>
"java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces"
> > > );
> > >
> > > Context namingContext = new
> > > javax.naming.InitialContext( props );
> > >
> > > but just create a new context with no params,
> since
> > > tomcat then uses the
> > > same jndi context as jboss. Also: you can only
> use
> > > local interfaces in
> > > embedded tomcat, external tomcat will serialize
> > > everything and hence ressort
> > > to remote interfaces (so if you are indeed using
> an
> > > external tomcat, you
> > > can't even lookup those local homes).
> > >
> > > And in jboss 3.x indeed the client interfaces
> may be
> > > ommitted from the
> > > webapp lib dir, due to the change in
> classloading
> > > (als Alex reminded me).
> > >
> > > kind regards,
> > > Wim.
> > >
> > >
> > > ----- Original Message -----
> > > From: "wonder sonic" <[EMAIL PROTECTED]>
> > > To: "Wim Praet" <[EMAIL PROTECTED]>
> > > Sent: Tuesday, May 28, 2002 3:52 PM
> > > Subject: Re: Re[8]: [JBoss-user] [HELP] Is there
> > > someone to help me?
> > >
> > >
> > > > Well, you've missed no mail but the last one
> (with
> > > a
> > > > 50ko .doc file), I'm sending it to you, it
> resumes
> > > > my tests ;)
> > > >
> > > >
> > > > --- Wim Praet <[EMAIL PROTECTED]> a �crit :
> >
> > > Hello
> > > > both of you,
> > > > > I was reading this discussion on JBoss-user
> but
> > > I
> > > > > have the idea not every
> > > > > mail is on it, since there is missing
> content
> > > after
> > > > > " ws> ...
> > > > > setSessionContext of my ... " ?
> > > > >
> > > > > What is the new error you get when removing
> the
> > > > > client interfaces from the
> > > > > webapp lib dir? And do you or do you _not_
> need
> > > to
> > > > > add those client
> > > > > interfaces to the webapp? (I thought the
> webapp
> > > > > needed them always in the
> > > > > lib but as I can read from this discussion
> it is
> > > not
> > > > > necessary?!)
> > > > >
> > > > >
> > > > > > ws> Well, I'm sorry of this but I have to
> tell
> > > you
> > > > > that
> > > > > > ws> once I removed the
> myrpg-atlasclient.jar
> > > file
> > > > > where
> > > > > > ws> stands the UserSession and
> UserSessionHome
> > > > > files, an
> > > > > > ws> other error occured IN the
> > > setSessionContext
> > > > > of my
> > > > > > UserSession bean =>> the JNDI lookup
> worked!
>
=== message truncated ===
___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en fran�ais !
Yahoo! Mail : http://fr.mail.yahoo.com
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user