Hi, this sticky thread got a bit messy: Seam is not relevant in the discussion.
Injecting an EntityManager in a servlet is just wrong: servlets get concurrent
requests and you really don't want an instance level EntityManager; Inject the
EntityManagerFactory instead and use it to create a new
to get EntityManager you have to use EntityManager
em=(EntityManager)Component.getInstance(entitymanagername)
but to access EM you have to configure components.xml first.
Until you got JEE5 app server anotations may not work.
I dont have config files. I will post my configuration files
TestInterface testBean= (TestInterface) Component.getInstance(TestBean.class);
or
EntityManager
entitiyManager=(EntityManager)Component.getInstance(entityManager);
View the original post :
http://www.jboss.com/index.html?module=bbop=viewtopicp=4105654#4105654
Reply to the post :
if you are using Seam Add this line to your component.xml
?xml version=1.0 encoding=UTF-8?
components xmlns=http://jboss.com/products/seam/components;
xmlns:core=http://jboss.com/products/seam/core;
xmlns:drools=http://jboss.com/products/seam/drools;
Thanks for your hint Wolfgang!
I tried to put the persitence.xml everywhere in the war file without success.
WEB-INF/persistence.xml
WEB-INF/META-INF/persistence.xml
WEB-INF/classes/persistence.xml
WEB-INF/classes/META-INF/persistence.xml
Maybe i also should have posted my persistence.xml:
|
Hi !
Try /META-INF ;-)
http://javahowto.blogspot.com/2007/06/where-to-put-persistencexml-in-web-app.html
Hope this helps
Wolfgang
View the original post :
http://www.jboss.com/index.html?module=bbop=viewtopicp=4097881#4097881
Reply to the post :
Hi Zyborg,
I think persistence.xml has a module scope. If you need it in the WAR file, you
have to add one. You cannot access the one of the EJB jar.
Hope this helps
Wolfgang
View the original post :
http://www.jboss.com/index.html?module=bbop=viewtopicp=4096907#4096907
Reply to the post :
hi all!
my application is packed into a .ear file and gets deployed into a jboss 5
beta2.
i am trying to inject a EntityManager from a servlet without success ...
should my scenario work or is there something i misunderstood?
maybe its just a deployment failure - so i packaged my ear file note
Hi,
My application consists of the a JSF Page that has a backing bean-
view.backing.Start.
here i'm trying to lookup my ejb using
@EJB(mappedName=...jndiName)
private JBejb obj;
where JBejb is the remote interface of my SLSB-JBejbBean.
i am facing the problem that my JBoss4.2.1 server is
I have noticed and also mentioned in this forum then @EJB does not work in
versions prior to jboss 5. So can any when tell what is the alternate ejb3
injection annotation for jboss. Will @Resource work, if yes then how?
View the original post :
I´m trying to do JPA Injection in a WAR module with JBoss 5 beta2.
I´m configuring the persistence.xml according to
http://docs.jboss.org/ejb3/app-server/reference/build/reference/en/html/entityconfig.html
Here is my persistence.xml:
persistence version=1.0
|
JBoss 4.2.1 doen´t seem to support JPA Injection in servlets either.
Trying the same WAR i have tryed with 5 beta2, I´m facing the following
problems:
The Persistence Unit is not considered automatically.
I had to manually start the EMFactory up from a Filter.init or some
Hello,
I agree the way you get the Home interface of a session bean, but I am not able
to do the same for an entity.
There is no JNDI entry for the entities beans.
I can see only the persistence manager:
+- persistence.units:ear=myapp.ear,unitName=MyUnit (class:
I tried to set the EntityManager using it's factory, but I have a transaction
exception about setting an autcomit
EntityManagerFactory entityManagerFactory =
Persistence.createEntityManagerFactory(MyUnit);
this.entityManager = entityManagerFactory.createEntityManager();
Any idea?
Regards
JF
Regarding getting the EM from JNDI, see:
http://www.jboss.com/index.html?module=bbop=viewtopict=113694postdays=0postorder=ascstart=10#4069334
S,
ALR
View the original post :
http://www.jboss.com/index.html?module=bbop=viewtopicp=4069338#4069338
Reply to the post :
i have also seen that, within the AS, in the same ear, EJB injections do not
work. So if an EJB access another EJB using @EJB it works. But if the EJB
access another class (simple POJO) which uses @EJB, the injection doesnt work
(EJB-POJO-EJB does not work, though POJO is in the same EAR file
tinny wrote : So JBoss 5.0 beta2 supports servlet injection? Or is the
functionality only going to be fully delivered in the final release?
|
Yes and Yes. The only injection I've heard that doesn't currently work is @EJB
in the web layer. But everything in the JEE5 spec will be delivered
So JBoss 5.0 beta2 supports servlet injection? Or is the functionality only
going to be fully delivered in the final release?
View the original post :
http://www.jboss.com/index.html?module=bbop=viewtopicp=4057245#4057245
Reply to the post :
Hello,
I wanted to use EJB3 with JSF1.2 and injection. For this combination you have
to do a little bit more work in JBoss-4.2.0.GA. This is how injection worked
for me:
The ejb jar and war file are deployed separate from each other in the same
deploy diectory. So not in an EAR file! There is
There is little trick using the injection and JSF1.2 backing beans.
If you plan to use the bean during the constructor of the backing bean, that
won't work.
In my backing beans I do call e.g. a find() method in the backing bean from
within the constructor.
But in the old situation the first
I see that this thread and its contents have been given sticky status, yet
there seems to be little content in it.
No offense to Wolfgang here, but is that what passes for good coverage of a
problem like this? I mean, release 4.2 was touted as being fully Java EE
compliant (I paraphrase)
One thing to add: Injection in a JSF mananged bean will work in JBoss 4.2
I managed to achieve this only by accessing the ENC:
@EJB(name=java:comp/env/ejb/MyBeanLocal)
| private MyBeanLocal myBean;
I had to declare it in web.xml and jboss-web.xml.
This is my jboss-web.xml:
?xml version=1.0
22 matches
Mail list logo