[JBoss Seam] - Re: Seam, problem with EntityManager
by grdzeli_kaci
hi lowecg2004,
first of all thank you for your post, i tried all versions of seam and jboss application server,
is this so difficult that use seam and richfaces together ???
i already tried this for a week but could not resolve :(
environment :
1. JBoss AS 4.2.0GA
2. Seam 2.0.0.BETA1
3. Richfaces 3.0.1
4.ajax4jsf 1.1.1
here is my example simple dynamic tree generation into seam component :
1.MenuBean.java (Seam Component)
| @Name("menu")
| @Scope(ScopeType.SESSION)
| public class MenuBean{
|
| @In
| private EntityManager entityManager;
|
| private HtmlPanelBar bar = new HtmlPanelBar();
| public MenuBean() {
| }
|
| public HtmlPanelBar getBar() {
| if (bar!=null && bar.getChildren()!=null) {
| bar.getChildren().clear();
| }
|
| ArrayList<Menu> arraylist = (ArrayList<Menu>)entityManager.createNamedQuery("Menu.findAll").getResultList();
| for (Menu elem : arraylist) {
| HtmlPanelBarItem item= new HtmlPanelBarItem();
| item.setLabel("Blaaaa");
|
| Library library = new Library();
| HtmlTree tree = new HtmlTree();
| tree.setStyle("width:150px");
| tree.setValue(library.getData());
| tree.setVar("item");
| tree.setNodeFace(library.getType());
|
|
| Iterator<Artist> itArtists = library.getArtists().values().iterator();
| while (itArtists.hasNext()) {
| Artist artist = (Artist)itArtists.next();
|
| HtmlTreeNode artistNode = new HtmlTreeNode();
| artistNode.setType("artist");
| HtmlOutputText artistText = new HtmlOutputText();
| artistText.setValue(artist.getName());
|
| Iterator<Album> itAlbums = artist.getAlbums();
| while (itAlbums.hasNext()) {
| Album album = (Album) itAlbums.next();
|
| HtmlTreeNode albumNode = new HtmlTreeNode();
| albumNode.setType("album");
| HtmlOutputText albumText = new HtmlOutputText();
| albumText.setValue(album.getTitle());
|
| Iterator<Song> itSongs = album.getSongs();
| while (itSongs.hasNext()) {
| Song song = (Song) itSongs.next();
|
| HtmlTreeNode songNode = new HtmlTreeNode();
| songNode.setType("song");
| HtmlOutputText songText = new HtmlOutputText();
| songText.setValue(song.getTitle());
|
| tree.getChildren().add(songNode);
| }
| tree.getChildren().add(albumNode);
| tree.getChildren().add(artistNode);
| item.getChildren().add(tree);
| bar.getChildren().add(item);
| }
| }
| }
| return bar;
| }
| public void setBar(HtmlPanelBar bar) {
| this.bar = bar;
| }
| }
|
1.Home.xhtml (Presentation Layer)
| <ui:define name="body">
|
| <h:messages globalOnly="true" styleClass="message"/>
| <h:form id="bodyForm">
| <rich:panel>
| <f:facet name="header">Welcome!</f:facet>
| <p>This empty shell application includes:</p>
| <ul>
| <li>Ant build script</li>
| <li>Deployment to JBoss AS</li>
| <li>Integration testing using TestNG and JBoss Embeddable EJB3</li>
| <li>EJB 3.0 Seam components</li>
| <li>Templated Facelets views</li>
| <li>HSQL (or MySQL) Datasource</li>
| <li>Default CSS stylesheet</li>
| <li>Internationalization support</li>
| </ul>
| <rich:panelBar binding="#{menu.bar}" width="500" height="600">
| </rich:panelBar>
| </rich:panel>
| </h:form>
| </ui:define>
|
i always get this error :
| Caused by: org.jboss.seam.RequiredException: In attribute requires non-null value: menu.entityManager
| at org.jboss.seam.Component.getValueToInject(Component.java:2042)
| at org.jboss.seam.Component.injectAttributes(Component.java:1481)
| at org.jboss.seam.Component.inject(Component.java:1302)
|
i tried to find something into seam code but i could not find anything for this issue,
you told me about configurations lowecg200, here is my configurations :
1.components.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:persistence="http://jboss.com/products/seam/persistence"
| xmlns:drools="http://jboss.com/products/seam/drools"
| xmlns:security="http://jboss.com/products/seam/security"
| xmlns:mail="http://jboss.com/products/seam/mail"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation=
| "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
| http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
| http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.0.xsd
| http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
| http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.0.xsd
| http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
|
| <core:init debug="@debug@" jndi-pattern="@jndiPattern@"/>
|
| <core:manager concurrent-request-timeout="500"
| conversation-timeout="120000"
| conversation-id-parameter="cid"/>
|
|
| <persistence:managed-persistence-context name="entityManager"
| auto-create="true"
| persistence-unit-jndi-name="java:/NewBillingEntityManagerFactory"/>
|
| <drools:rule-base name="securityRules">
| <drools:rule-files>
| <value>/security.drl</value>
| </drools:rule-files>
| </drools:rule-base>
|
| <security:identity authenticate-method="#{authenticator.authenticate}"
| security-rules="#{securityRules}"/>
|
| <event type="org.jboss.seam.notLoggedIn">
| <action expression="#{redirect.captureCurrentView}"/>
| </event>
| <event type="org.jboss.seam.postAuthenticate">
| <action expression="#{redirect.returnToCapturedView}"/>
| </event>
| <mail:mail-session host="localhost" port="2525" username="test" password="test" />
| </components>
|
here is managed-persistence-context defined
2.persistence.xml
| <?xml version="1.0" encoding="UTF-8"?>
| <!-- Persistence deployment descriptor for dev profile -->
| <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="NewBilling">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/NewBillingDatasource</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="validate"/>
| <property name="hibernate.cache.use_query_cache" value="true"/>
| <property name="hibernate.show_sql" value="true"/>
| <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
|
| <!-- use a file system based index -->
| <property name="hibernate.search.default.directory_provider"
| value="org.hibernate.search.store.FSDirectoryProvider"/>
| <!-- directory where the indexes will be stored -->
| <property name="hibernate.search.default.indexBase" value="./dvdindexes"/>
| <!-- Not needed with HA 3.3 -->
| <property name="hibernate.ejb.event.post-insert" value="org.hibernate.search.event.FullTextIndexEventListener"/>
| <property name="hibernate.ejb.event.post-update" value="org.hibernate.search.event.FullTextIndexEventListener"/>
| <property name="hibernate.ejb.event.post-delete" value="org.hibernate.search.event.FullTextIndexEventListener"/>
|
|
| <property name="jboss.entity.manager.factory.jndi.name" value="java:/NewBillingEntityManagerFactory"/>
|
| <property name="hibernate.default_schema" value="JITS"/>
| </properties>
| </persistence-unit>
| </persistence>
|
also here is jndi.name defined correctly.
i also saw dvd example and i could not find difference into configurations.
have you ever tried to use richfaces and seam together ??
and i have one another question also, if i have one ejb interface and seam components which is also bean for component (for example richfaces treenode bean) how i can call ejb component ?? @EJB does not work, i like separated logic : business layer - presentation layer, how i can call ejb component ?
Any idea will be appreciated.
________________________
Regards,
Paata.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060650#4060650
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060650
18Â years, 9Â months
[EJB 3.0] - Exception got in deployment of EJB3 .ear
by ashusri000
Hi All ,
I am using ejb3 along with JBoss 4.2.0 , Java5 and Oracle Toplink as the persistence provider and Oracle 10g . After having deployed my datasource successfully , when I deploy my ear file , I get this error :
Please help me out .
11:17:51,078 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=persist.jar
java.lang.RuntimeException: No container configured with name 'Stateless Bean''
at org.jboss.ejb3.Ejb3AnnotationHandler.getStatelessContainer(Ejb3AnnotationHandler.java:249)
at org.jboss.ejb3.Ejb3AnnotationHandler.getContainers(Ejb3AnnotationHandler.java:145)
at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:468)
at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:424)
at org.jboss.ejb3.Ejb3Deployment.deployUrl(Ejb3Deployment.java:405)
at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:366)
at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:321)
at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:77)
at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:243)
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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.create(Unknown Source)
at org.jboss.system.ServiceController.create(ServiceController.java:330)
at org.jboss.system.ServiceController.create(ServiceController.java:273)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy33.create(Unknown Source)
at org.jboss.ejb3.EJB3Deployer.create(EJB3Deployer.java:492)
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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
at org.jboss.ws.integration.jboss42.DeployerInterceptor.create(DeployerInterceptor.java:73)
at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(SubDeployerInterceptorSupport.java:180)
at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:91)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy34.create(Unknown Source)
at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969)
at org.jboss.deployment.MainDeployer.create(MainDeployer.java:959)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy9.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060648#4060648
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060648
18Â years, 9Â months
[JBoss Portal] - Re: RichFaces : sample for ajax jsf portlet provided
by Antoine_h
ho ho ! are you trying with JBP 2.4.1 ?
This version is not able for using any Ajax feature (for RichFaces or any other thing). And it is not easy to have work with Ajax, for what I saw.
Ajax in portlet is a new feature of JBP 2.6.0.
That is why, with this version, using RichFaces becomes possible.
See the RichFaces Jira indicated above in previous post of this thread.
so, you have to use JBP2.6 (GA release was out a few days ago).
As far as I am doing, migrating from JBP2.4.1 to JBP2.6 is some work, depending of what things you have done to customize your portal on JBP2.4.1.
It is some work, but all is worthy : nice features, better way of doing things. It is not a waste of time at all !
And the Ajax feature is a very nice bonus (among others) that comes with JBP2.6.
I guess you are not far from succes !
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060644#4060644
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060644
18Â years, 9Â months