[Installation, Configuration & Deployment] - Unable to deploy ejb3 entities and jsf web app in an ear?
by pbrewer_uk
I'm using JBoss 4.0.5 configured to use ejb3 via the jems installer.
I have a web application based on the myfaces JSF implementation combined with icefaces community edition 1.0.1 and facelets, which deploys without error into jboss. The package structure is defined below:
| web.war
| + META-INF
| - manifest.mf
|
| + WEB-INF
| + classes
| - list of my application's ejb3 entity beans
| - *list of my application's classes*
|
| + lib
| - activation.jar
| - backport-util.concurrent.jar
| - commons-beanutils.jar
| - commons-collections.jar
| - commons-digester.jar
| - commons-discovery.jar
| - commons-el.jar
| - commons-fileupload.jar
| - commons-logging.jar
| - el-api.jar
| - el-ri.jar
| - icefaces-comps.jar
| - icefaces-facelets.har
| - icefaces.jar
| - jaxb-api.jar
| - jaxb-impl.jar
| - jsp-api.jar
| - jsr173_1.0_api.jar
| - myfaces-api.jar
| - myfaces-impl.jar
| - xercesImpl.jar
| - xml-apis.jar
| - myfaces-api.jar
|
| - faces-config.xml
| - web.xml
|
| - example.xhtml
|
However, I want to add some ejb3 entities into the mix. Consequently, I've moved the "*list of my application's classes*" out of the web.war and into a separate jar file, called beans.jar, and also included the ejb3 entity classes. Then I bundled the whole lot into an ear file:
| app.ear
| + META-INF
| - application.xml
| - jboss-app.xml
|
| + beans.jar
| + META-INF
| - persistence.xml
|
| - *list of my application's classes*
|
| + web.war (same as above package except no classes directory)
|
The entity beans appear to deploy correctly in the logs, but the web application fails with the error below. If anyone has any ideas on this one I would be really grateful to hear them. If you want me to post any of my configuration files let me know and I'll post them up.
Thanks in advance, Peter.
| 2006-11-08 16:02:49,968 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/example]] Servlet /example threw load() exception
| java.lang.RuntimeException: java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
| If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
| A typical config looks like this;
| <listener>
| <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
| </listener>
|
| at com.icesoft.faces.webapp.xmlhttp.PersistentFacesCommonlet.init(PersistentFacesCommonlet.java:85)
| at com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet.init(PersistentFacesServlet.java:71)
| at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
| at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
| at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3951)
| at org.apache.catalina.core.StandardContext.start(StandardContext.java:4225)
| at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
| at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
| at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
| at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.apache.catalina.core.StandardContext.init(StandardContext.java:5052)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
| at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:297)
| at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:103)
| at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:371)
| at org.jboss.web.WebModule.startModule(WebModule.java:83)
| at org.jboss.web.WebModule.startService(WebModule.java:61)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
| at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| 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.start(Unknown Source)
| at org.jboss.system.ServiceController.start(ServiceController.java:417)
| at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| 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 $Proxy42.start(Unknown Source)
| at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| 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.jboss.DeployerInterceptor.start(DeployerInterceptor.java:92)
| at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
| at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
| 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 $Proxy43.start(Unknown Source)
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
| at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| 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 $Proxy6.deploy(Unknown Source)
| at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
| at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| 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.start(Unknown Source)
| at org.jboss.system.ServiceController.start(ServiceController.java:417)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| 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 $Proxy4.start(Unknown Source)
| at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| 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 $Proxy5.deploy(Unknown Source)
| at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
| at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
| at org.jboss.Main.boot(Main.java:200)
| at org.jboss.Main$1.run(Main.java:490)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
| If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
| A typical config looks like this;
| <listener>
| <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
| </listener>
|
| at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:90)
| at com.icesoft.faces.webapp.xmlhttp.PersistentFacesCommonlet.init(PersistentFacesCommonlet.java:60)
| ... 141 more
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984231#3984231
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984231
19Â years, 6Â months
[JBoss Seam] - Re: EntityManger-per-user-session...
by bkyrlach
Okay... so why doesn't this work...
First I create a parent and outject it to the Session context...
View...
| <h:form>
| <table>
| <tr>
| <td>Name:</td>
| <td><h:inputText value="#{newParent.name}"/></td>
| </tr>
| <tr>
| <td>Submit:</td>
| <td><h:commandButton action="#{parentActions.createParent}"/></td>
| </tr>
| </table>
| </h:form>
|
Model...
| @Entity
| @Name("parent")
| @Scope(ScopeType.SESSION)
| @Role(name="newParent", scope=ScopeType.EVENT)
| public class Parent implements Serializable
| {
| ...
| ...
| ...
| @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER, mappedBy="parent")
| public List<Child> getChildren()
| {
| return children;
| }
| public void setChildren(List<Child> children)
| {
| this.children = children;
| }
| ...
| ...
| ...
| }
|
Action...
| package sample.business.pc;
|
| import javax.ejb.Stateless;
| import javax.interceptor.Interceptors;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
|
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Out;
| import org.jboss.seam.contexts.Contexts;
| import org.jboss.seam.ejb.SeamInterceptor;
|
| import sample.model.pc.Parent;
|
| @Stateless
| @Name("parentActions")
| @Interceptors(SeamInterceptor.class)
| public class ParentActionsImpl implements ParentActions
| {
| @In(create=true)
| EntityManager em;
|
| @Out(required=false)
| Parent parent;
|
| @In(required=false)
| Parent newParent;
|
| public String createParent()
| {
| em.persist(newParent);
| parent = newParent;
| return "/pc/viewer.xhtml";
| }
|
| public Parent getParent(Long id)
| {
| return em.find(Parent.class, id);
| }
| }
|
And then go to create a child...
View...
| <h:form>
| <table>
| <tr>
| <td>Name:</td>
| <td><h:inputText value="#{child.name}"/></td>
| </tr>
| <tr>
| <td>Submit:</td>
| <td><h:commandButton action="#{childActions.createChild}"/></td>
| </tr>
| </table>
| </h:form>
|
Model...
| @Entity
| @Name("child")
| @Scope(ScopeType.CONVERSATION)
| public class Child implements Serializable
| {
| ...
| ...
| ...
| @ManyToOne
| public Parent getParent()
| {
| return parent;
| }
| public void setParent(Parent parent)
| {
| this.parent = parent;
| }
| ...
| ...
| ...
| }
|
Action...
| package sample.business.pc;
|
| import java.io.Serializable;
| import java.util.ArrayList;
| import java.util.List;
|
| import javax.ejb.Remove;
| import javax.ejb.Stateful;
| import javax.interceptor.Interceptors;
| import javax.persistence.EntityManager;
|
| import org.jboss.seam.ScopeType;
| import org.jboss.seam.annotations.Begin;
| import org.jboss.seam.annotations.Destroy;
| import org.jboss.seam.annotations.End;
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Out;
| import org.jboss.seam.annotations.Scope;
| import org.jboss.seam.ejb.SeamInterceptor;
|
| import sample.model.pc.Child;
| import sample.model.pc.Parent;
|
| @Stateful
| @Name("childActions")
| @Scope(ScopeType.CONVERSATION)
| @Interceptors(SeamInterceptor.class)
| public class ChildActionsImpl implements ChildActions, Serializable
| {
| @In(create=true)
| EntityManager em;
|
| @In
| Parent parent;
|
| @In(required=false)
| @Out(required=false)
| Child child;
|
| @In(create=true)
| ParentActions parentActions;
|
| @Begin
| public String preCreateChild()
| {
| parent = parentActions.getParent(parent.getId());
| return "/pc/createChild.xhtml";
| }
|
| @End
| public String createChild()
| {
| child.setParent(parent);
| List<Child> children = parent.getChildren();
| if(children == null)
| {
| children = new ArrayList<Child>();
| }
| children.add(child);
| parent.setChildren(children);
| return "/pc/viewer.xhtml";
| }
| ...
| ...
| ...
| }
|
So, when preCreate is called, I call ParentActions and get them to return me an attached instance of the current Parent using em.find(Parent.class, parent.getId()); This is inside a long runnig conversation, so you tell me that the same EntityManager instance is used for the entire conversation. Then, after injecting the newly created Child, I set it's parent, add it to the parents collection, and now I'm supposing the following should happen...
EntityManager discovers Parent is dirty and goes to merge it. Since Parents child collection is marked as cascade all, all of parents child elements should also be persisted, and my new child should be visible in the database. This isn't what's happening though.
Help?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984228#3984228
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984228
19Â years, 6Â months
[JCA/JBoss] - Special Portugese Characters cause queries to fail
by damo9f
We are testing in Portugese and find that if a query condition contains "special" characters such as ã and é the query does not work properly. HOWEVER if we use Hibernate Criterion the query works.
These characters have integer representations above 128, which may be relevant.
Deep in the query code (inside Hibernate) I see that the string in question does not show properly in the debugger when it is converted to a PreparedStatement. That is, the string shows fine but the toString() on the PreparedSTatement has the chars in question replaced by the little box that indicates a character is unknown.
We are using MySQL 4.1 and mysql-connector-java-3.0.16-ga.jar with the following mysql-ds.xml
| <?xml version="1.0" encoding="UTF-8"?>
|
| <datasources>
| <local-tx-datasource>
| <jndi-name>MySqlDS</jndi-name>
| <connection-url>jdbc:mysql://localhost:3306/imsma</connection-url>
| <driver-class>com.mysql.jdbc.Driver</driver-class>
| <user-name>imsma</user-name>
| <password>password</password>
| <min-pool-size>20</min-pool-size>
| <max-pool-size>45</max-pool-size>
| </local-tx-datasource>
| </datasources>
|
Can anyone help us diagnose this issue?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984227#3984227
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984227
19Â years, 6Â months
[JBoss Seam] - Application Startup Actions
by iradix
Is anyone using seam components to perform actions on the database when their application starts? With Seam 1.0 I had a few SFSB that were application scoped and used the @Startup and @Create methods to check if certain necessary data was available and create it if it wasn't. These are actions like determining if there is at least one administrative account and creating a default one if not, or defining static categories. These stopped working in 1.1 and rather than figuring out why, I'm looking for a better way to perform these types of actions. My two chief problems were/are:
1) These don't need to be SFSB because they only exists to fire off their create methods, yet I can't do that on application startup without scoping them to the application, and I can't place an SLSB in application scope.
2) I have no conversation available when the application starts up and this wreaks havoc with my DAOs which expect to be able to inject an SMPC.
Any ideas?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984225#3984225
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984225
19Â years, 6Â months