Instead of drip feeding, why don't you post the full definition of the session bean and the entity bean in ejb-jar.xml
The entire definition of the session bean is below, as is the definition of my entity bean without all of its fields and finders (since this would just be noise at this point).
Also, you should see java:comp/env for the Session bean at the top of JNDIView on the jmx-console.
I see:
java:comp namespace of the Content bean: +- env (class: org.jnp.interfaces.NamingContext)
and
java:comp namespace of the PartnerServices bean: +- env (class: org.jnp.interfaces.NamingContext)
Is there something special that has to be done in either the configuration for or lookup of entity beans that you don't have to do for session beans?
Thanks,
-M@
On Sat, 2003-08-30 at 03:43, Matthew Hixson wrote:On Friday, August 29, 2003, at 07:14 PM, Adrian Brock wrote:
You need an <ejb-local-ref> on your session bean point at the entity bean if you want it bound in java:comp/env
I should have mentioned in my previous mail that I do have this defined
in my web.xml:
<ejb-local-ref> <description>Content</description> <ejb-ref-name>Content</ejb-ref-name> <ejb-ref-type>Entity</ejb-ref-type> <local-home>ContentLocalHome</local-home> <local>ContentLocal</local> <ejb-link>Content</ejb-link> </ejb-local-ref>
-M@
Regards, Adrian
On Sat, 2003-08-30 at 02:35, Matthew Hixson wrote:On Friday, August 29, 2003, at 05:56 PM, Adrian Brock wrote:
You are looking for the local container. It is deployed at local/<ejb-name> by default. In your case lookup("local/Content");
I thought of that too, but when I lookup that I get:
18:11:21,347 ERROR [STDERR] NamingExceptionjavax.naming.NameNotFoundException: local not bound
but if local isn't bound, then I'm wondering where its finding my session beans since they're all local too. I'm using this:
_context = (Context) new InitialContext().lookup("java:comp/env");
to gain the initial context for both the session and entity beans and
then just looking up the value of the <ejb-name> element in
ejb-jar.xml.
Using the JNDIView service in the jmx-console I see this:
+- local (class: org.jnp.interfaces.NamingContext) | +- Content (proxy: $Proxy80 implements interface com.versaly.ejb.entity.ContentLocalHome) | +- PartnerServices (proxy: $Proxy110 implements interface com.versaly.ejb.session.PartnerServicesLocalHome)
all of my other entity and session beans are listed there too. I have
no idea why I can lookup PartnerServices, but not Content.
Alternatively specify <ejb-name>Content</ejb-name> <local-jndi-name>Content</local-jndi-name> </ejb-name> in jboss.xml
When I have jboss.xml in place is when I get the error about my entity
beans already being registered. I don't see why JBoss is complaining
about my beans already being registered as, for example local/Content,
when my webapp can't find them.
-M@
On Sat, 2003-08-30 at 01:15, Matthew Hixson wrote:On Friday, August 29, 2003, at 04:41 PM, Adrian Brock wrote:
It isn't necessary. There are defaults for everything. The defaults are unlikely to be the best options for all your beans.
On Fri, 2003-08-29 at 23:54, Matthew Hixson wrote:In my .ear I have a .jar. (I guess that's better than having my
ear
in
a jar. ahahhaaha.....)
Anyway, it seems that anytime I have jboss.xml in the META-INF
directory, as I've seen some example code doing, I get an
exception:
javax.management.InstanceAlreadyExistsException: jboss.j2ee:jndiName=Partner,service=EJB already registered.
If I don't have jboss.xml there things work as best they have so far.
Your jndi names must be unique. You have Partner twice. JBoss uses <ejb-name> when you don't specify a <jndi-name> in jboss.xml.
Okay, so I've gotten past this issue for now by not including a jboss.xml at all. Moving on...
I wouldn't have put jboss.xml into the jar except that I'm trying
to
figure out why my session beans are being found in JNDI, but my
entity
beans are not.
You probably have an ejb-name that isn't a valid java name. The spec requires this extra restriction for entity beans because it might be used as the table. e.g. ejbs/MyEntity is not valid
The bean I'm trying to use is called ContentBean. The entry in ejb-jar.xml is:
<entity > <description><![CDATA[]]></description> <ejb-name>Content</ejb-name>
<local-home>com.versaly.ejb.entity.ContentLocalHome</local-home>
<local>com.versaly.ejb.entity.ContentLocal</local>
<ejb-class>com.versaly.ejb.entity.ContentBean</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>v_content</abstract-schema-name>
<cmp-field >
<description><![CDATA[]]></description>
<field-name>contentId</field-name>
</cmp-field>
<!-- other cmp fields snipped -->
<primkey-field>contentId</primkey-field>
<!-- ejb finders snipped -->
</entity>
A session bean which I know my code is looking up and using is defined as this:
<session > <description> <![CDATA[]]> </description> <ejb-name>PartnerServices</ejb-name>
<local-home>com.versaly.ejb.session.PartnerServicesLocalHome</ local-
home>
<local>com.versaly.ejb.session.PartnerServicesLocal</local>
<ejb-class>com.versaly.ejb.session.PartnerServices</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> </session>
And I look it up with this:
_partnerServicesHome = (PartnerServicesLocalHome) _context.lookup("PartnerServices");
Or maybe you have some other problem with the db mappings?
I have my Postgres datasource setup properly and the entity beans
deploy without any errors written to the console. I'm not sure that
they're error free, but I don't think that's causing this problem.
Post the exception.
When my entity home locator class tries to lookup my ContentBean with:
_contentLocalHome = (ContentLocalHome) _context.lookup("Content");
I get a NamingException:
16:30:11,889 ERROR [STDERR] NamingException javax.naming.NameNotFoundException: Content not bound
Thanks for explaining the file purposes, too. -M@
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
