[JBoss Seam] - Re: How to Extend Persistence Context Programatically
by bravefencer
so here is my code:
@Stateful
| @Scope(ScopeType.SESSION)
| @Name("SessionObjektAuswahl")
| public class SessionObjektAuswahl implements ISessionObjektAuswahl{
|
|
| @DataModel
| private List<KioskPC> kioskPCListe;
|
| @DataModelSelection
| @Out(required=false)
| private KioskPC kiosk;
|
| @Out(required=false)
| private KioskPC kiosk2;
|
| @In(required=false)
| private String DBname;
|
|
|
|
| EntityManager em;
|
| @Logger
| private Log log;
|
| private boolean toMitarbeiterAuswahl;
|
| @In(required=false)
| @Out(required=false)
| private boolean toAnwesenheit;
|
|
| @Create
| @Factory("kioskPCListe")
| public String retrieveAllKioskPCEintraege() {
|
| initialize();
| KioskPCAction kioskAction = new KioskPCAction();
| kioskPCListe = kioskAction.getAllFromDB(em);
|
| return null;
| }
|
| private void select(){
|
| }
|
|
|
| private void clearSelected(){
| kiosk = null;
|
| }
|
| @Remove @Destroy
| public void destroy() {
| // TODO Auto-generated method stub
|
| }
|
| public void remove() {
| // TODO Auto-generated method stub
|
| }
|
|
| @Override
| public void initialize() {
|
| em = (EntityManager)Component.getInstance("QMoDISZDB");
|
|
| //setLanguage();
| }
|
|
|
| private void setLanguage(){
| this.titleValueObjektauswahl = Parser.read(
| "FormObjektAuswahl.titel", sprache);
| this.buttonValueAlleObjekte = Parser.read(
| "FormObjektAuswahl.btAlleAuswaehlen", sprache);
| }
|
|
| @Override
| public String navigate(String id) {
|
| if(kiosk!=null){
| log.info(kiosk.getObjektKostenstelle());
| }
|
|
| if(toMitarbeiterAuswahl) {
|
| toMitarbeiterAuswahl = false;
|
| if(id.equals("startseite")){
| kiosk2=kiosk;
| return "mitarbeiterAuswahl";
| }
|
| else if(id.equals("clear")){
| kiosk2=null;
| return "nachrichtenUebersicht";
| }
| }
|
| else if (toAnwesenheit){
| toAnwesenheit = false;
| if (id.equals("startseite")){
| kiosk2=kiosk;
| return "anwesenheit";
| }else if(id.equals("clear")) {
| kiosk2=null;
| clearSelected();
| return "startseite";
| }
| }
|
| // else if (id.equals("anwesenheit")){
| // toAnwesenheit = true;
| // return "objektAuswahl";
| // }
| else if(id.equals("nachrichtErstellen"))
| {
| toMitarbeiterAuswahl=true;
| return "objektAuswahl";
| }
|
|
| else if(id.equals("startseite")){
| kiosk2=kiosk;
| return "startseite";
| }
| else if(id.equals("clear")) {
| kiosk2=null;
| clearSelected();
| return "startseite";
|
| }
|
| return null;
|
|
| }
|
| }
components.xml:
<core:managed-persistence-context name="QMoDISZDB"
| auto-create="true" persistence-unit-jndi-name="java:/DBzweiEntityManagerFactory" />
persistence.xml:
| <persistence-unit name="DBzwei">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/DBzweisource</jta-data-source>
|
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="none"/>
| <property name="hibernate.show_sql" value="true"/>
| <!-- 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="jboss.entity.manager.factory.jndi.name" value="java:/DBzweiEntityManagerFactory"/>
| </properties>
| </persistence-unit>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4090501#4090501
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4090501
17Â years
[JBoss Seam] - ant seam-gen created project.
by marius.oancea
I just created a new project with seam-gen cmd line utility (seam 2.0 beta).
All is ok except the following:
When I use @Stateless or @Statefull on a component i got:
18:35:09,281 INFO [Component] Component: mainWindow, scope: CONVERSATION, type: STATEFUL_SESSION_BEAN, class: test.MainWindowBean, JNDI: eptosiv/MainWindowBean/local
| 18:35:09,281 ERROR [[/eptosiv]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
| java.lang.RuntimeException: Could not create Component: mainWindow
| at org.jboss.seam.init.Initialization.addComponent(Initialization.java:9
| 55)
| at org.jboss.seam.init.Initialization.installComponents(Initialization.j
| ava:882)
| at org.jboss.seam.init.Initialization.init(Initialization.java:538)
| at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.j
|
|
Any ideea how to get rif of that?
I deploy on jboss 4.2 using ant deploy.
I tried seam restart and does not work.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4090500#4090500
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4090500
17Â years
[JBoss Seam] - Seam 2.0.0.CR1 TestNG problem
by ulath
i am trying to use SeamTest for integration test but i get the following error
javax.servlet.ServletException: ServletContext not allow to getResourceAsStream for /WEB-INF/web.xml
| at org.ajax4jsf.webapp.WebXml.init(WebXml.java:113)
| at org.ajax4jsf.resource.InternetResourceService.init(InternetResourceService.java:133)
| at org.ajax4jsf.webapp.BaseFilter.init(BaseFilter.java:148)
| at org.jboss.seam.web.Ajax4jsfFilter.init(Ajax4jsfFilter.java:86)
| at org.jboss.seam.servlet.SeamFilter.init(SeamFilter.java:97)
| at org.jboss.seam.mock.BaseSeamTest.createSeamFilter(BaseSeamTest.java:923)
| at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:904)
| at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
| 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.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604)
| at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:394)
| at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
| at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:79)
| at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:165)
| at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:103)
| at org.testng.TestRunner.runWorkers(TestRunner.java:678)
| at org.testng.TestRunner.privateRun(TestRunner.java:624)
| at org.testng.TestRunner.run(TestRunner.java:495)
| at org.testng.SuiteRunner.runTest(SuiteRunner.java:300)
| at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:295)
| at org.testng.SuiteRunner.privateRun(SuiteRunner.java:275)
| at org.testng.SuiteRunner.run(SuiteRunner.java:190)
| at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:792)
| at org.testng.TestNG.runSuitesLocally(TestNG.java:765)
| at org.testng.TestNG.run(TestNG.java:699)
| at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
| at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:122)
|
what could be the problem?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4090498#4090498
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4090498
17Â years
[JBoss/Spring Integration] - sessionFactory annotations jboss spring-modules
by cclafuente
I'm using springmodules annotations to the validation, and hibernate annotations to the persistent layer. With another application server, i haven't got any problem with my app, but in jboss it sends a exception, and don't deploy the war.
My configuration
in the dao layer:
| <!-- Hibernate SessionFactory -->
| <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
| <property name="dataSource" ref="dataSource"/>
| <property name="configurationClass">
| <value>org.hibernate.cfg.AnnotationConfiguration</value>
| </property>
| <property name="configLocation" value="classpath:hibernate.cfg.xml"/>
| <property name="hibernateProperties">
| <value>
| hibernate.dialect=${hibernate.dialect}
| hibernate.query.substitutions=true 'Y', false 'N'
| </value>
| </property>
| </bean>
| <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
| <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
| <property name="sessionFactory" ref="sessionFactory"/>
| </bean>
|
| <bean id="abstractDao" abstract="true">
| <property name="sessionFactory" ref="sessionFactory"/>
| </bean>
|
and the exception in jboss:
| org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [jar:file:/C:/java/jboss-4.0.3SP1/server/default/tmp/deploy/tmp1447mamba-webapp-1.0-M1-SNAPSHOT-exp.war/WEB-INF/lib/mamba-core-1.0-M1-SNAPSHOT.jar!/applicationContext-dao.xml]: Invocation of init method failed; nested exception is java.lang.ClassCastException: org.hibernate.validator.event.ValidateEventListener
| Caused by:
| java.lang.ClassCastException: org.hibernate.validator.event.ValidateEventListener
| at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:783)
|
I don't want to use hibernate validation annotations, i'm using spring-moduleas annotations.
What's the problem?
As i explain in previously posts, in tomcat my webapp runs correctly, without errors, but in jboss it doesn't run.
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4090494#4090494
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4090494
17Â years