EJB-QL rownum
in EJB-QL of an Entity Bean , can I select the first 10 rows from the table
and if it's possible can I change it to the 10-20 rows?
No you cannot, cuz in EJBQL you always return a Collection/Set and they are not ordered. And there is no way to get only a part of the resultset.
Usually a situation like getting part of a result set comes when you are getting HUGE data back from the datastore. In such cases, you can do one of the following things
(1) Use a DAO pattern
(2) Use BMP's and use SQL statements so you have more control.
(3) Use ejbSelect methods and get the primary keys of the records you need so that u can lookup the record using findByPrimaryKey(). However this method will be slow and you will be making n+1 calls for n records.
NOTE: Above 3 points are mere suggestions and they are for different cases. I just listed them here so that u can see if anything helps you.
Regards,
Meka Toka
Similar Messages
-
[b]how to use EJB QL for LIKE and ROWNUM[/b]
Hi,
i am using CMP EJB with OC4J server
i face two problems in it when i make any query like
select object(o) from Partymas o where o.stationCode like '?1' and o.rownum >='?2' and o.rownum <='?3' order by party_name
then it shows error on rownum so i cant understand how to solve it
second is when i use LIKE statment in EJB QL like this:-
select object(o) from Partymas o where o.pinCode like '%?%'
then it shows error so can any one help me
thanks
warm regards
vikassheelgupta<ejb-ql>select object(o) from Partymas o where o.stationCode like '?1' and
rownum >='?2' and rownum <='?3' order by party_name</ejb-ql>Try this:
rownum >= ?2 and rownum <= ?3
<ejb-ql>select object(o) from Partymas o where o.partyName like '%?%'</ejb-ql>Try this:
like ?1 -
Using rownum in EJB-QL ..Pagination using CMP 2.1
Hi ,
Hope this is the right forum .. rather than JDBC .
My requirement is to implement Pagination using EJB2.1 on weblogic with Oracle DB. This is for an application which is quite old system and is not ready yet to be migrated to EJB3.0. So we are struck with EJB2.1 at the moment.
We are using EJB-QL to get Search result and now need to add Pagination logic in it. I can find weblogic.ejb.PreparedQuery.setMaxElements() API to specify the upper limit but what am looking for is a lower limit ..somthing like setFirstRow() ..
Can it be done using CMP Entity Bean 2.1 .. EJBQL or someother way ?
I have the sql for pagination but am not sucessful in translating it to EJB-QL
select * from
select /*+ FIRST_ROWS(n) */ a.*, ROWNUM rnum from
(your_query_goes_here) a
where ROWNUM <=:MAX_ROW_TO_FETCH
where rnum >= :MIN_ROW_TO_FETCH;
Thanks in advance ! I hope I get a solution soon ..
Edited to get some answers !!!
is it possible to use rownum in EJBQL ? I know rownum is specific to Oracle and my application will stay with Oracle. I get this exception
"EJB QL compilation encountered error: [EJB:013042]The Identifier 'rownum' is neither a cmp-field nor a cmr-field. Re-examine your query."
Edited by: user11305835 on Oct 12, 2009 10:48 PMBeevin
Both two are not even validated,
but with the first one as select max(c.id) from customer as c , in this case it is validated but while deploying it is error as , object must be return
But when i saw the ejb2.1 specification we can write this type of queries also ?
Is it problem with was any thing
Regards
Somaraju -
Restricting number of rows in EJB QL using rowNum or rowId
Hii Javaites
I am using EJB finder methods to get a a list of records from database.
Now i want that only particular number of records should be fetched.
For tht i want 2 use rownum or rowId.
Can anyone plz tell me can we do tht in EJB QL.
I m using Weblogic 8shouldn't use rownum or rowid to do such a thing.
% -
Hi all,
Im using jdeveloper 11g. I have this query in my ejb object "select o.field from table o where rownum < 5". When i run my test client i get this error:
javax.ejb.EJBException: EJB Exception: ; nested exception is:
javax.persistence.PersistenceException: Exception [EclipseLink-8004] (Eclipse Persistence Services - 1.2.0.v20091016-r5565): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Error compiling the query [Prospect.getFirstFive: select o.partnername from Prospect o where rownum < 10], line 1, column 43: unknown identification variable [rownum]. The FROM clause of the query does not declare an identification variable [rownum].; nested exception is: javax.persistence.PersistenceException: Exception [EclipseLink-8004] (Eclipse Persistence Services - 1.2.0.v20091016-r5565): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Error compiling the query [Prospect.getFirstFive: select o.partnername from Prospect o where rownum < 10], line 1, column 43: unknown identification variable [rownum]. The FROM clause of the query does not declare an identification variable [rownum].
javax.persistence.PersistenceException: Exception [EclipseLink-8004] (Eclipse Persistence Services - 1.2.0.v20091016-r5565): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Error compiling the query [Prospect.getFirstFive: select o.field from table o where rownum < 5], line 1, column 43: unknown identification variable [rownum]. The FROM clause of the query does not declare an identification variable [rownum].
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:290)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:14
Why is rownum not recognized by ejb?Tnx Pedja it worked!
This is the method im using
public List<String> getFirstFive(String searchPrepix) {
Query query = em.createNamedQuery("Table.getFirstFive");
query.setParameter("searchPrepix", searchPrepix);
query.setMaxResults(5);
return query.getResultList();
Edited by: Azzaiel on May 31, 2010 6:14 PM -
Can someone tell me how to use Dates in EJB-QL WHERE clause??? I am using CMP2.0.
Thanks in advanceHi,
EJB 2.0 QL will not support most of the sql query key words like order by,rownum etc.I am not sure abt date.So u first check out whether it's support "dates" -
Oc4j generated finders in orion-ejb-jar.xml file causing errors
Any information or assistance would be greatly appreciated.
I have encountered a problem with the generated orion-ejb-jar.xml file.
It looks like the additional finder methods that are generated when the application
is deployed are incorrect from the 9.0.3 version to the new 10.1.2.0.2 version.
The original content of orion-ejb-jar.xml before additional finder syntax is added:
<finder-method query=
"NO_SYS_USER_OBJECT_HISTORY.USER_ID=UPPER($1) and
NO_SYS_USER_OBJECT_HISTORY.AUTOID NOT IN(
SELECT H1.AUTOID
FROM NO_SYS_USER_OBJECT_HISTORY H1,
(SELECT AUTOID
FROM NO_SYS_USER_OBJECT_HISTORY
WHERE USER_ID=UPPER($1)
ORDER BY DATE_TIME DESC) H2
WHERE ROWNUM <= $2
AND H1.AUTOID = H2.AUTOID)">
<method>
<ejb-name>NoUserHistoryEntry</ejb-name>
<method-name>findOldest</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.Integer</method-param>
</method-params>
</method>
</finder-method>
After deploying in 9.0.3 the following information is added to the orion-ejb-jar.xml file:
<finder-method query=
"NO_SYS_USER_OBJECT_HISTORY.USER_ID=UPPER($1) and
NO_SYS_USER_OBJECT_HISTORY.AUTOID NOT IN(
SELECT H1.AUTOID
FROM NO_SYS_USER_OBJECT_HISTORY H1,
(SELECT AUTOID
FROM NO_SYS_USER_OBJECT_HISTORY
WHERE USER_ID=$1
ORDER BY DATE_TIME DESC) H2
WHERE ROWNUM <= $2
AND H1.AUTOID = H2.AUTOID)">
<!-- Generated SQL:
"select NO_SYS_USER_OBJECT_HISTORY.autoid
from NO_SYS_USER_OBJECT_HISTORY
where NO_SYS_USER_OBJECT_HISTORY.USER_ID=UPPER(?)
and NO_SYS_USER_OBJECT_HISTORY.AUTOID NOT IN(
SELECT H1.AUTOID
FROM NO_SYS_USER_OBJECT_HISTORY H1,
(SELECT AUTOID
FROM NO_SYS_USER_OBJECT_HISTORY
WHERE USER_ID=?
ORDER BY DATE_TIME DESC) H2
WHERE ROWNUM <= ?
AND H1.AUTOID = H2.AUTOID) -->
<method>
<ejb-name>NoUserHistoryEntry</ejb-name>
<method-name>findOldest</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.Integer</method-param>
</method-params>
</method>
</finder-method>
After deploying in 10.1.2.0.2 the following information is added to the
orion-ejb-jar.xml file:
<finder-method query=
"NO_SYS_USER_OBJECT_HISTORY.USER_ID=UPPER($1) and
NO_SYS_USER_OBJECT_HISTORY.AUTOID NOT IN(
SELECT H1.AUTOID
FROM NO_SYS_USER_OBJECT_HISTORY H1,
(SELECT AUTOID
FROM NO_SYS_USER_OBJECT_HISTORY
WHERE USER_ID=UPPER($1)
ORDER BY DATE_TIME DESC) H2
WHERE ROWNUM <= $2
AND H1.AUTOID = H2.AUTOID)">
<!-- Generated SQL (pk only):
"select H1.autoid
from NO_SYS_USER_OBJECT_HISTORY
where NO_SYS_USER_OBJECT_HISTORY.USER_ID=UPPER(?)
and NO_SYS_USER_OBJECT_HISTORY.AUTOID NOT IN(
SELECT H1.AUTOID
FROM NO_SYS_USER_OBJECT_HISTORY H1,
(SELECT AUTOID
FROM NO_SYS_USER_OBJECT_HISTORY
WHERE USER_ID=UPPER(?)
ORDER BY DATE_TIME DESC) H2
WHERE ROWNUM <= ?
AND H1.AUTOID = H2.AUTOID) -->
<!-- Generated SQL (all columns):
"select H1.autoid, H1.USER_ID, H1.OBJECT_CLASS_ID,
H1.DATE_TIME, H1.COMMENT_TEXT, H1.ACTION,
H1.ACTION_DATA, H1.SITE_DESCRIPTION
from NO_SYS_USER_OBJECT_HISTORY
where NO_SYS_USER_OBJECT_HISTORY.USER_ID=UPPER(?)
and NO_SYS_USER_OBJECT_HISTORY.AUTOID NOT IN(
SELECT H1.AUTOID
FROM NO_SYS_USER_OBJECT_HISTORY H1,
(SELECT AUTOID
FROM NO_SYS_USER_OBJECT_HISTORY
WHERE USER_ID=UPPER(?)
ORDER BY DATE_TIME DESC) H2
WHERE ROWNUM <= ?
AND H1.AUTOID = H2.AUTOID) -->
<method>
<ejb-name>NoUserHistoryEntry</ejb-name>
<method-name>findOldest</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.Integer</method-param>
</method-params>
</method>
</finder-method>
The problem with the 10.1.2.0.2 generated finders is that it is prepending H1 when
it should be NO_SYS_USER_OBJECT_HISTORY which results in the following error:
Exception in thread "main" com.cdtelecom.vygroe.configuration.ConfigurationException:
com.evermind.server.rmi.OrionRemoteException:
Transaction was rolled back: Database error: java.sql.SQLException:
ORA-00904: "H1"."SITE_DESCRIPTION": invalid identifier
; nested exception is:
java.sql.SQLException: ORA-00904: "H1"."SITE_DESCRIPTION": invalid identifier
at com.cdtelecom.vygroe.configuration.ConfigurationSession.internalRecordAction(ConfigurationSession.java:869)
at com.cdtelecom.vygroe.configuration.ConfigurationSession.recordAction(ConfigurationSession.java:401)
at com.cdtelecom.vygroe.configuration.Configuration.recordActionSaveOrder(Configuration.java:886)
at com.cdtelecom.vygroe.configuration.Configuration.getOrder(Configuration.java:239)
at test10g.main(test10g.java:47)
I tried to manually edit the file but when I shutdown and restart oc4j it regenerates the file again.Jingzhi -- If you define the correct EJB-QL you should get the correct SQL generated for the finder. If that's not happening can you verify it against the OC4J v903 production release and see if it is still happening. I don't know if this helps with the JDeveloper problem specifically but if you don't need to create your own finders then that I hope should help.
Thanks -- Jeff -
Error while calling a method on Bean (EJB 3.0)
I am getting an error while calling a method on EJB. I am using EJB3.0 and my bean is getting properly deployed(i am sure b'cos i can see the successfullly deployed message). Can any body help me
Error is -->
Error while destroying resource :An I/O error has occured while flushing the output - Exception: java.io.IOException: An established connection was aborted by the software in your host machine
Stack Trace:
java.io.IOException: An established connection was aborted by the software in your host machine
at sun.nio.ch.SocketDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:33)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)
at sun.nio.ch.IOUtil.write(IOUtil.java:75)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:302)
at com.sun.enterprise.server.ss.provider.ASOutputStream.write(ASOutputStream.java:138)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at org.postgresql.PG_Stream.flush(PG_Stream.java:352)
at org.postgresql.core.QueryExecutor.sendQuery(QueryExecutor.java:159)
at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:70)
at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:482)
at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:461)
at org.postgresql.jdbc1.AbstractJdbc1Connection.rollback(AbstractJdbc1Connection.java:1031)
at org.postgresql.jdbc2.optional.PooledConnectionImpl$ConnectionHandler.invoke(PooledConnectionImpl.java:223)
at $Proxy34.close(Unknown Source)
at com.sun.gjc.spi.ManagedConnection.destroy(ManagedConnection.java:274)
at com.sun.enterprise.resource.LocalTxConnectorAllocator.destroyResource(LocalTxConnectorAllocator.java:103)
at com.sun.enterprise.resource.AbstractResourcePool.destroyResource(AbstractResourcePool.java:603)
at com.sun.enterprise.resource.AbstractResourcePool.resourceErrorOccurred(AbstractResourcePool.java:713)
at com.sun.enterprise.resource.PoolManagerImpl.putbackResourceToPool(PoolManagerImpl.java:424)
at com.sun.enterprise.resource.PoolManagerImpl.resourceClosed(PoolManagerImpl.java:393)
at com.sun.enterprise.resource.LocalTxConnectionEventListener.connectionClosed(LocalTxConnectionEventListener.java:69)
at com.sun.gjc.spi.ManagedConnection.connectionClosed(ManagedConnection.java:618)
at com.sun.gjc.spi.ConnectionHolder.close(ConnectionHolder.java:163)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.closeDatasourceConnection(DatabaseAccessor.java:379)
at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.closeConnection(DatasourceAccessor.java:367)
at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.closeConnection(DatabaseAccessor.java:402)
at oracle.toplink.essentials.internal.databaseaccess.DatasourceAccessor.afterJTSTransaction(DatasourceAccessor.java:100)
at oracle.toplink.essentials.threetier.ClientSession.afterTransaction(ClientSession.java:104)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.afterTransaction(UnitOfWorkImpl.java:1816)
at oracle.toplink.essentials.transaction.AbstractSynchronizationListener.afterCompletion(AbstractSynchronizationListener.java:161)
at oracle.toplink.essentials.transaction.JTASynchronizationListener.afterCompletion(JTASynchronizationListener.java:87)
at com.sun.ejb.containers.ContainerSynchronization.afterCompletion(ContainerSynchronization.java:174)
at com.sun.enterprise.distributedtx.J2EETransaction.commit(J2EETransaction.java:467)
at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:357)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3653)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:197)
at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:110)
at $Proxy84.addDepartment(Unknown Source)
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 com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:650)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:193)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1705)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1565)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:947)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:178)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:717)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:473)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1270)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:479)
End of Stack Trace
|#]
RAR5035:Unexpected exception while destroying resource. To get exception stack, please change log level to FINE.
EJB5018: An exception was thrown during an ejb invocation on [DepartmentSessionBean]
javax.ejb.EJBException: Unable to complete container-managed transaction.; nested exception is: javax.transaction.SystemException
javax.transaction.SystemException
at com.sun.enterprise.distributedtx.J2EETransaction.commit(J2EETransaction.java:452)
at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:357)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3653)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:197)
at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:110)
at $Proxy84.addDepartment(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)Means theres an error in XML/ABAP conversion probably due a syntax error...
Regards
Juan -
How can connect different ejb server in one client program
hi , every
i want to make connect ejb server into one client program.
for that , but i try to change PROVIDER_URL property , it's not correct
who solve this problem for novice? :(You need to create separate initialContext to each of the different servers
and lookup up the different ejbs.
-Sabha
"inking" <[email protected]> wrote in message
news:[email protected]..
hi , every
i want to make connect ejb server into one client program.
for that , but i try to change PROVIDER_URL property , it's not correct
who solve this problem for novice? :( -
How can i design a EJB application using session Beans?
Hello,
I am designing a Find application using EJB. Here a user is prompted a search page, where he can enter the search criteria's. Then on click of submit, the query is formed at the server side depending on what criteria's were selected. Then a jdbc query is performed and the results are returned back to the user. Here no session is maintained for the users. Can anyone suggest me how to design this application using EJB. Should i use entity beans for this or session beans will suffice? Should the jdbc query be performed in the bean itself or should it be outside in a helper class? Please kindlu suggest me the design for this application...
Regards,
SubbuHi,
First of all, I'm unable to figure out why you need to use EJB for this scenario. You can write a helper class to frame and execute the query.
If you really want to use EJB, then I suggest you use a stateless Session Bean with transaction attribute as TX_NOT_SUPPORTED. From the session bean, you can call the helper class. But, by avoiding the session bean, you can eliminate remote calls, thus improving your performance. Also, check if the database & the db driver you are using supports sql caching.
Regards,
Raj. -
Error connecting to an EJB 3.0 Remote on OC4J 10.1.3.2 from Tomcat
Hi, I want to connect to a Remote Session Bean running on the OC4J 10.1.3 and it doesn´t work.
I have connected to it from a java standalone application using:
public static void main(String [] args) {
try {
final Context context = getInitialContext();
SessionEJB sessionEJB = (SessionEJB)context.lookup("java:comp/env/ejb/SessionEJB");
System.out.println(sessionEJB.mergeEntity(""));
System.out.println( "hola" );
} catch (Exception ex) {
ex.printStackTrace();
private static Context getInitialContext() throws NamingException {
Hashtable env = new Hashtable();
// Standalone OC4J connection details
env.put( Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.naming.ApplicationClientInitialContextFactory" );
env.put( Context.SECURITY_PRINCIPAL, "oc4jadmin" );
env.put( Context.SECURITY_CREDENTIALS, "passw" );
env.put(Context.PROVIDER_URL, "ormi://localhost:23791/ejb3jar");
return new InitialContext( env );
with this application-client.xml file:
<?xml version = '1.0' encoding = 'windows-1252'?>
<application-client xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd" version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee">
<display-name>Model-app-client</display-name>
<ejb-ref>
<ejb-ref-name>ejb/SessionEJB</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<remote>ar.com.eds.ejb3.model.SessionEJB</remote>
<ejb-link>SessionEJB</ejb-link>
</ejb-ref>
thats works fine, but when I try to use the same solution from a jsf proyect running on a Tomcat 5.5.20, it fails with this error:
Caused by: java.lang.RuntimeException: Error while creating home.
at ar.com.mcd.fawkes.ui.locator.EJB3Locator.get(EJB3Locator.java:32)
at ar.com.mcd.fawkes.ui.locator.ServiceLocator$1.get(ServiceLocator.java:12)
at net.sf.opentranquera.web.jsf.locator.ServiceLocatorBean.get(ServiceLocatorBean.java:42)
at com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:79)
at com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:187)
at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:171)
at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:263)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:160)
... 80 more
Caused by: javax.naming.NameNotFoundException: Name ejb is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:769)
at org.apache.naming.NamingContext.lookup(NamingContext.java:139)
at org.apache.naming.NamingContext.lookup(NamingContext.java:780)
at org.apache.naming.NamingContext.lookup(NamingContext.java:139)
at org.apache.naming.NamingContext.lookup(NamingContext.java:780)
at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:136)
at javax.naming.InitialContext.lookup(Unknown Source)
at ar.com.mcd.fawkes.ui.locator.EJB3Locator.get(EJB3Locator.java:28)
... 87 more
Could you please help me with any tip?
Mauricio
Message was edited by:
MauricioHi, Rick
Thanks for your help.
I deleted de application-client.xml file, added the following lines to the web.xml file:
<ejb-ref>
<ejb-ref-name>ejb/SessionEJB</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<remote>ar.com.eds.ejb3.model.SessionEJB</remote>
</ejb-ref>
and now I´m using oracle.j2ee.rmi.RMIInitialContextFactory
there is no error, and it doesn´t throw any exception but the following line returns null.
SessionEJB sessionEJB = (SessionEJB)context.lookup("java:comp/env/ejb/SessionEJB");
Its seems the lookup method finds the remote ejb because it doesn´t fail, but it returns null.
Any idea what is wrong?
Mauricio. -
Error in deploying a simple EJB 3.0
Hi ,
I am getting the following error while deploying my simple ejb of version 3.0 in Weblogic 9.2.
Exception preparing module: EJBModule(build) [EJB:011023]An error occurred while reading the deployment descriptor. The error was: Error processing annotations: java.lang.NullPointerException.
During my evaluation of Weblogic 9.2 for EJB 3.0 , I have got the following questions.
EJB Specification states that EJB's in EJB 3.0 can be developed and deployed without the need of deployment descriptors. I have created a simple EJB with two file Env.java and EnvBean.java and the source code is given below.
a) I just complied these class files and when I was trying to deploy without ejb-jar.xml and weblogic-ejb-jar.xml, the console was not at all allowing me to deploy.Why is this so?
b) After I created a META-INF file under root of classes directory by placing ejb-jar.xml with empty <enterprise-beans> element, console was allowing me to deploy with errors in parsing ejb-jar.xml. The error was either session/entity/mdb is a required under <enterprise-beans> element. Why is this required when there are several examples stating <enterprise-beans> element can be empty.
c) Later I updated ejb-jar.xml with <session> element under <enterprise-beans> with the following values. I got the above error when deployed with this change.
I had been struggling to deploy this simple bean for almost a day.Pleas point me if there is any documentation that solves my stated problem or if there is a solution.Thanks in advance.
regards
Karim
ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" version="3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
<enterprise-beans>
<session>
<description>This is the stateless ejb</description>
<display-name>Env Bean</display-name>
<ejb-name>EnvBean</ejb-name>
</session>
</enterprise-beans>
</ejb-jar>
Env.java
package examples ;
public interface Env {
public void display();
EnvBean.java
package examples;
import javax.ejb.Remote;
import javax.ejb.Stateless;
@Stateless
@Remote(Env.class)
public class EnvBean implements Env {
public void display() {
System.out.println("Welcome to EJB 3.0");
}Presumably you're using the EJB3 tech preview, and not a vanilla WebLogic 9.2 install, right?
Can you post the full stack trace?
-Patrick -
Error while calling ejb service call from BPM service
Hi,
We are using the Oracle 11.1.1.5.0
We are calling ejb service call from BPM service to update the data to Oracle database.
We are getting the below error when we executing the ejb service call from BPM Service.
<Error> <EJB> <BEA-010026> <Exception occurred du
ring commit of transaction Name=[EJB oracle.bpm.bpmn.engine.ejb.impl.BPMNDeliver
yBean.handleCallback(java.lang.String,java.lang.String,java.lang.String,int,bool
ean)],Xid=BEA1-45B91984D57960994897(30845116),Status=Rolled back. [Reason=javax.
transaction.xa.XAException: JDBC driver does not support XA, hence cannot be a p
articipant in two-phase commit. To force this participation, set the GlobalTrans
actionsProtocol attribute to LoggingLastResource (recommended) or EmulateTwoPhas
eCommit for the Data Source = EBSConnection],numRepliesOwedMe=0,numRepliesOwedOt
hers=0,seconds since begin=1,seconds left=60,XAServerResourceInfo[SOADataSource_
base_domain]=(ServerResourceInfo[SOADataSource_base_domain]=(state=rolledback,as
signed=soa_server1),xar=SOADataSource,re-Registered = false),XAServerResourceInf
o[ArCnTaskForms@EBSConnection@EBSConnection_base_domain]=(ServerResourceInfo[ArC
nTaskForms@EBSConnection@EBSConnection_base_domain]=(state=rolledback,assigned=s
oa_server1),xar=weblogic.jdbc.wrapper.JTSEmulateXAResourceImpl@fa5476,re-Registe
red = false),SCInfo[base_domain+soa_server1]=(state=rolledback),properties=({web
logic.jdbc.remote.EBSConnection=t3://192.168.10.114:8001, weblogic.transaction.n
ame=[EJB oracle.bpm.bpmn.engine.ejb.impl.BPMNDeliveryBean.handleCallback(java.la
ng.String,java.lang.String,java.lang.String,int,boolean)]}),local properties=({w
eblogic.jdbc.jta.SOADataSource=[ No XAConnection is attached to this TxInfo ]}),
OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=soa
server1+192.168.10.114:8001+basedomain+t3+, XAResources={eis/tibjms/Queue, eis
/activemq/Queue, WLStore_base_domain_BPMJMSFileStore, WLStore_base_domain__WLS_s
oa_server1, eis/fioranomq/Topic, eis/jbossmq/Queue, eis/Apps/Apps, eis/websphere
mq/Queue, eis/AQ/aqSample, WLStore_base_domain_SOAJMSFileStore, eis/aqjms/Queue,
WSATGatewayRM_soa_server1_base_domain, eis/sunmq/Queue, eis/pramati/Queue, SSCo
nnectionDS_base_domain, eis/tibjms/Topic, eis/tibjmsDirect/Queue, eis/wls/Queue,
eis/tibjmsDirect/Topic, EDNDataSource_base_domain, eis/wls/Topic, eis/aqjms/Top
ic, RL3TST_base_domain, ArCnTaskForms@EBSConnection@EBSConnection_base_domain, S
OADataSource_base_domain, WLStore_base_domain_UMSJMSFileStore_auto_2},NonXAResou
rces={})],CoordinatorURL=soa_server1+192.168.10.114:8001+base_domain+t3+): weblo
gic.transaction.RollbackException: Could not prepare resource 'ArCnTaskForms@EBS
Connection@EBSConnection_base_domain
JDBC driver does not support XA, hence cannot be a participant in two-phase comm
it. To force this participation, set the GlobalTransactionsProtocol attribute to
LoggingLastResource (recommended) or EmulateTwoPhaseCommit for the Data Source
= EBSConnection
at weblogic.transaction.internal.TransactionImpl.throwRollbackException(
TransactionImpl.java:1881)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(Se
rverTransactionImpl.java:345)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
sactionImpl.java:239)
at weblogic.ejb.container.internal.BaseLocalObject.postInvoke1(BaseLocal
Object.java:622)
at weblogic.ejb.container.internal.BaseLocalObject.__WL_postInvokeTxRetr
y(BaseLocalObject.java:455)
at weblogic.ejb.container.internal.SessionLocalMethodInvoker.invoke(Sess
ionLocalMethodInvoker.java:52)
at oracle.bpm.bpmn.engine.ejb.impl.BPMNDeliveryBean_of8dk6_ICubeDelivery
LocalBeanImpl.handleCallback(Unknown Source)
at com.collaxa.cube.engine.dispatch.message.instance.CallbackDeliveryMes
sageHandler.handle(CallbackDeliveryMessageHandler.java:47)
at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(Dispatc
hHelper.java:140)
at com.collaxa.cube.engine.dispatch.BaseDispatchTask.process(BaseDispatc
hTask.java:88)
at com.collaxa.cube.engine.dispatch.BaseDispatchTask.run(BaseDispatchTas
k.java:64)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: javax.transaction.xa.XAException: JDBC driver does not support XA, he
nce cannot be a participant in two-phase commit. To force this participation, se
t the GlobalTransactionsProtocol attribute to LoggingLastResource (recommended)
or EmulateTwoPhaseCommit for the Data Source = EBSConnection
at weblogic.jdbc.wrapper.JTSXAResourceImpl.prepare(JTSXAResourceImpl.jav
a:83)
at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerRe
sourceInfo.java:1327)
at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerRe
sourceInfo.java:513)
at weblogic.transaction.internal.ServerSCInfo$1.run(ServerSCInfo.java:36
8)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTunin
gWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
.>
<12 Oct, 2012 12:34:40 PM IST> <Error> <oracle.soa.bpel.engine.dispatch> <BEA-00
0000> <failed to handle message
javax.transaction.xa.XAException: JDBC driver does not support XA, hence cannot
be a participant in two-phase commit. To force this participation, set the Globa
lTransactionsProtocol attribute to LoggingLastResource (recommended) or EmulateT
woPhaseCommit for the Data Source = EBSConnection
at weblogic.jdbc.wrapper.JTSXAResourceImpl.prepare(JTSXAResourceImpl.jav
a:83)
at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerRe
sourceInfo.java:1327)
at weblogic.transaction.internal.XAServerResourceInfo.prepare(XAServerRe
sourceInfo.java:513)
at weblogic.transaction.internal.ServerSCInfo$1.run(ServerSCInfo.java:36
8)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTunin
gWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
>
<12 Oct, 2012 12:34:40 PM IST> <Error> <oracle.soa.bpel.engine.dispatch> <BEA-00
0000> <Failed to handle dispatch message ... exception ORABPEL-05002
Message handle error.
error while attempting to process the message "com.collaxa.cube.engine.dispatch.
message.instance.CallbackDeliveryMessage"; the reported exception is: Error comm
itting transaction:; nested exception is: javax.transaction.xa.XAException: JDBC
driver does not support XA, hence cannot be a participant in two-phase commit.
To force this participation, set the GlobalTransactionsProtocol attribute to Log
gingLastResource (recommended) or EmulateTwoPhaseCommit for the Data Source = EB
SConnection
This error contained an exception thrown by the message handler.
Check the exception trace in the log (with logging level set to debug mode).
ORABPEL-05002
Message handle error.
error while attempting to process the message "com.collaxa.cube.engine.dispatch.
message.instance.CallbackDeliveryMessage"; the reported exception is: Error comm
itting transaction:; nested exception is: javax.transaction.xa.XAException: JDBC
driver does not support XA, hence cannot be a participant in two-phase commit.
To force this participation, set the GlobalTransactionsProtocol attribute to Log
gingLastResource (recommended) or EmulateTwoPhaseCommit for the Data Source = EB
SConnection
This error contained an exception thrown by the message handler.
Check the exception trace in the log (with logging level set to debug mode).
at com.collaxa.cube.engine.dispatch.DispatchHelper.handleMessage(Dispatc
hHelper.java:207)
at com.collaxa.cube.engine.dispatch.BaseDispatchTask.process(BaseDispatc
hTask.java:88)
at com.collaxa.cube.engine.dispatch.BaseDispatchTask.run(BaseDispatchTas
k.java:64)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:908)
at java.lang.Thread.run(Thread.java:662)
>
Could any body help on this issue.It is little bit urgent for us to resolve.
Thanks in advance.Thanks Sudipto Desmukh,
The link is helpful me to resolve this issue.
Thanks,
Narasimha E -
EJB 3.0 Web service fail to deploy when ws result is on a diff lib project
I'm trying to develop a web service using EJB 3.0 with annotations. I'm using Netbeans 5.5 EE.
The web service should returns an object declared on another Netbeans project.
( a library.jar).
Netbeans compiles everything alright, although when I deploy the application into Glassfish it complains with an error saying that wsdl file for the web service wasn't found.
If I move the returning object class into the same ejb project as the web service it works fine.
So, can anybody explain what is happening ? Is it a bug of Netbeans, Glassfish, EJB 3.0, JAX-WS or newbie programmer ?I'm trying to develop a web service using EJB 3.0 with annotations. I'm using Netbeans 5.5 EE.
The web service should returns an object declared on another Netbeans project.
( a library.jar).
Netbeans compiles everything alright, although when I deploy the application into Glassfish it complains with an error saying that wsdl file for the web service wasn't found.
If I move the returning object class into the same ejb project as the web service it works fine.
So, can anybody explain what is happening ? Is it a bug of Netbeans, Glassfish, EJB 3.0, JAX-WS or newbie programmer ? -
Ejb 3.0 on OC4J preview 4 CMR is this a BUG
Exception [TOPLINK-48] (Oracle TopLink - 10g release 3 (10.1.3.0.0) (Build 05091
2)): oracle.toplink.exceptions.DescriptorException
Exception Description: Multiple writable mappings exist for the field [ENVINCIDE
NTS.INCIDENTS_ID]. Only one may be defined as writable, all others must be spec
ified read-only.
Mapping: oracle.toplink.mappings.OneToOneMapping[incidents]
Descriptor: RelationalDescriptor(model.Envincidents --> [DatabaseTable(ENVINCIDE
NTS)])
as I understand the CMR uses toplink somewhere under the hood.
from the docs I got this...
@OneToMany(cascade=PERSIST)
@JoinColumn(name="MANAGER_ID", referencedColumnName="EMP_ID")
public Collection getManagedEmployees() {
return managedEmployees;
TopLink defaults and equivalent code
OneToManyMapping mapping = new OneToManyMapping();
mapping.setIsReadOnly(false);
mapping.setIsPrivateOwned(false);
mapping.setAttributeName(attributeName);
mapping.setReferenceClass(referenceClass);
in Toplink mapping there is setIsReadOnly() but how do
I specify this in ejb 3.0 annotations. I get the above error
whenever I use any sort of relationship in my ejbs and have the
same column defined as primary key in the table.Take a look at this forum Re: CMR in ejb 3.0
You basically need to make one of your mappings as read-only and I would recommend doing it with your basic mapping as it is easier to maintain with the set of the @ManyToOne relationship.
Doug
Maybe you are looking for
-
Help, I lost all the songs on my iPod when I deleted a few songs from my iTunes Library, checked the box titled "Replace all items when Autofilling" in my Autofill Settings window, and then tried to Autofill. Note that I do not purchase songs from iT
-
Change default paper size on Preview when printing
When I open the print window on Preview (ver 7.0) to print a .pdf file, the default paper size is always A4, which I never use; I use US Letter instead. Is there a way to change the default paper size to US Letter so I don't have to change it every t
-
HT201412 my Ipad will not turn on to charge, the apple symbol appears then it blank out
Ipad will not turn on to charge
-
No space left in shared memory error when executing a query
Hi, When I executed a query, it showed the results. But when I drilled down it by material, it showed the following error message. Error An exception with the type CX_SY_EXPORT_NO_SHARED_MEMORY occured Error No space left in shared memory Is there an
-
IE 7 problem with jre version 1.4.1
We are experiencing a problem with a site that is running java applets. It requires version 1.4.1. After logging into this site, a second window should appear. There are several times when that second window will attempt to open but then closes immed