[JBoss Seam] - Unable to find XML mapping file in classpath: orm.xml
by arnieAustin
I am trying to get the orm.xml file recognized. It is stored in my projects' EJB-sub project /ejbModule/META-INF but it ends up in the WAR in WEB-INF/lib.
Even so, i still get the error message:
anonymous wrote : 13:13:09,328 INFO [Configuration] Reading mappings from resource: orm.xml
| 13:13:09,328 WARN [ServiceController] Problem starting service persistence.units:ear=DPSLicenseInquiry.ear,jar=DPSLicenseInquiryEJB.jar,unitName=PmgrDpsDrivers
| javax.persistence.PersistenceException: [PersistenceUnit: PmgrDpsDrivers] Unable to find XML mapping file in classpath: orm.xml
WHY? Isn't WEB-INF/lib on the path? Where is the file governing the construction of the WAR and EAR while in Eclipse/JBoss IDE2.x? There's nothing in the build folders!
The 2nd and possibly related error is:
anonymous wrote : [ServiceController] Problem starting service jboss.j2ee:service=EJB3,module=DPSLicenseInquiryEJB.jar
| java.lang.RuntimeException: Field javax.persistence.EntityManager us.tx.state.oag.DPSLicenseInquiry.business.DpsDriversList.DpsLicenseDatabase @PersistenceUnit in error: EMPTY STRING unitName and there is more than one scoped persistence unit at oag.jboss.ejb3.injection.PersistenceContextHandler.loadFieldDependencies(PersistenceContextHandler.java:358)
I don't see what the problem is:
<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="userDatabase">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/DPSLicenseInquiryDatasource</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="create"/>
| <property name="hibernate.cache.use_query_cache" value="true"/>
| <property name="hibernate.show_sql" value="true"/>
| </properties>
| </persistence-unit>
|
| <persistence-unit name="PmgrDpsDrivers">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/dpsLicensedDrivers</jta-data-source>
| <mapping-file>orm.xml</mapping-file>
| <class>us.tx.state.oag.DPSLicenseInquiry.business.DpsDriver</class>
| <properties>
| <property name="hibernate.dialect" value="org.hibernate.dialect.SybaseDialect"/>
| </properties>
| </persistence-unit>
|
| </persistence>
Another example had me add an entry to the components file:
<components>
| <component name="DpsLicenseDatabase"
| class="org.jboss.seam.core.ManagedPersistenceContext">
| <property name="persistenceUnitJndiName">java:/EntityManagerFactories/PmgrDpsDrivers</property>
| </component>
| </components>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3980799#3980799
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3980799
19 years, 6 months
[JNDI/Naming/Network] - ejb not bound (no security manager: RMI class loader disable
by Asia
I am using JBOSS 4.0.4-GA, J2EE1.4 and XDoclet 1.2.3 I have so far created three Stateful EJBs all of which have this following problem (code included just for one):
The following code:
| Object objref = initial.lookup("java:comp/env/QuestionFacadeHomeRemote");
|
Returns the following error:
QuestionFacadeHomeRemote not bound javax.naming.NameNotFoundException: QuestionFacadeHomeRemote not bound
I suspect that the reason is in the JNDI tree
Global JNDI Namespace has the following entry for the QuestionFacadeHomeRemote:
| +- QuestionFacadeHomeRemote (proxy: $Proxy74 implements No ClassLoaders found for: com.rev.sips.ejb.QuestionFacadeHome (no security manager: RMI class loader disabled))
|
The ejb-jar.xml has the following entry for the bean in question:
| <session id="Session_QuestionFacade">
| <description><![CDATA[An EJB named QuestionFacade]]></description>
| <display-name>QuestionFacade</display-name>
|
| <ejb-name>QuestionFacade</ejb-name>
|
| <home>com.rev.sips.ejb.QuestionFacadeHome</home>
| <remote>com.rev.sips.ejb.QuestionFacade</remote>
| <local-home>com.rev.sips.ejb.QuestionFacadeLocalHome</local-home>
| <local>com.rev.sips.ejb.QuestionFacadeLocal</local>
| <ejb-class>com.rev.sips.ejb.QuestionFacadeSession</ejb-class>
| <session-type>Stateful</session-type>
| <transaction-type>Container</transaction-type>
|
| </session>
|
and the QuestionFacadeHome.java has the following code in it:
|
| /*
| * Generated by XDoclet - Do not edit!
| */
| package com.rev.sips.ejb;
|
| /**
| * Home interface for QuestionFacade.
| * @generated
| * @wtp generated
| */
| public interface QuestionFacadeHome
| extends javax.ejb.EJBHome
| {
| public static final String COMP_NAME="java:comp/env/ejb/QuestionFacade";
| public static final String JNDI_NAME="QuestionFacadeHomeRemote";
|
| public com.revolution.sips.ejb.QuestionFacade create()
| throws javax.ejb.CreateException,java.rmi.RemoteException;
|
| }
|
The XDoclet for the bean is:
| /**
| *
| * <!-- begin-user-doc -->
| * A generated session bean
| * <!-- end-user-doc -->
| * *
| * <!-- begin-xdoclet-definition -->
| * @ejb.bean name="QuestionFacade"
| * description="An EJB named QuestionFacade"
| * display-name="QuestionFacade"
| * jndi-name="QuestionFacadeHomeRemote"
| * type="Stateful"
| * transaction-type="Container"
| * view-type="both"
| * local-jndi-name="QuestionFacadeHomeLocal"
| * @ejb.interface generate="local,remote"
| * @ejb.util generate="physical"
| * <!-- end-xdoclet-definition -->
| * @generated
| */
|
The entry in jboss.xml for this bean is:
| <session>
| <ejb-name>QuestionFacade</ejb-name>
| <jndi-name>QuestionFacadeHomeRemote</jndi-name>
| <local-jndi-name>QuestionFacadeHomeLocal</local-jndi-name>
|
| <method-attributes>
| </method-attributes>
| </session>
|
I have tried many variations on how JNDI entry is named (including ejb, local and such) but the problem still remains and the entry in the JNDI tree is always
| No ClassLoaders found for: com.rev.sips.ejb.QuestionFacadeHome (no security manager: RMI class loader disabled)
|
|
I can not grasp what causes this entry. Initially I was using MyEclipse to deploy the code to JBOSS but even when deploying it from the command line I still get all the same problem.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3980794#3980794
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3980794
19 years, 6 months
[JBoss Seam] - Issues with SeamTest and Pageflow
by marcioendo
I have just upgraded Seam to 1.1BETA1 and some of my jPDL pageflow unit tests have stopped working. Here are some issues:
First: if you don't define a 'redirect' tag for each page node, you get a NPE:
Pageflow.java:
| private void navigate(FacesContext context)
| {
| Page page = getPage();
| if ( !page.isRedirect() )
| {
| UIViewRoot viewRoot = context.getApplication().getViewHandler()
| .createView( context, page.getViewId() );
| context.setViewRoot(viewRoot);
| }
| else
| {
| Manager.instance().redirect( page.getViewId() );
| }
|
| counter++;
| setDirty();
| }
|
viewRoot is null as the following method is called
MockViewHandler.java
| @Override
| public UIViewRoot createView(FacesContext ctx, String viewId) {
| return null;
| }
|
and NPE occurs when it tries to call getViewId() in getViewRoot():
Pages.java
| public boolean callAction()
| {
| boolean result = false;
| FacesContext facesContext = FacesContext.getCurrentInstance();
| String viewId = facesContext.getViewRoot().getViewId();
| if (viewId!=null)
| {
| for (String wildcard: wildcardViewIds)
| {
| if ( viewId.startsWith( wildcard.substring(0, wildcard.length()-1) ) )
| {
| result = callAction(facesContext, wildcard) || result;
| }
| }
| }
| result = callAction(facesContext, viewId) || result;
| return result;
| }
|
And, for some reason, the method renderResponse() in SeamTest.Script is not being called whenever you set an outcome in invokeApplication(). Don't know exactly why this is happening yet.
My testing environment has EJB3_RC9, MyFaces 1.1.4 and Seam1.1B1. It also happens with the environment provided in Seam1.1.B1 package.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3980792#3980792
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3980792
19 years, 6 months
[Persistence, JBoss/CMP, Hibernate, Database] - Hibernate - Unable to locate current JTA transaction
by bmcgovern
My problem: I am trying to get transactions working with hibernate 3 and jboss 4.0.4.
I deployed my har file and it worked. I can get a currentSession() from JNDI, but I cannot get a transaction to work. It throughs Unable to locate current JTA transaction exception.
I'm not using EJBs, rather DAO. What am i doing wrong?
datasource-ds.xml
---------------------------------------------------------------
| <datasources>
| <local-tx-datasource>
| <jndi-name>TeenFitData</jndi-name>
| <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
| <connection-url>jdbc:jtds:sqlserver://192.168.100.102:1433;databaseName=Teenfit_Hibernate;tds=8.0;lastupdatecount=true</connection-url>
| <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
| <user-name>user</user-name>
| <password>pass</password>
| </local-tx-datasource>
| </datasources>
|
jboss-service.xml
---------------------------------------------------------------
<server>
| <mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.adminguide:name=ExampleSessionFactory">
| <attribute name="DatasourceName">java:/TeenFitData</attribute>
| <attribute name="Dialect"> org.hibernate.dialect.SQLServerDialect</attribute>
| <attribute name="SessionFactoryName">java:/teenfit/TeenFitDataSessionFactory </attribute>
| <attribute name="CacheProviderClass"> org.hibernate.cache.HashtableCacheProvider</attribute>
| <attribute name="Hbm2ddlAuto">create-drop</attribute>
| <attribute name="ShowSqlEnabled">true</attribute>
| </mbean>
| </server>
Data code
-----------------------------------------------
InitialContext ctx = new InitialContext();
| SessionFactory factory = (SessionFactory) ctx.lookup("java:/teenfit/TeenFitDataSessionFactory");
| //Session hsession = TeenFitHibernateUtil.getSessionFactory().getCurrentSession();
| Session hsession = factory.getCurrentSession();
| Transaction zTransaction = null;
| //zTransaction = (Transaction)new InitialContext().lookup("java:comp/UserTransaction");
|
| zTransaction = hsession.beginTransaction();
| System.out.println("**TRANSACTION FOUNT**" + hsession.getTransaction().toString());
|
| hsession.saveOrUpdate(HibernateTFUser);
|
|
| zTransaction.commit();
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3980791#3980791
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3980791
19 years, 6 months
[JBoss Seam] - Re: Challenge: Simple Example Adding Records With Lookup Dro
by petemuir
anonymous wrote : In Seam what are the best guidelines for determining when/when not to use SLSB/SFSB?
This is an interesting question. I think the answer depends on style/what you are doing.
I'm increasingly using the pattern of a stateful component to manage the flow and a stateless 'service' bean to do the rest of the work. I use bijection to pass any object required (so far only entities) between them.
The advantage of this approach I find is that, firstly, you seperate workflow logic from 'helper' methods resulting in clearer code (for example, deleting a user vs. reseting the password), secondly, it makes the 'helper' methods resuable (e.g. a nationality dropdown might be used in various places in your ui, so you want its content to be generated in a stateless fashion).
The disadvantage is complexity - and I am developing a complex workflow involving jbpm.
So, what I would do is create a 'roomService' bean which contains any non-workflow-related methods for rooms (e.g. drop down lists, generating access codes), and a 'roomCRUD' bean that contains the workflow methods. That doesn't mean its the best approach but it works well for me and avoids a lot of the concurrent access problems to stateful beans (though I believe the new seam fixes this).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3980785#3980785
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3980785
19 years, 6 months