Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
06. Jul 2009, 02:10 CET | Link

Hi guys, I'm having a problem, I think it may be something that I'm missing, but I honestly don't know what it is. I have a Statefull Session Bean, bound to the Application Scope as follows:

@Name("cvManager")
@Scope(ScopeType.APPLICATION)
@Stateful
@AutoCreate
public class CommonValueManager implements Serializable, CommonValueCacheProvider

then I'm trying to access this bean by either of this two methods:

CommonValueCacheProvider cvManager;
		
cvManager = ( (CommonValueCacheProvider) Component.getInstance("cvManager") );

Or

@In(required=false,create=true)
private CommonValueCacheProvider cvManager;

and I get the following exception, at least in the second case:

Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: cvManager
	at org.jboss.seam.Component.newInstance(Component.java:2106)
	at org.jboss.seam.Component.getInstance(Component.java:1988)
	at org.jboss.seam.Component.getInstance(Component.java:1950)
	at org.jboss.seam.Component.getInstance(Component.java:1944)
	at org.jboss.seam.Component.getInstance(Component.java:1939)
	at org.seamtrial.entity.Product.setProductCategory(Product.java:97)
	at org.seamtrial.entity.Product.setCategoryCode(Product.java:91)
	... 110 more
Caused by: javax.naming.NameNotFoundException: seamTrial\CommonValueManager\local not bound
	at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
	at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
	at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
	at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
	at javax.naming.InitialContext.lookup(InitialContext.java:392)
	at org.jboss.seam.Component.instantiateSessionBean(Component.java:1367)
	at org.jboss.seam.Component.instantiate(Component.java:1331)
	at org.jboss.seam.Component.newInstance(Component.java:2084)
	... 116 more

my component configuration has the following parameters, in case the JNDI name strikes you as odd:

<core:init debug="true" jndi-pattern="seamTrial\#{ejbName}\local" precedence="100"/>

Any help will be great,

thanks

4 Replies:
08. Jul 2009, 20:10 CET | Link

which app server are you using?

side note: you don't need create=true when using @AutoCreate

 

Currently reading Seam 2.x Web Development by David Salter with DZone review publication forthcoming

JBoss Tools 3 Developers Guide is out now in paperback as well.

09. Jul 2009, 00:52 CET | Link

This test was made on a JBoss 5.0, with Seam 2.1

Yeap, you are right about the @AutoCreate, it's just that I was getting kind of crazy about it and I tried all sorts of things, hehe.

09. Jul 2009, 01:14 CET | Link

I am using JBoss 4.2.x with Seam 2.0.2-FP.

This is what I have:

components.xml:

<core:init debug="@debug@" jndi-pattern="@jndiPattern@"/>

components.properties:

jndiPattern \#{ejbName}/local

so basically you could do something like this in components.xml:

<core:init debug="true" jndi-pattern="\#{ejbName}/local"/>

So the question is why are you prefixing the jndi-pattern value with seamTrial?

 

Currently reading Seam 2.x Web Development by David Salter with DZone review publication forthcoming

JBoss Tools 3 Developers Guide is out now in paperback as well.

09. Jul 2009, 02:20 CET | Link

The thing es that seamTrial is the name of the project. I saw in another post that it was practical to put the project as a prefix, it was this thread:

http://seamframework.org/Community/ProblemsTryingToAccessEJB