[JBoss Seam] - Re: When to use @PersistenceContext vrs @In EntityManager (S
by reind
I have a SFSB that is invoked in multiple requests without a clear Begin or End. It uses a SLSB to get a reference to an entity.
Here's an example from my project (note this worked in 1.2.1):
Foo is session scoped, so I expect its instance variables to stay around and managed. When I invoke a() the 'entity' ref is set. When I then invoke b(), entity is not-null and I can even get lazy loaded properties.
With Seam 1.2.1 this worked, now with 2.0 it no longer works. I'm not sure what's changed between versions that would cause this.
With 2.0. I get a NPE when trying to access 'entity' from a seperate request. I can get around this by creating a @Begin @Create public void init() {} method in Foo, but that's an ugly workaround.
The seam SMPC in a Session bean should be session scoped, and any entities that it retrieves should also be managed throughout the session, right?
| @Name
| @Scope(STATEFULL)
| @Stateful
| public class FooImpl implenents Foo {
| @In
| EntityManager entityManager;
|
| @In
| Bar bar;
|
| private entity;
|
| // several methods that access 'entity' and access lazy loaded
| // properties of entity
| public void a() {
| entity = bar.getEntity();
| // do something
| }
|
| public void b() {
| entity.getProperty();
| entity.getLazyProperty();
| }
| }
|
| @Name
| @Stateless
| public class BarImpl implenents Bar {
| @In
| EntityManager entityManager;
|
| public Entity getEntity() {
| entityManager.find(Bar.class, ...);
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4127422#4127422
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4127422
18 years, 2 months
[Installation, Configuration & DEPLOYMENT] - Re: No more console messages after first deployment - jboss
by oldpasha74
I am using 4.2.1.GA, but the problem is the same with other versions. I expect deployment- or redeployment-messages or sysouts to the console coming from my beans. Yes i did try to access the beans - as i wrote - the server works and the beans can be called too. I see nothing suspicious in the log files. Shall I post the whole file (800k)? Here you can see the log entries in server.xml for the first time I deploy. This deployment is also being logged to the console. All following un- or redeployments do work too (ejb-changes can be tested by my client), but on the server console you dont see anything. The server.xml has also no information about the un- or redeployment. It seems that the whole logging stops at some point.
2008-02-07 15:25:59,586 INFO [org.jboss.system.server.Server] JBoss (MX MicroKernel) [4.2.1.GA (build: SVNTag=JBoss_4_2_1_GA date=200707131605)] Started in 44s:984ms
2008-02-07 15:26:09,150 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] Periodic recovery - second pass <Do, 7 Feb 2008 15:26:09>
2008-02-07 15:26:09,150 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] AtomicActionRecoveryModule: Second pass
2008-02-07 15:26:09,150 DEBUG [com.arjuna.ats.txoj.logging.txojLoggerI18N] [com.arjuna.ats.internal.txoj.recovery.TORecoveryModule_6] - TORecoveryModule - second pass
2008-02-07 15:26:09,150 DEBUG [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.recovery.info.secondpass] Local XARecoveryModule - second pass
2008-02-07 15:28:09,143 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] Periodic recovery - first pass <Do, 7 Feb 2008 15:28:09>
2008-02-07 15:28:09,143 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] StatusModule: first pass
2008-02-07 15:28:09,143 DEBUG [com.arjuna.ats.txoj.logging.txojLoggerI18N] [com.arjuna.ats.internal.txoj.recovery.TORecoveryModule_3] - TORecoveryModule - first pass
2008-02-07 15:28:09,143 DEBUG [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.recovery.info.firstpass] Local XARecoveryModule - first pass
2008-02-07 15:28:19,147 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] Periodic recovery - second pass <Do, 7 Feb 2008 15:28:19>
2008-02-07 15:28:19,147 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] AtomicActionRecoveryModule: Second pass
2008-02-07 15:28:19,147 DEBUG [com.arjuna.ats.txoj.logging.txojLoggerI18N] [com.arjuna.ats.internal.txoj.recovery.TORecoveryModule_6] - TORecoveryModule - second pass
2008-02-07 15:28:19,147 DEBUG [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.recovery.info.secondpass] Local XARecoveryModule - second pass
2008-02-07 15:29:59,661 DEBUG [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/C:/ide/jboss-4.2.1.GA/server/all/deploy/beans.jar
2008-02-07 15:29:59,661 DEBUG [org.jboss.deployment.MainDeployer] Starting deployment (init step) of package at: file:/C:/ide/jboss-4.2.1.GA/server/all/deploy/beans.jar
2008-02-07 15:29:59,661 DEBUG [org.jboss.deployment.MainDeployer] Copying file:/C:/ide/jboss-4.2.1.GA/server/all/deploy/beans.jar -> C:\ide\jboss-4.2.1.GA\server\all\tmp\deploy\tmp59349beans.jar
2008-02-07 15:29:59,671 DEBUG [org.jboss.deployment.MainDeployer] using deployer MBeanProxyExt[jboss.ejb:service=EJBDeployer]
2008-02-07 15:29:59,671 DEBUG [org.jboss.ejb.EJBDeployer] init, beans.jar
2008-02-07 15:29:59,702 DEBUG [org.jboss.ejb.EJBDeployer] looking for nested deployments in : file:/C:/ide/jboss-4.2.1.GA/server/all/deploy/beans.jar
2008-02-07 15:29:59,702 DEBUG [org.jboss.deployment.DeploymentInfo] createLoaderRepository from config: LoaderRepositoryConfig(repositoryName: JMImplementation:service=LoaderRepository,name=Default, repositoryClassName: null, configParserClassName: null, repositoryConfig: null)
2008-02-07 15:29:59,702 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.UnifiedLoaderRepository3@27e353, cl=org.jboss.mx.loading.UnifiedClassLoader3@1bd8993{ url=file:/C:/ide/jboss-4.2.1.GA/server/all/tmp/deploy/tmp59349beans.jar ,addedOrder=0}
2008-02-07 15:29:59,702 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.UnifiedLoaderRepository3@27e353, cl=org.jboss.mx.loading.UnifiedClassLoader3@1bd8993{ url=file:/C:/ide/jboss-4.2.1.GA/server/all/tmp/deploy/tmp59349beans.jar ,addedOrder=0}
2008-02-07 15:29:59,702 DEBUG [org.jboss.mx.loading.UnifiedLoaderRepository3] Adding org.jboss.mx.loading.UnifiedClassLoader3@1bd8993{ url=file:/C:/ide/jboss-4.2.1.GA/server/all/tmp/deploy/tmp59349beans.jar ,addedOrder=0}
2008-02-07 15:29:59,702 DEBUG [org.jboss.deployment.MainDeployer] found 0 subpackages of file:/C:/ide/jboss-4.2.1.GA/server/all/deploy/beans.jar
2008-02-07 15:29:59,702 DEBUG [org.jboss.deployment.MainDeployer] Watching new file: file:/C:/ide/jboss-4.2.1.GA/server/all/deploy/beans.jar
2008-02-07 15:29:59,702 DEBUG [org.jboss.deployment.MainDeployer] create step for deployment file:/C:/ide/jboss-4.2.1.GA/server/all/deploy/beans.jar
2008-02-07 15:29:59,702 DEBUG [org.jboss.ejb.EJBDeployer] create, beans.jar
2008-02-07 15:30:00,252 DEBUG [org.jboss.ejb.EJBDeployer] Verifying file:/C:/ide/jboss-4.2.1.GA/server/all/deploy/beans.jar
2008-02-07 15:30:00,292 DEBUG [org.jboss.ejb.EJBDeployer.verifier] Bean checked: BankAccount: Verified.
2008-02-07 15:30:00,292 DEBUG [org.jboss.ejb.EJBDeployer.verifier] Bean checked: BruttoNettoBean: Verified.
2008-02-07 15:30:00,322 DEBUG [org.jboss.ejb.EJBDeployer] Deploying: file:/C:/ide/jboss-4.2.1.GA/server/all/deploy/beans.jar
2008-02-07 15:30:00,322 DEBUG [org.jboss.system.ServiceController] Creating service jboss.j2ee:service=EjbModule,module=beans.jar
2008-02-07 15:30:00,322 DEBUG [org.jboss.ejb.EjbModule] Creating jboss.j2ee:service=EjbModule,module=beans.jar
2008-02-07 15:30:00,322 DEBUG [org.jboss.ejb.EjbModule] createService, begin
2008-02-07 15:30:00,322 INFO [org.jboss.ejb.EjbModule] Deploying BankAccount
2008-02-07 15:30:00,352 DEBUG [org.jboss.ejb.EjbModule] Creating WebClassLoader of class org.jboss.web.WebClassLoader
2008-02-07 15:30:00,393 DEBUG [org.jboss.ejb.EjbModule] creating binding for BankAccountEntityBeanJNDI:entity-unified-invoker
2008-02-07 15:30:00,423 DEBUG [org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy] Cache policy timer started, tasksTimer=java.util.Timer@1823918
2008-02-07 15:30:00,443 INFO [org.jboss.ejb.EjbModule] Deploying BruttoNettoBean
2008-02-07 15:30:00,463 DEBUG [org.jboss.ejb.EjbModule] Creating WebClassLoader of class org.jboss.web.WebClassLoader
2008-02-07 15:30:00,483 DEBUG [org.jboss.ejb.EjbModule] creating binding for BruttoNettoBeanJNDI:stateful-unified-invoker
2008-02-07 15:30:00,493 DEBUG [org.jboss.system.ServiceController] Creating service jboss.j2ee:jndiName=BankAccountEntityBeanJNDI,service=EJB
2008-02-07 15:30:00,493 DEBUG [org.jboss.system.ServiceController] adding depends in ServiceController.register: []
2008-02-07 15:30:00,493 DEBUG [org.jboss.ejb.EntityContainer] Creating jboss.j2ee:jndiName=BankAccountEntityBeanJNDI,service=EJB
2008-02-07 15:30:00,513 DEBUG [org.jboss.system.ServiceController] Creating service jboss.j2ee:service=EJB,plugin=pool,jndiName=BankAccountEntityBeanJNDI
2008-02-07 15:30:00,513 DEBUG [org.jboss.ejb.plugins.EntityInstancePool] Creating jboss.j2ee:service=EJB,plugin=pool,jndiName=BankAccountEntityBeanJNDI
2008-02-07 15:30:00,513 DEBUG [org.jboss.ejb.plugins.EntityInstancePool] Created jboss.j2ee:service=EJB,plugin=pool,jndiName=BankAccountEntityBeanJNDI
2008-02-07 15:30:00,513 DEBUG [org.jboss.system.ServiceController] Creating dependent components for: jboss.j2ee:service=EJB,plugin=pool,jndiName=BankAccountEntityBeanJNDI dependents are: []
2008-02-07 15:30:01,084 DEBUG [org.jboss.proxy.ejb.ProxyFactory] Proxy Factory for BankAccountEntityBeanJNDI initialized
2008-02-07 15:30:01,094 DEBUG [org.jboss.ejb.EntityContainer] Created jboss.j2ee:jndiName=BankAccountEntityBeanJNDI,service=EJB
2008-02-07 15:30:01,094 DEBUG [org.jboss.system.ServiceController] Creating dependent components for: jboss.j2ee:jndiName=BankAccountEntityBeanJNDI,service=EJB dependents are: []
2008-02-07 15:30:01,094 DEBUG [org.jboss.ejb.EjbModule] Bound jmxName=jboss.j2ee:jndiName=BankAccountEntityBeanJNDI,service=EJB, hash=-1033608632into Registry
2008-02-07 15:30:01,094 DEBUG [org.jboss.system.ServiceController] Creating service jboss.j2ee:jndiName=BruttoNettoBeanJNDI,service=EJB
2008-02-07 15:30:01,094 DEBUG [org.jboss.system.ServiceController] adding depends in ServiceController.register: []
2008-02-07 15:30:01,094 DEBUG [org.jboss.ejb.StatefulSessionContainer] Creating jboss.j2ee:jndiName=BruttoNettoBeanJNDI,service=EJB
2008-02-07 15:30:01,104 DEBUG [org.jboss.ejb.StatefulSessionContainer] Mapped info HASH -177545549to public java.util.Properties ejb.bruttonetto.BruttoNettoBean.info()
2008-02-07 15:30:01,104 DEBUG [org.jboss.ejb.StatefulSessionContainer] Mapped getNetto HASH -2122264257to public double ejb.bruttonetto.BruttoNettoBean.getNetto(double)
2008-02-07 15:30:01,104 DEBUG [org.jboss.ejb.StatefulSessionContainer] Mapped getBrutto HASH -409681219to public double ejb.bruttonetto.BruttoNettoBean.getBrutto(double)
2008-02-07 15:30:01,104 DEBUG [org.jboss.ejb.StatefulSessionContainer] Mapped Container method remove HASH -1842617161
2008-02-07 15:30:01,104 DEBUG [org.jboss.ejb.StatefulSessionContainer] Mapped Container method isIdentical HASH 285457048
2008-02-07 15:30:01,104 DEBUG [org.jboss.ejb.StatefulSessionContainer] Mapped Container method getHandle HASH 1182305581
2008-02-07 15:30:01,104 DEBUG [org.jboss.ejb.StatefulSessionContainer] Mapped Container method getEJBHome HASH -993218923
2008-02-07 15:30:01,104 DEBUG [org.jboss.ejb.StatefulSessionContainer] Mapped Container method getPrimaryKey HASH -131865408
2008-02-07 15:30:01,104 DEBUG [org.jboss.proxy.ejb.ProxyFactory] Proxy Factory for BruttoNettoBeanJNDI initialized
2008-02-07 15:30:01,104 DEBUG [org.jboss.system.ServiceController] Creating service jboss.j2ee:service=EJB,plugin=pool,jndiName=BruttoNettoBeanJNDI
2008-02-07 15:30:01,104 DEBUG [org.jboss.ejb.plugins.StatefulSessionInstancePool] Creating jboss.j2ee:service=EJB,plugin=pool,jndiName=BruttoNettoBeanJNDI
2008-02-07 15:30:01,104 DEBUG [org.jboss.ejb.plugins.StatefulSessionInstancePool] Created jboss.j2ee:service=EJB,plugin=pool,jndiName=BruttoNettoBeanJNDI
2008-02-07 15:30:01,104 DEBUG [org.jboss.system.ServiceController] Creating dependent components for: jboss.j2ee:service=EJB,plugin=pool,jndiName=BruttoNettoBeanJNDI dependents are: []
2008-02-07 15:30:01,104 DEBUG [org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager] Creating StatefulSessionFilePersistenceManager
2008-02-07 15:30:01,104 DEBUG [org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager] Storing sessions for 'BruttoNettoBean' in: C:\ide\jboss-4.2.1.GA\server\all\tmp\sessions\BruttoNettoBean-fcdep7yo-7
2008-02-07 15:30:01,104 DEBUG [org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager] Purging all session data in: C:\ide\jboss-4.2.1.GA\server\all\tmp\sessions\BruttoNettoBean-fcdep7yo-7
2008-02-07 15:30:01,104 DEBUG [org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager] Created StatefulSessionFilePersistenceManager
2008-02-07 15:30:01,124 DEBUG [org.jboss.ejb.StatefulSessionContainer] Created jboss.j2ee:jndiName=BruttoNettoBeanJNDI,service=EJB
2008-02-07 15:30:01,124 DEBUG [org.jboss.system.ServiceController] Creating dependent components for: jboss.j2ee:jndiName=BruttoNettoBeanJNDI,service=EJB dependents are: []
2008-02-07 15:30:01,124 DEBUG [org.jboss.ejb.EjbModule] Bound jmxName=jboss.j2ee:jndiName=BruttoNettoBeanJNDI,service=EJB, hash=1554929794into Registry
2008-02-07 15:30:01,124 DEBUG [org.jboss.ejb.EjbModule] Created jboss.j2ee:service=EjbModule,module=beans.jar
2008-02-07 15:30:01,124 DEBUG [org.jboss.system.ServiceController] Creating dependent components for: jboss.j2ee:service=EjbModule,module=beans.jar dependents are: []
2008-02-07 15:30:01,124 DEBUG [org.jboss.deployment.MainDeployer] Done with create step of deploying beans.jar
2008-02-07 15:30:01,124 DEBUG [org.jboss.deployment.MainDeployer] Begin deployment start file:/C:/ide/jboss-4.2.1.GA/server/all/deploy/beans.jar
2008-02-07 15:30:01,124 DEBUG [org.jboss.ejb.EJBDeployer] start application, deploymentInfo: org.jboss.deployment.DeploymentInfo@3ccb22bf { url=file:/C:/ide/jboss-4.2.1.GA/server/all/deploy/beans.jar }
deployer: MBeanProxyExt[jboss.ejb:service=EJBDeployer]
status: Starting
state: START_DEPLOYER
watch: file:/C:/ide/jboss-4.2.1.GA/server/all/deploy/beans.jar
altDD: null
lastDeployed: 1202394599702
lastModified: 1202394599661
mbeans:
jboss.j2ee:jndiName=BankAccountEntityBeanJNDI,service=EJB state: Created
jboss.j2ee:jndiName=BruttoNettoBeanJNDI,service=EJB state: Created
, short name: beans.jar, parent short name: null
2008-02-07 15:30:01,124 DEBUG [org.jboss.system.ServiceController] starting service jboss.j2ee:service=EjbModule,module=beans.jar
2008-02-07 15:30:01,124 DEBUG [org.jboss.ejb.EjbModule] Starting jboss.j2ee:service=EjbModule,module=beans.jar
2008-02-07 15:30:01,124 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.BankAccount] Initializing CMP plugin for BankAccount
2008-02-07 15:30:01,144 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.BankAccount] Loading standardjbosscmp-jdbc.xml : file:/C:/ide/jboss-4.2.1.GA/server/all/conf/standardjbosscmp-jdbc.xml
2008-02-07 15:30:01,684 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.BankAccount] jar:file:/C:/ide/jboss-4.2.1.GA/server/all/tmp/deploy/tmp59349beans.jar!/META-INF/jbosscmp-jdbc.xml found. Overriding defaults
2008-02-07 15:30:01,795 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] internalRegisterPool: registering pool with interval 900000 old interval: 9223372036854775807
2008-02-07 15:30:01,795 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] internalRegisterPool: about to notify thread: old next: 1202395051795, new next: 1202395051795
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4127414#4127414
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4127414
18 years, 2 months
[JBoss Seam] - Stateless EJB cant be invoked by POJO
by QPool.Char
Hello, i have a strange problem using SEAM.
I have a Stateless Session Bean:
@Stateless
| @Name("ProcessStarter")
| //@JndiName("ProcessStarterBean")
| public class ProcessStarterBean implements ProcessStarter{
| ...
|
| public void startProcess(ExeWorkflowCreator creator)
| throws ExeDocFrameworkException {
|
Which is invoked by another stateless Session Bean:
@Stateless
| @Name("menuPrincipal")
| public class MenuPrincipalBean implements MenuPrincipal {
| @EJB ProcessStarter processStarter;
|
| public String startDemoWorkflow2() {
| System.out.println("Starte Demo Workflow 2...");
| try {
| processStarter.startProcess(new DemoWorkflow2());
| }
| catch (ExeDocFrameworkException e) {
| e.printStackTrace();
| }
| return "home";
| }
|
This WORKS.
But now, i want this MenuPrincipalBean to invoke a normal Java Class called "DemoWorkflow" like this:
public String startDemoWorkflow() {
| System.out.println("Starte Demo Workflow...");
| try {
| DemoWorkflow dw = new DemoWorkflow();
| dw.startProcess(dw);
| }
|
with DemoWorkflow being a normal Java class (no sessionbean) which inherits another normal Java class which will then do the method-invocation and the ejb-injection.
DemoWorkflow inherits ExeWorkflowGate:
@Name("ExeWorkflowGate")
| public class ExeWorkflowGate {
|
| @EJB ProcessStarter processStarter;
|
| public void startProcess(ExeWorkflowCreator exeWorkflowCreator)
| throws ExeDocFrameworkException {
| processStarter.startProcess(exeWorkflowCreator);
| }
|
I found out that injection doesnt work here, because the injected beanAttribute is always NULL. Furthermore, i tried everything to invoke the EJB with a JNDI-lookup, but it always says that the Bean is not bound...
The strange thing is that the injection from sessionBean---->sessionBean works, but normal class ----> sessionBean doesnt work.
I also tried to let the DemoWorkflow participate in SEAM Framework by adding @Name("...") annotation...
Anymore suggestions or explanations por favor ?
Thx in advance
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4127410#4127410
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4127410
18 years, 2 months