[EJB/JBoss] - CMT and EJB 3 Question (Urgent).
by grdzeli_kaci
hi all,
i have simplest ejb 3 session bean :
| @Stateless
| @Remote(TestFasade.class)
| public class TestFasadeBean implements TestFasade {
|
| @PersistenceContext(unitName = "Oracle")
| EntityManager oracleManager;
|
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public Long create() {
| try {
| System.out.println("start creating");
| Test test = comit();
| Thread.sleep(10000);
| System.out.println("end creating");
| return test.getId();
| } catch (Exception e) {
| e.printStackTrace();
| return 0L;
| }
| }
|
| @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
| public Test comit() {
| try {
| System.out.println("start persisting");
| Test test = new Test();
| test.setAge(21L);
| test.setName("adsdasd");
| test.setSurname("asdasd");
| oracleManager.persist(test);
| oracleManager.flush();
| System.out.println("end persisting");
| return test;
| } catch (Exception e) {
| e.printStackTrace();
| return null;
| }
| }
| }
|
i need that after a comit() method information must be visible into database, this is not work. i see information into database after 10 second. why ? can anybody help?
is it possible to do by transaction demarcation? or how i can do it ?
i need to flush information after commit method ends.
any idea will be appreciated.
______________
Regards,
Paata.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4107574#4107574
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4107574
18 years, 6 months
[JBoss Seam] - Tomcat & Java 1.6SDK datasource problem
by Stateless Bean
Hi,
I use Seam 2.0.0GA, JBoss embedded, tomcat 6.0.13, and quartz.
When I moved my seam app from java 1.5 to 1.6 update 3 I get errors with datasource to my app and quartz?
Can anyone tell me what's wrong?
anonymous wrote :
| 10:54:10,812 ERROR [JNDIConnectionProvider] Error looking up datasource: Name UniversumDatasource is not bound in this Context
| javax.naming.NameNotFoundException: Name UniversumDatasource is not bound in this Context
| at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
| at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
| at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
| at javax.naming.InitialContext.lookup(Unknown Source)
| at org.quartz.utils.JNDIConnectionProvider.init(JNDIConnectionProvider.java:127)
| at org.quartz.utils.JNDIConnectionProvider.(JNDIConnectionProvider.java:105)
| at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:917)
| at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1355)
| at org.jboss.seam.async.QuartzDispatcher.initScheduler(QuartzDispatcher.java:69)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
| at org.jboss.seam.Component.callComponentMethod(Component.java:2074)
| at org.jboss.seam.Component.callCreateMethod(Component.java:1997)
| at org.jboss.seam.Component.newInstance(Component.java:1968)
| at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
| at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
| at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:95)
| at org.jboss.seam.init.Initialization.init(Initialization.java:555)
| at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:34)
| at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
| at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
| at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
| at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
| at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
| at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
| at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714)
| at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
| at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
| at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
| at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
| at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
| at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
| at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
| at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
| at org.apache.catalina.core.StandardService.start(StandardService.java:516)
| at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
| at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
| at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
| 10:54:10,843 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main
| 10:54:11,046 INFO [QuartzScheduler] Quartz Scheduler v.1.6.0 created.
| 10:54:11,062 INFO [JobStoreTX] Using thread monitor-based data access locking (synchronization).
| 10:54:11,078 ERROR [QuartzDispatcher] Cannot get or start a Quartz Scheduler
| org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'quartzDS': java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:/UniversumDatasource' javax.naming.NameNotFoundException: Name UniversumDatasource is not bound in this Context [See nested exception: java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:/UniversumDatasource' javax.naming.NameNotFoundException: Name UniversumDatasource is not bound in this Context]]
| at org.quartz.impl.jdbcjobstore.JobStoreSupport.initialize(JobStoreSupport.java:557)
| at org.quartz.impl.jdbcjobstore.JobStoreTX.initialize(JobStoreTX.java:59)
| at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1204)
| at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1355)
| at org.jboss.seam.async.QuartzDispatcher.initScheduler(QuartzDispatcher.java:69)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
| at org.jboss.seam.Component.callComponentMethod(Component.java:2074)
| at org.jboss.seam.Component.callCreateMethod(Component.java:1997)
| at org.jboss.seam.Component.newInstance(Component.java:1968)
| at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
| at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
| at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:95)
| at org.jboss.seam.init.Initialization.init(Initialization.java:555)
| at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:34)
| at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
| at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
| at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
| at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
| at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
| at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
| at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714)
| at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
| at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
| at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
| at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
| at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
| at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
| at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
| at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
| at org.apache.catalina.core.StandardService.start(StandardService.java:516)
| at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
| at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
| at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
| Caused by: org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'quartzDS': java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:/UniversumDatasource' javax.naming.NameNotFoundException: Name UniversumDatasource is not bound in this Context [See nested exception: java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:/UniversumDatasource' javax.naming.NameNotFoundException: Name UniversumDatasource is not bound in this Context]
| at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:636)
| at org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection(JobStoreTX.java:72)
| at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3659)
| at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3624)
| at org.quartz.impl.jdbcjobstore.JobStoreSupport.cleanVolatileTriggerAndJobs(JobStoreSupport.java:693)
| at org.quartz.impl.jdbcjobstore.JobStoreSupport.initialize(JobStoreSupport.java:555)
| ... 42 more
| Caused by: java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:/UniversumDatasource' javax.naming.NameNotFoundException: Name UniversumDatasource is not bound in this Context
| at org.quartz.utils.JNDIConnectionProvider.getConnection(JNDIConnectionProvider.java:166)
| at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:112)
| at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:633)
| ... 47 more
Here is my datasource
components.xml
| <core:init jndi-pattern="@jndiPattern@" debug="false"/>
|
ds.xml
| <datasources>
| <local-tx-datasource>
| <jndi-name>UniversumDatasource</jndi-name>
| <connection-url>jdbc:postgresql://localhost:5432/Universum</connection-url>
| <driver-class>org.postgresql.Driver</driver-class>
| <user-name>postgres</user-name>
| <password>root</password>
| <blocking-timeout-millis>50000</blocking-timeout-millis>
| </local-tx-datasource>
| </datasources>
|
and persistence.xml
| <?xml version="1.0" encoding="UTF-8"?>
| <persistence xmlns="http://java.sun.com/xml/ns/persistence"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
| version="1.0">
|
| <persistence-unit name="UniversumDatabase" transaction-type="JTA">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/UniversumDatasource</jta-data-source>
| <properties>
| <property name="dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
| <!-- These are the default for JBoss EJB3, but not for HEM: -->
| <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
| <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
|
| <property name="hibernate.cache.use_query_cache" value="true"/>
| <property name="hibernate.cache.region_prefix" value="hibernate.test"/>
| <property name="hibernate.jdbc.use_streams_for_binary" value="true"/>
| <!--
| <property name="hibernate.generate_statistics" value="false"/>
| <property name="hibernate.connection.isolation" value="4"/> -->
| <property name="hibernate.cache.use_minimal_puts" value="true"/>
| <property name="hibernate.cache.use_query_cache" value="true"/>
| <property name="hibernate.cache.use_structured_entries" value="true"/>
|
|
| <!-- <property name="hibernate.show_sql" value="true"/> -->
| <!-- <property name="hibernate.hbm2ddl.auto" value="create"/> -->
|
| <property name="hibernate.transaction.manager_lookup_class"
| value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
| <property name="jboss.entity.manager.factory.jndi.name"
| value="java:/sguEntityManagerFactory" />
| </properties>
| </persistence-unit>
| </persistence>
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4107567#4107567
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4107567
18 years, 6 months
[JBoss Seam] - Getting outjected object's attributes
by ferd0
This is a siplified problem of mine. I would like to see, if I am doing anything conceptually wrog.
This is my object (simplified):
Hotel
| int nrOfStars;
| @OneToMany
| List<Room> rooms;
I outject an instance of this object (or I use it in statefull session bean), and I try to show it's attributes in xhtml.
But I can display hotel's nubmer of stars, but I can not access list of rooms, although they are present (in database). I add rooms with "hotel.getRooms().add(room)".
I see correct output of <h:outputText value="#{hotel.nrOfStars}" />, but I can't see proprely <h:outputText value="#{fn:length(hotel.rooms)}" /> (I get always "0").
How can I access a list of objects in my outjected object? It works if I outject the list itself, but not if i try to access the list "in outjected parent object".
I hope I've explained the problem properly.
Ferd0
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4107566#4107566
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4107566
18 years, 6 months