Unable to call Container Managed Entity Bean
Hi
I am developing a JMS application using NetBeans 5.5.1 and Sun Java Application Server 9.0 and J2EE 1.4.When I run the application client it throws me following EXCEPTION:
{color:#ff0000}Sep 9, 2010 1:43:43 PM com.sun.enterprise.appclient.MainWithModuleSupport <init>
WARNING: ACC003: Application threw an exception.
javax.naming.NameNotFoundException: No object bound to name java:comp/env/jms/MDBDestinationFactory
at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:751)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:156)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at jmsdemo.Main.main(Main.java:30)
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:597)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:232)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:329)
at com.sun.enterprise.appclient.Main.main(Main.java:180)
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:340)
at com.sun.enterprise.appclient.Main.main(Main.java:180)
Caused by: java.lang.reflect.InvocationTargetException
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:597)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:232)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:329)
... 1 more
Caused by: javax.naming.NameNotFoundException: No object bound to name java:comp/env/jms/MDBDestinationFactory
at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:751)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:156)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at jmsdemo.Main.main(Main.java:30)
... 7 more
{color}{color:#000000}Source Code for Message Driven Bean:
package jmsdemo;
import javax.ejb.*;*
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
*public class MDBBean implements MessageDrivenBean, MessageListener {*
private MessageDrivenContext context;
*public void setMessageDrivenContext(MessageDrivenContext aContext) {context = aContext;}*
public void ejbCreate() {}
public void ejbRemove() {}
*public void onMessage(Message aMessage) {*
if(aMessage instanceof TextMessage)
TextMessage t = (TextMessage)aMessage;
try
System.out.println("Received message : " + t.getText());
*}catch(Exception e) {e.printStackTrace();}*
Source code for JMS Client:
package jmsdemo;*
import javax.jms.;
import javax.naming.*;*
*public class Main {*
*public Main() {*
public static void main(String[] args) throws Exception
*// TODO code application logic here*
InitialContext ic = new InitialContext();
ConnectionFactory cf = (ConnectionFactory)ic.lookup("java:comp/env/jms/MDBDestinationFactory");
Destination dest = (Queue) ic.lookup("java:comp/env/jms/MDBBean");
Connection con = cf.createConnection();
Session session = con.createSession(false,Session.AUTO_ACKNOWLEDGE);
MessageProducer mp = session.createProducer(dest);
TextMessage tm = session.createTextMessage();
tm.setText("Hello world .,.");
System.out.println("Sending message ...");
mp.send(tm);
con.close();
Generating code for ejb-jar.xml
<?xmlversion="1.0"encoding="UTF-8"?>*
*<ejb-jarversion="2.1"xmlns="[http://java.sun.com/xml/ns/j2ee%22xmlns:xsi=%22http://www.w3.org/2001/XMLSchema-instance%22xsi:schemaLocation=%22http://java.sun.com/xml/ns/j2eehttp://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd]">*
*<display-name>JMSDemo-ejb</display-name>*
*<enterprise-beans>*
*<message-driven>*
*<display-name>MDBMDB</display-name>*
*<ejb-name>MDBBean</ejb-name>*
*<ejb-class>jmsdemo.MDBBean</ejb-class>*
*<transaction-type>Container</transaction-type>*
*<message-destination-type>javax.jms.Queue</message-destination-type>*
*<message-destination-link>MDBDestination</message-destination-link>*
*<activation-config>*
*<activation-config-property>*
*<activation-config-property-name>acknowledgeMode</activation-config-property-name>*
*<activation-config-property-value>Auto-acknowledge</activation-config-property-value>*
*</activation-config-property>*
*<activation-config-property>*
*<activation-config-property-name>destinationType</activation-config-property-name>*
*<activation-config-property-value>javax.jms.Queue</activation-config-property-value>*
*</activation-config-property>*
*</activation-config>*
*</message-driven>*
*</enterprise-beans>*
*<assembly-descriptor>*
*<container-transaction>*
*<method>*
*<ejb-name>MDBBean</ejb-name>*
*<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<message-destination>
<display-name>DestinationforMDB</display-name>
<message-destination-name>MDBDestination</message-destination-name>
</message-destination>
</assembly-descriptor>
</ejb-jar>
Please let me when I am going wrong.
Thanks in advance
Senthil{color}
Hi
I am using sun java application server 9.0 and netbeans 5.5.1. For your information the Netbeans 5.5.1 has created already Queue in the sun java application server 9.0 when I created Message driven bean and I am able to see the queue connection in the Sun application server admin console. Even then I getting the same exception displayed below:
{color:#ff0000}Sep 11, 2010 11:45:17 AM com.sun.enterprise.appclient.MainWithModuleSupport <init>
WARNING: ACC003: Application threw an exception.
javax.naming.NameNotFoundException: No object bound to name java:comp/env/jms/MDBDestinationFactory
at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:751)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:156)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at jmsdemo.Main.main(Main.java:30)
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:597)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:232)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:329)
at com.sun.enterprise.appclient.Main.main(Main.java:180)
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:340)
at com.sun.enterprise.appclient.Main.main(Main.java:180)
Caused by: java.lang.reflect.InvocationTargetException
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:597)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:232)
at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:329)
... 1 more
Caused by: javax.naming.NameNotFoundException: No object bound to name java:comp/env/jms/MDBDestinationFactory
at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:751)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:156)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at jmsdemo.Main.main(Main.java:30)
... 7 more
Java Result: 1
{color}
The following connection properties {color:#0000ff}*jmsCF-jms_MDBBean.sun-resource_*{color} file:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<connector-resource enabled="true" jndi-name="jms/MDBDestinationFactory" object-type="user" pool-name="jms/MDBDestinationFactory">
<description/>
</connector-resource>
<connector-connection-pool connection-definition-name="javax.jms.QueueConnectionFactory" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" max-pool-size="32" max-wait-time-in-millis="60000" name="jms/MDBDestinationFactory" pool-resize-quantity="2" resource-adapter-name="jmsra" steady-pool-size="8"/>
</resources>
The following connection properties {color:#0000ff}_jms-jms_MDBBean.sun-resource_{color} file:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<admin-object-resource enabled="true" jndi-name="jms/MDBBean" object-type="user" res-adapter="jmsra" res-type="javax.jms.Queue">
<description/>
<property name="Name" value="MDBBean"/>
</admin-object-resource>
</resources>
Please help.
Thanks in advance
Senthil
Similar Messages
-
Container Managed Entity Beans and Client Identifier in Oracle
Is it possible to use Container Managed Entity Beans (EJB with CMP)
in a way that the Oracle database sessions still know the
individual Client Identifiers of the actual users
(not just the Identifier of the proxy user defined in the
Connection Pool)?
If Yes: How?
If No: The consequence would be that the
technologies EJB with CMP cannot be user together with
Oracle Virtual Private Databases (VPN) because VPN requires
some kind of Client Identifier.
I am grateful for any hint.
Regards,
Martin Siepmann
+49 (0)163 / 7765328Not quite an auto-incrementing PK, but it is managed by the container. the following is from the turorial
Generating Primary Key Values
For some entity beans, the value of a primary key has a meaning for the business entity. For example, in an entity bean that represents a phone call to a support center, the primary key might include a time stamp that indicates when the call was received. But for other beans, the key's value is arbitrary--provided that it's unique. With container-managed persistence, these key values can be generated automatically by the EJB container. To take advantage of this feature, an entity bean must meet these requirements:
* In the deployment descriptor, the primary key class is defined as a java.lang.Object. The primary key field is not specified.
* In the home interface, the argument of the findByPrimaryKey method must be a java.lang.Object.
* In the entity bean class, the return type of the ejbCreate method must be a java.lang.Object.
In these entity beans, the primary key values are in an internal field that only the EJB container can access. You cannot associate the primary key with a persistent field or any other instance variable. However, you can fetch the bean's primary key by invoking the getPrimaryKey method, and you can locate the bean by invoking its findByPrimaryKey method.
Maybe that is good enough
christina -
Setting composite key in Container Managed Entity Bean
In my database table i set primary key to two columns making them as composite key. how do i set that in my container managed entity bean home interface findByPrimaryKey() method and in deployment descriptor file.
1. create another class (say CompositePK) that will embed the two fields keyA and keyB corresponding to the two pk of your table (declare them public) .
2. in your Bean declare keyA and keyB public.
3. in the dd declare your bean primary-key-class as CompositePK and the primary-key-field as keyA and keyB.
this is the method i use (with BAS) even if the key is simple (such as Integer). -
Finder method in container-managed entity bean
Finder method of a container entity bean is taking the primary key class object of another entity bean. How to map this in the xml descriptor file weblogic-cmp-rdbms.xml for this type of beans.
I am trying to deploy the jasmine computer store of Mastering EJB by EdRoman.
I couldn't write the deployment file weblogic-cmp-rdbms.xml for Order Entity bean which uses CustomerPK as an argument in its finder method.
Please tell me how to write this. I am trying on weblogic 5.1
Thanx in advance
Srivatsahello,
in container managed persistence, you specify on your xml file the name of your table. so the primary key you want to use have to be a foreign key in your table. otherwise i don't think that you can use a container managed persistence.
Najib. -
Problem with non-container managed entity manager
i am working on a project, in which i am using entity beans.i use netbeans, glassfish as application server and toplink as persistence provider .
i created a java class that handles all the operations with the entitys, which means i using non-container managed entity manager.
in the constructor
try{
EntityManagerFactory emf = Persistence.createEntityManagerFactory("voidPU");
entityManager = emf.createEntityManager();
catch(Exception ex){
throw new EJBException(ex.getMessage());
}then i call a function in this class from a servlet
the code of the function
List users = null;
try {
ProgLanguages progLanguage = entityManager.find(ProgLanguages.class, languageId);
users = (List) progLanguage.getUserIdCollection();
catch(IllegalStateException illegalStateException){
throw new EJBException(illegalStateException.getMessage());
catch(IllegalArgumentException illegalArgumentException) {
throw new EJBException(illegalArgumentException.getMessage());
}i got an IllegalArgumentException saying Unknown entity bean class: class vanguard.server.entity.ProgLanguages, please verify that this class has been marked with the @Entity annotation
what confuses me is that sometimes it works and most of the time it does not work, have i made anything wrong?, or there is a problem with any of the tools netbeans, glassfish, or toplink?Is it always the same entity that is reported as 'unknown' ? You mention that it works sometimes but is it the same deployment and the same code that works? The first thing I would verify is that the ear is being created as expected by netbeans. Check the persistence.xml file and verify that all of the classes are listed that will be used as entities.
--Gordon -
Bean Managed Entity Beans(EJB) using Tangosol.
I am trying to use Bean Managed Entity Beans using Tangosol Coherence.
The entity bean is currently configured in the weblogic-ejb-jar.xml with:
<max-beans-in-cache>200</max-beans-in-cache>
In the public void ejbLoad() method, I am calling the Tangosol Cache to load the entity bean.
If we have have more that 200 request coming at the same time, we get an OutOfMemoryError exception.
Is there anyway to overcome this limitation by somehow having the ejb cache to use the tangosol cache?
Thanks for any help in advance.
KrishanSo far, it's not immediately obvious to us what the exact problem is that you are seeing. It sounds like the VM would be using at least 200MB just for the application server's own internal cache, for example, and that you are also using Coherence within the application server to provide additional caching.
If possible, we should set up a phone call with you and your team, and we could get an engineer from our end to walk through your specific use case with you, so that we could understand what the exact technical challenge(s) is(are) in this particular application.
Peace.
p.s. You can email [email protected] directly to schedule a call. -
Can i user UserTransaction in a Container-managed transaction Bean
can i use UserTransaction to control transaction boundaries in a container-managed transaction bean method?
below is the method:
there is one-to-many between Employees and SalaryItem
@TransactionAttribute(value = TransactionAttributeType.REQUIRED)
private void initEmployeesSalary(Long salarySumId) {
for(Employees employees: liEmployees){
for (int i = 0; i < 20; i++) {
SalaryItem item = new SalaryDetailItem();
employees.addSalaryItem(item);
when there are about 1000 employees,the method run very slow.
What do you think I should do?
nullHi again,
The EJB specs say that a stateful Session Bean with CMT is NOT allowed to use the UserTransaction; see page 361 of the EJB2.0 specification. So combining them will not (or should not) work.
I suggest CMT+SessionSynchronization combined with using a flag to indicate whether notify should be called or not. Otherwise, you could try splitting up the bean into two beans: one with CMT and another one without. The one without CMT could use the UserTransaction and notify.
Also, you might want to check http://www.onjava.com/pub/a/onjava/2001/10/02/ejb.html
Hope that helps a bit,
Guy
http://www.atomikos.com -
Hi,
I have created two bean managed entity beans, User and Role, abstracting users
and groups in a ldap base. A User may have more than one Role. This is represented
by a (bean managed) 1:many relationship directed from User to Role. For some weird
reasons I get a transaction rollback when reading data, when transactions are
turned on (REQUIRED).
While we where running WLS 6.1 sp1 we had no problems with this as we could set
transaction to NOTSUPPORTED for these two EJBs. Due to other hickups we had to
upgrade to sp2 and suddenly the error reappears leading me to believe that NOTSUPPORTED
isn't allowed anymore by the WLS. I know that NOTSUPPORTED isn't required by the
EJB spec, but containers may support it and obviously WLS used to do just that.
I have not seen any change in the release notes of sp2 that indicates that this
behaviour has changed.
Does anybody know if WLS really doesn't support NOTSUPPORTED for enity beans anymore
in sp2?
If anybody are curiuos or have any good ideas, the stacktrace I get is:
javax.ejb.TransactionRolledbackLocalException: EJB Exception:
- with nested exception:
[javax.ejb.EJBException
- with nested exception:
[weblogic.transaction.RollbackException: Unexpected exception in beforeCompletion:
sync=weblogic.ejb20.internal.TxManager$TxListener@1c2906 - with nested exception:
[java.util.ConcurrentModificationException]]]
Start server side stack trace:
java.rmi.RemoteException: EJB Exception: ; nested exception is:
javax.ejb.TransactionRolledbackLocalException: EJB Exception:
- with nested exception:
[javax.ejb.EJBException
- with nested exception:
[weblogic.transaction.RollbackException: Unexpected exception in beforeCompletion:
sync=weblogic.ejb20.internal.TxManager$TxListener@1c2906 - with nested exception:
[java.util.ConcurrentModificationException]]]
java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:535)
at java.util.LinkedList$ListItr.next(LinkedList.java:476)
at weblogic.ejb20.manager.DBManager.beforeCompletion(DBManager.java:370)
at weblogic.ejb20.internal.TxManager$TxListener.beforeCompletion(TxManager.java:481)
at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:551)
at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:88)
at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransactionImpl.java:980)
at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImpl.java:1504)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:216)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:190)
at weblogic.ejb20.internal.BaseEJBLocalObject.postInvoke(BaseEJBLocalObject.java:207)
at com.takecargo.domainentities.role.RoleBean_1ipw6_ELOImpl.getName(RoleBean_1ipw6_ELOImpl.java:86)
at com.takecargo.domainentities.role.RoleConverter.getVOforRoleLocal(RoleConverter.java:51)
Any kind of help would be appreciated:)
Regards,
Brynjar GlesnesWLS support NotSupported on Entity Beans.
It looks like you've hit a bug in the EJB container where an internal Collection class has been modified while the
container is running through an iterator on it.
You should open a case with [email protected]
-- Rob
Brynjar Glesnes wrote:
Hi,
I have created two bean managed entity beans, User and Role, abstracting users
and groups in a ldap base. A User may have more than one Role. This is represented
by a (bean managed) 1:many relationship directed from User to Role. For some weird
reasons I get a transaction rollback when reading data, when transactions are
turned on (REQUIRED).
While we where running WLS 6.1 sp1 we had no problems with this as we could set
transaction to NOTSUPPORTED for these two EJBs. Due to other hickups we had to
upgrade to sp2 and suddenly the error reappears leading me to believe that NOTSUPPORTED
isn't allowed anymore by the WLS. I know that NOTSUPPORTED isn't required by the
EJB spec, but containers may support it and obviously WLS used to do just that.
I have not seen any change in the release notes of sp2 that indicates that this
behaviour has changed.
Does anybody know if WLS really doesn't support NOTSUPPORTED for enity beans anymore
in sp2?
If anybody are curiuos or have any good ideas, the stacktrace I get is:
javax.ejb.TransactionRolledbackLocalException: EJB Exception:
- with nested exception:
[javax.ejb.EJBException
- with nested exception:
[weblogic.transaction.RollbackException: Unexpected exception in beforeCompletion:
sync=weblogic.ejb20.internal.TxManager$TxListener@1c2906 - with nested exception:
[java.util.ConcurrentModificationException]]]
Start server side stack trace:
java.rmi.RemoteException: EJB Exception: ; nested exception is:
javax.ejb.TransactionRolledbackLocalException: EJB Exception:
- with nested exception:
[javax.ejb.EJBException
- with nested exception:
[weblogic.transaction.RollbackException: Unexpected exception in beforeCompletion:
sync=weblogic.ejb20.internal.TxManager$TxListener@1c2906 - with nested exception:
[java.util.ConcurrentModificationException]]]
java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:535)
at java.util.LinkedList$ListItr.next(LinkedList.java:476)
at weblogic.ejb20.manager.DBManager.beforeCompletion(DBManager.java:370)
at weblogic.ejb20.internal.TxManager$TxListener.beforeCompletion(TxManager.java:481)
at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:551)
at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:88)
at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransactionImpl.java:980)
at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImpl.java:1504)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:216)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:190)
at weblogic.ejb20.internal.BaseEJBLocalObject.postInvoke(BaseEJBLocalObject.java:207)
at com.takecargo.domainentities.role.RoleBean_1ipw6_ELOImpl.getName(RoleBean_1ipw6_ELOImpl.java:86)
at com.takecargo.domainentities.role.RoleConverter.getVOforRoleLocal(RoleConverter.java:51)
Any kind of help would be appreciated:)
Regards,
Brynjar Glesnes -
Exception in calling a CMP Entity Bean
I have deployed a simple CMP entity bean using jboss App. server, Now while executing the client i got the following exception,
error in clientjavax.naming.CommunicationException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: org.jnp.interfaces.FastNamingProperties (no security manager: RMI class loader disabled)]
regards,
NaveenBabu.AHi,
It is likely that some libraries are missing in your client environment. (it has nothing to do with security)
Make sure that the libraries in JBoss client (folder your_jboss_folder/client) are in your client application classpath. In particular, look for jnp-client.jar.
This should solve the problem.
Bruno Collet
http://www.practicalsoftwarearchitect.com -
EJB 3.0 question - saving an entity bean containing another entity bean
Hi,
First, I want to store an entity bean. Secondly, I want to store another entity bean - containing the first entity bean.
I have the following code in a session bean for this:
public void saveFeedScheduling(FeedScheduling feedScheduling, FeedSource feedSource) {
FeedSource feeds = em.merge(feedSource);
em.flush();
feedScheduling.setFeedSource(feeds);
FeedScheduling feedSched = em.merge(feedScheduling);
em.flush();
This seems to work fine - still, is this the proper way to do it?Hello,
This kind of parameter can be specified using the relationship annotation.
I'm not 100% sure, but, lok at the "cascade element".
Regards,
Sebastien Degardin -
Urgent help needed session calling remote interface entity bean Method -P
i deployed session and entity as seperatly
i didn't get the home interface object of entity bean
give the soultion for the
as i deployed in same jar file means
its workingHi,
hopefully I can help you.
1. There are few helper classes which has to be ...We have just the same constellation. We have put the HelperClasses in the
J2EE/home/lib dir, NOT specifying it in the application.xml. So everything works fine.
The only thing: never, again: never put these files within WEB-INF and the lib-dir.
With the HelperClasses in both we have only faced massive problems, mostly ClasCastExceptions.
We had once all the helperClasses within J2EE/home/applications/lib, but this requires to
specify this dir within the orion-application.xml within the appl dir in applications-deployment.
It also worked fine.
2. How can i utilise connection pooling in oc4j. In data-sources.xml, i am using ...I'm not sure of this, but I think, the container handles Connection Pooling, no matter what Factory you
specify. But I think, the Class hasn't to be OracleConnectionPool ... but I have to check this (right now
I have no access to our datasource.xml ..)
cu
ed -
Accessing collection field in container managed persistence bean
Hello!
How can i get 1:m relatioship, collection fields value?
What is the purpose of ejbSelect-method, in bean business class?Please ask your EJB questions within the Enterprise JavaBeans section of this forum.
The ejbSelect Method is a query method (like the finder mehtod) but it is not directly exposed to the client in the home interfacce or component interface. Rather, ejbSelect() is used internally within an entity bean as a helper method to accesss a storage. ejbSelect() is useful when you have entity beans in relationships with external data, such as other entity beans.
look at http://www.theserverside.com/articles/content/ApplyingEJB/matena8.pdf for an example -
How to add a finder method in the container manager Bean in the weblogic6.1
in the environment jbuilder6 andweblogic6.1,use container manager entity Bean,it can automatic generate the findAll() method,I want to add a new method to find an element in the home interface,such as findByName(),name is a element of a table of the database.in the weblogic-cmp-rdbms-jar.xml,this is part of the fiile:
<finder>
<finder-name>findAll</finder-name>
<finder-query><![CDATA[ (= 1 1) ]]></finder-query>
</finder>
<finder>
<finder-name>findByName</finder-name>
<finder-param>java.lang.String</finder-param>
<finder-query><![CDATA[ (=name $name) ]]></finder-query>
</finder>
It can successfully compile the findAll(),but it is wrong when compile the findByName(),as follows
"www.ejbgrpx": Method Name: findByName
"www.ejbgrpx": Invalid specifications for a WebLogic RDBMS CMP EJB.
"www.ejbgrpx": ERROR: Error from ejbc: weblogic.ejb20.cmp11.rdbms.finders.IllegalExpressionException:
"www.ejbgrpx": While trying to process Finder
"www.ejbgrpx": Parameter Types: (java.lang.String)
"www.ejbgrpx": WebLogic Query: (= name $name)
"www.ejbgrpx": Finder Expressions: ()
"www.ejbgrpx": Could not parse WLQL expression: (= name $name) null
"www.ejbgrpx": ERROR: ejbc found errors
thank youThe finder methods that you are referring to are only simple finder methods. If you would like to add specialized finder methods, you can make your entity bean with bean managed persistence and not container managed. If you are using EJB 2.0, your entity bean with container managed persistence can use EJB QL for finder methods. You can search for this topic and/or download the EJB 2.0 specifications
Hope this helps -
Client Program accessing J2EE entity Bean
I have trouble find my Course J2EE bean from a client. (The client
runs on the same computer but a different VM from the bean.)
In Glassfish (Sun Application Server Nine), I set up a simple
Container-Managed Entity Bean. I tried to access it from an external
client as described in the glassfish EJB
FAQ https://glassfish.dev.java.net/javaee5/ejb/EJB-FAQ.html
Here is the client program:
package RS;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.xml.parsers.*;
import org.apache.xml.serialize.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import RS.CourseHome;
import RS.CoursePK;
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
import java.rmi.RemoteException;
import javax.rmi.*;
import java.util.Properties;
import Debug.*;
public class Client {
public static void main (String arg[]) throws IOException {
try {
InitialContext jndiContext = new InitialContext ();
Debug.P("jndic ongtext" + jndiContext);
Object o = jndiContext.lookup("RS.CourseHome");
Debug.P("looked up object "+o + "|"+o.getClass().getName());
RS.CourseHome home =
(RS.CourseHome)PortableRemoteObject.narrow(o,RS.CourseHome.class);
Debug.P("got home "+home);
Course C = home.create(1);
C.setName("blah");
CoursePK PK = new CoursePK();
PK.number=1;
C = home.findByPrimaryKey(PK);
Debug.P(C.getName());
catch (java.rmi.RemoteException re) {Debug.P("Remote Exception" + re.getMessage());}
catch (javax.naming.NamingException ne){Debug.P("Naming Exception"+ne.getMessage());}
catch (javax.ejb.CreateException ce){Debug.P("Create Exception"+ce.getMessage());}
catch (javax.ejb.FinderException fe){Debug.P("Finder Exception"+fe.getMessage());}
}Here is the error message:
Exception in thread "main" java.lang.ClassCastException
at com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow
(PortableRemoteObject.java:294)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
at RS.Client.main(Client.java:26)The debugging indicates that I got the Initial Context
and got the object but the PortableObject.narrow failed:
jndic ongtextjavax.naming.InitialContext@1d85f79
looked up object IOR: (huge number deleted)
com.sun.corba.ee.impl.corba.CORBAObjectImplEarlier, I tried the version below, but based on the suggestion by Mr. Ebbert
in the forum started "Error When running the Client Program" by sree_devi,
I checked
the following. I went to "Jndi Tree Browsing" from the Administrative Console
and I found a "RS.CourseHome" entry under "ejb" I found RS.CourseHome there
but did not see the "Course" tghat I expected to see
Thus, I tried the version above:
package RS;
--- imports deleted for conciseness
import Debug.*;
public class Client {
public static void main (String arg[]) throws IOException {
try {
InitialContext jndiContext = new InitialContext ();
Object o = jndiContext.lookup("Course");
CourseHome home =
(CourseHome)PortableRemoteObject.narrow(o,CourseHome.class);
Course C = home.create(1);
C.setName("blah");
CoursePK PK = new CoursePK();
PK.number=1;
C = home.findByPrimaryKey(PK);
Debug.P(C.getName());
catch (java.rmi.RemoteException re) {Debug.P("Remote Exception" + re.getMessage());}
catch (javax.naming.NamingException ne){Debug.P("Naming Exception"+ne.getMessage());}
catch (javax.ejb.CreateException ce){Debug.P("Create Exception"+ce.getMessage());}
catch (javax.ejb.FinderException fe){Debug.P("Finder Exception"+fe.getMessage());}
}When I run it, I get the following Naming Exception: Course not found
I confirmed at the administrative console, that I have "Course" listed
under Enterprise Applications:
As per the ejb FAQ, I set up my $CLASSPATH so it starts as follows:
/opt/j2ee/SUNWappserver/lib/appserv-rt.jar:
/opt/j2ee/SUNWappserver/lib/javaee.jar:I also verifed in my domain.xml that the orb-listener-1, the default
naming service port was at 3700.
Here is the info on the Bean that I have running for both of the tries
at my Client code.
ejb-jar.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
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/ejb-jar_2_1.xsd"
version="2.1">
<enterprise-beans>
<entity>
<description>Course</description>
<display-name>CourseBean</display-name>
<ejb-name>CourseBean</ejb-name>
<home>RS.CourseHome</home>
<remote>RS.Course</remote>
<ejb-class>RS.CourseBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>RS.CoursePK</prim-key-class>
<reentrant>false</reentrant>
<abstract-schema-name>Course</abstract-schema-name>
<cmp-field><field-name>number</field-name></cmp-field>
<cmp-field><field-name>name</field-name></cmp-field>
</entity>
</enterprise-beans>
<assembly-descriptor>
<security-role>
<description>Everyone</description>
<role-name>everyone</role-name>
</security-role>
<method-permission>
<unchecked/>
<method>
<ejb-name>CourseBean</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
<container-transaction>
<method>
<ejb-name>CourseBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
Sun-ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 8.1 EJB 2.1//EN"
"http://www.sun.com/software/appserver/dtds/sun-ejb-jar_2_1-1.dtd">
<sun-ejb-jar>
<enterprise-beans>
<name>CourseBean</name>
<ejb>
<ejb-name>CourseBean</ejb-name>
<jndi-name>Course</jndi-name>
</ejb>
<cmp-resource>
<jndi-name>jdbc/__default</jndi-name>
<create-tables-at-deploy>true</create-tables-at-deploy>
<drop-tables-at-undeploy>true</drop-tables-at-undeploy>
</cmp-resource>
</enterprise-beans>
</sun-ejb-jar>
Course.java
package RS;
import java.rmi.RemoteException;
public interface Course extends javax.ejb.EJBObject {
public String getName() throws RemoteException;
public void setName (String Str) throws RemoteException;
public int getNumber() throws RemoteException;
public void setNumber (int n) throws RemoteException;
CourseHome.java
package RS;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
public interface CourseHome extends javax.ejb.EJBHome {
public Course create(int id) throws
CreateException,RemoteException;
public Course findByPrimaryKey(CoursePK pk)
throws FinderException,RemoteException;
CourseBean.java
package RS;
import javax.ejb.EntityContext;
public abstract class CourseBean implements javax.ejb.EntityBean {
public CoursePK ejbCreate (int number) throws javax.ejb.CreateException{
this.setNumber(number);
return null;
public void ejbPostCreate (int number) {
public abstract String getName();
public abstract void setName (String str);
public abstract int getNumber ();
public abstract void setNumber (int number);
public void setEntityContext (EntityContext ctx) {}
public void unsetEntityContext() {}
public void ejbActivate () {}
public void ejbPassivate () {}
public void ejbLoad () {}
public void ejbStore () {}
public void ejbRemove() {}
}Laurence L. Leff, Ph.D. Associate Professor of Computer Science
Western Illinois University, 1 University Circle 61455, Pager: 309 367 0787
FAX 309 298 2302hi s-mcgowan,
"some other processing" comprises of printing of debug lines and publishing to the message queue using JMS. I added more debug lines so that i could see whats really happening... here is the result
myTableHome.create(...); <----------- no exception was thrown and it returned LocalMyTable object
print out "Insert successful"
print out "publishing message"
... publish message to message queue using JMS...
print out "Publish done"
... after few milliseconds...
java.sql.BatchUpdateException: Data exception -- row already exist in index PK_MYTABLE on table MYTABLE.
From the exception it seems like its doing a batch insert. So that seems to explain why the java.sql.BatchUpdateException is thrown few milliseconds after my call to myTableHome.create(...);
Is it possible to disable batch update / insert? how?
thanks in advance,
leigh -
Java.lang.IllegalStateException when trying to get a entity bean
hi all,
I wrote a simple container managed entity bean and deployed it. When i call the find all method of the entity bean following is the log trace of my exception
com.sun.enterprise.resource.JdbcXAConnection$JdbcConnection@13974ba TX optimistic: false referenceCount =1 for com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl@12a585c.
[22/Jul/2003:23:35:54] FINER ( 1496): SQL statement<select t0."USER_ID", t0."LOGIN_NAME", t0."PASSWORD", t0."FIRST_NAME", t0."LAST_NAME", t0."EMAIL", t0."ADDRESS1", t0."ADDRESS2", t0."POSTALCODE", t0."CITY", t0."COUNTRY", t0."STATE", t0."ACCOUNT_STATUS", t0."CREATE_DATE", t0."MODIFY_DATE", t0."CREATED_BY", t0."MODIFIED_BY" from "EXPENSE_USER" t0> with no input values
[22/Jul/2003:23:35:54] FINE ( 1496): <-> DBVendorType.getSpecialDBOperation():com.sun.jdo.spi.persistence.support.sqlstore.database.oracle.OracleSpecialDBOperation@1a92d3a.
[22/Jul/2003:23:35:54] FINEST ( 1496): marking key field iD as present.
[22/Jul/2003:23:35:54] FINEST ( 1496): NullSemaphore.acquire() for PersistenceManagerImpl.cacheLock.
[22/Jul/2003:23:35:54] FINER ( 1496): SQLStoreManager.getPersistenceConfig(), classType = com.expense.ejb.entity.container.UserBean1689033004_JDOState.
[22/Jul/2003:23:35:54] FINEST ( 1496): NullSemaphore constructor() for SQLStateManager.
[22/Jul/2003:23:35:54] FINE ( 1496): --> SqlStateManager.applyUpdates(), field = iD.
[22/Jul/2003:23:35:54] FINEST ( 1496): iD = 1.
[22/Jul/2003:23:35:54] FINEST ( 1496): NullSemaphore.release() for PersistenceManagerImpl.cacheLock.
[22/Jul/2003:23:35:54] FINEST ( 1496): NullSemaphore.acquire() for SQLStateManager.
[22/Jul/2003:23:35:54] FINEST ( 1496): loginName = root.
[22/Jul/2003:23:35:54] FINEST ( 1496): marking local field loginName as present.
[22/Jul/2003:23:35:54] FINEST ( 1496): password = root.
[22/Jul/2003:23:35:54] FINEST ( 1496): marking local field password as present.
[22/Jul/2003:23:35:54] FINEST ( 1496): firstName = super user.
[22/Jul/2003:23:35:54] FINEST ( 1496): marking local field firstName as present.
[22/Jul/2003:23:35:54] FINEST ( 1496): lastName = null.
[22/Jul/2003:23:35:54] FINEST ( 1496): marking local field lastName as present.
[22/Jul/2003:23:35:54] FINEST ( 1496): email = root@expen.
[22/Jul/2003:23:35:54] FINEST ( 1496): marking local field email as present.
[22/Jul/2003:23:35:54] FINEST ( 1496): address1 = xxx .
[22/Jul/2003:23:35:54] FINEST ( 1496): marking local field address1 as present.
[22/Jul/2003:23:35:54] FINEST ( 1496): address2 = xxx .
[22/Jul/2003:23:35:54] FINEST ( 1496): marking local field address2 as present.
[22/Jul/2003:23:35:54] FINEST ( 1496): postalCode = 12345 .
[22/Jul/2003:23:35:54] FINEST ( 1496): marking local field postalCode as present.
[22/Jul/2003:23:35:54] FINEST ( 1496): city = xxxx .
[22/Jul/2003:23:35:54] FINEST ( 1496): marking local field city as present.
[22/Jul/2003:23:35:54] FINEST ( 1496): country = usa .
[22/Jul/2003:23:35:54] FINEST ( 1496): marking local field country as present.
[22/Jul/2003:23:35:54] FINEST ( 1496): state = ca .
[22/Jul/2003:23:35:54] FINEST ( 1496): marking local field state as present.
[22/Jul/2003:23:35:54] FINEST ( 1496): accountStatus = null.
[22/Jul/2003:23:35:54] FINEST ( 1496): marking local field accountStatus as present.
[22/Jul/2003:23:35:54] FINEST ( 1496): convertValue: 7/22/03 11:07 PM From: java.sql.Timestamp To: class java.lang.Long.
[22/Jul/2003:23:35:54] FINEST ( 1496): createDate = 7/22/03 11:07 PM.
[22/Jul/2003:23:35:54] FINEST ( 1496): NullSemaphore.release() for SQLStateManager.
[22/Jul/2003:23:35:54] FINEST ( 1496): --- TransactionImpl.releaseConnection(): TX optimistic: false Inside Commit: false referenceCount: 0 for com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl@12a585c.
[22/Jul/2003:23:35:54] FINEST ( 1496): --- TransactionImpl.closeConnection() com.sun.enterprise.resource.JdbcXAConnection$JdbcConnection@13974ba for com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl@12a585c.
[22/Jul/2003:23:35:54] FINEST ( 1496): ---PersistenceManagerImpl.popCurrentWrapper() > current: com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerWrapper@2606b8 prev: null.
[22/Jul/2003:23:35:54] FINE ( 1496): Exception in forceDestroyBean()
java.lang.IllegalStateException: Primary key not available
at com.sun.ejb.containers.EntityContextImpl.getPrimaryKey(EntityContextImpl.java:157)
at com.sun.ejb.containers.EntityContainer.forceDestroyBean(EntityContainer.java:1252)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:1792)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:1608)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:529)
at com.expense.ejb.entity.container.UserBean1689033004_ConcreteImpl_LocalHomeImpl.findAll(UserBean1689033004_ConcreteImpl_LocalHomeImpl.java:133)
at jasper.usertest_jsp._jspService(_usertest_jsp.java:74)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:552)
at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:368)
at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:287)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
[22/Jul/2003:23:35:54] FINEST ( 1496): Thread.currentThread()Tran[ Transaction:
status = STATUS_ACTIVE
Transaction Object = Transaction@17774593
threads = 1
].afterCompletion: status = STATUS_ACTIVE, sync = null, STATUS_ROLLEDBACK for com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl@12a585c.
[22/Jul/2003:23:35:54] FINEST ( 1496): Thread[service-j2ee,5,main] Tran[ Transaction:
status = STATUS_ACTIVE
Transaction Object = Transaction@17774593
threads = 1
].setStatus: STATUS_ACTIVE => STATUS_ROLLING_BACK for com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl@12a585c.
[22/Jul/2003:23:35:54] FINEST ( 1496): Thread[service-j2ee,5,main] Tran[ Transaction:
status = STATUS_ROLLING_BACK
Transaction Object = Transaction@17774593
threads = 1
].internalRollback:status = STATUS_ROLLING_BACK ,txType: CMT for com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl@12a585c.
[22/Jul/2003:23:35:54] FINEST ( 1496): Thread[service-j2ee,5,main] Tran[ Transaction:
status = STATUS_ROLLING_BACK
Transaction Object = Transaction@17774593
threads = 1
].setStatus: STATUS_ROLLING_BACK => STATUS_ROLLEDBACK for com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl@12a585c.
[22/Jul/2003:23:35:54] FINEST ( 1496): ---PersistenceManagerImpl.afterCompletion() process: true.
[22/Jul/2003:23:35:54] FINEST ( 1496): Thread[service-j2ee,5,main] Tran[ Transaction:
status = STATUS_ROLLEDBACK
Transaction Object = Transaction@17774593
threads = 1
].forget:status = STATUS_ROLLEDBACK ,txType: CMT for com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl@12a585c.
[22/Jul/2003:23:35:54] FINEST ( 1496): ---SQLPersistenceManagerFactory.releasePersistenceManager() PM:com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl@12a585c for JTA Tx: com.sun.ejb.containers.PMTransactionImpl@2.
[22/Jul/2003:23:35:54] FINEST ( 1496): ---SQLPersistenceManagerFactory.releasePersistenceManager() PM:com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl@12a585c for JTA Tx: null.
[22/Jul/2003:23:35:54] FINEST ( 1496): <--SQLPersistenceManagerFactory.returnToPool().
[22/Jul/2003:23:35:54] FINE ( 1496): EJB5018: Some unmapped exception occurred : [{0}]
javax.ejb.EJBException: nested exception is: java.lang.ClassCastException
java.lang.ClassCastException
at com.expense.ejb.entity.container.UserBean1689033004_JDOState.jdoSetField(UserBean1689033004_JDOState.java:969)
at com.sun.jdo.spi.persistence.support.sqlstore.model.FieldDesc.setValue(FieldDesc.java:337)
at com.sun.jdo.spi.persistence.support.sqlstore.ResultDesc.setFields(ResultDesc.java:749)
at com.sun.jdo.spi.persistence.support.sqlstore.ResultDesc.getResult(ResultDesc.java:635)
at com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager.executeQuery(SQLStoreManager.java:648)
at com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager.retrieve(SQLStoreManager.java:500)
at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl.retrieve(PersistenceManagerImpl.java:989)
at com.sun.jdo.spi.persistence.support.sqlstore.query.QueryImpl.doExecute(QueryImpl.java:634)
at com.sun.jdo.spi.persistence.support.sqlstore.query.QueryImpl.execute(QueryImpl.java:455)
at com.expense.ejb.entity.container.UserBean1689033004_ConcreteImpl.ejbFindAll(UserBean1689033004_ConcreteImpl.java:1249)
at com.expense.ejb.entity.container.UserBean1689033004_ConcreteImpl_LocalHomeImpl.findAll(UserBean1689033004_ConcreteImpl_LocalHomeImpl.java:128)
at jasper.usertest_jsp._jspService(_usertest_jsp.java:74)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:552)
at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:368)
at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:287)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
javax.ejb.EJBException: nested exception is: java.lang.ClassCastException
at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:1893)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:1796)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:1608)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:529)
at com.expense.ejb.entity.container.UserBean1689033004_ConcreteImpl_LocalHomeImpl.findAll(UserBean1689033004_ConcreteImpl_LocalHomeImpl.java:133)
at jasper.usertest_jsp._jspService(_usertest_jsp.java:74)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:552)
at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:368)
at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:287)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
at org.apache.catalina.core.StandardWrapperValve.acces
[22/Jul/2003:23:35:54] FINE ( 1496): EJB5019: Some application or system exception occurred : [UserBean]
[22/Jul/2003:23:35:54] FINE ( 1496):
[22/Jul/2003:23:35:55] SEVERE ( 1496): StandardWrapperValve[usertest]: Servlet.service() for servlet usertest threw exception
javax.ejb.EJBException: nested exception is: java.lang.ClassCastException
java.lang.ClassCastException
at com.expense.ejb.entity.container.UserBean1689033004_JDOState.jdoSetField(UserBean1689033004_JDOState.java:969)
at com.sun.jdo.spi.persistence.support.sqlstore.model.FieldDesc.setValue(FieldDesc.java:337)
at com.sun.jdo.spi.persistence.support.sqlstore.ResultDesc.setFields(ResultDesc.java:749)
at com.sun.jdo.spi.persistence.support.sqlstore.ResultDesc.getResult(ResultDesc.java:635)
at com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager.executeQuery(SQLStoreManager.java:648)
at com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager.retrieve(SQLStoreManager.java:500)
at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl.retrieve(PersistenceManagerImpl.java:989)
at com.sun.jdo.spi.persistence.support.sqlstore.query.QueryImpl.doExecute(QueryImpl.java:634)
at com.sun.jdo.spi.persistence.support.sqlstore.query.QueryImpl.execute(QueryImpl.java:455)
at com.expense.ejb.entity.container.UserBean1689033004_ConcreteImpl.ejbFindAll(UserBean1689033004_ConcreteImpl.java:1249)
at com.expense.ejb.entity.container.UserBean1689033004_ConcreteImpl_LocalHomeImpl.findAll(UserBean1689033004_ConcreteImpl_LocalHomeImpl.java:128)
at jasper.usertest_jsp._jspService(_usertest_jsp.java:74)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:552)
at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:368)
at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:287)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
javax.ejb.EJBException: nested exception is: java.lang.ClassCastException
at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:1893)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:1796)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:1608)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:529)
at com.expense.ejb.entity.container.UserBean1689033004_ConcreteImpl_LocalHomeImpl.findAll(UserBean1689033004_ConcreteImpl_LocalHomeImpl.java:133)
at jasper.usertest_jsp._jspService(_usertest_jsp.java:74)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:552)
at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:368)
at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:287)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
at org.apache.c
[22/Jul/2003:23:36:15] FINE ( 1496): SingleSignOn[server1]: SSO expiration started. Current entries: 0
[22/Jul/2003:23:36:15] FINE ( 1496): SingleSignOn[server1]: SSO cache will expire 0 entries.
[22/Jul/2003:23:37:15] FINE ( 1496): SingleSignOn[server1]: SSO expiration started. Current entries: 0
[22/Jul/2003:23:37:15] FINE ( 1496): SingleSignOn[server1]: SSO cache will expire 0 entries.
following is the ejb-jar.xml part of this entity bean
<entity>
<ejb-name>UserBean</ejb-name>
<local-home>com.expense.ejb.entity.container.LocalUserHome</local-home>
<local>com.expense.ejb.entity.container.LocalUser</local>
<ejb-class>com.expense.ejb.entity.container.UserBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>userSchema</abstract-schema-name>
<cmp-field>
<field-name>loginName</field-name>
</cmp-field>
<cmp-field>
<field-name>password</field-name>
</cmp-field>
<cmp-field>
<field-name>iD</field-name>
</cmp-field>
<cmp-field>
<field-name>firstName</field-name>
</cmp-field>
<cmp-field>
<field-name>email</field-name>
</cmp-field>
<cmp-field>
<field-name>lastName</field-name>
</cmp-field>
<cmp-field>
<field-name>address1</field-name>
</cmp-field>
<cmp-field>
<field-name>address2</field-name>
</cmp-field>
<cmp-field>
<field-name>postalCode</field-name>
</cmp-field>
<cmp-field>
<field-name>city</field-name>
</cmp-field>
<cmp-field>
<field-name>state</field-name>
</cmp-field>
<cmp-field>
<field-name>country</field-name>
</cmp-field>
<cmp-field>
<field-name>accountStatus</field-name>
</cmp-field>
<cmp-field>
<field-name>createdBy</field-name>
</cmp-field>
<cmp-field>
<field-name>modifiedBy</field-name>
</cmp-field>
<cmp-field>
<field-name>modifyDate</field-name>
</cmp-field>
<cmp-field>
<field-name>createDate</field-name>
</cmp-field>
<primkey-field>iD</primkey-field>
<query>
<query-method>
<method-name>findByLoginName</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql> select object(l) from userSchema l WHERE l.loginName = ?1</ejb-ql>
</query>
<query>
<query-method>
<method-name>findByCreateDate</method-name>
<method-params>
<method-param>java.lang.Long</method-param>
</method-params>
</query-method>
<ejb-ql>select object(l) from userSchema l where l.createDate = ?1 </ejb-ql>
</query>
<query>
<query-method>
<method-name>findByModifyDate</method-name>
<method-params>
<method-param>java.lang.Long</method-param>
<method-param>java.lang.Long</method-param>
</method-params>
</query-method>
<ejb-ql>select object(l) from userSchema as l where l.modifyDate between ?1 and ?2</ejb-ql>
</query>
<query>
<query-method>
<method-name>findAll</method-name>
<method-params>
</method-params>
</query-method>
<ejb-ql>SELECT OBJECT(L) FROM userSchema L </ejb-ql>
</query>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>UserBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
can anyone suggest me on howto solve this problemI suspect that there is a type mismatch somewhere in the CMP fields (there is a ClassCastException in the trace).
Please check the generated code (UserBean1689033004_JDOState.java line 969) that can be found under
<appserver-install>/domains/domain1/server1/generated/ejb/j2ee-apps/<app-name>/<packages...>/
Thank you,
-marina
Maybe you are looking for
-
How To Copy Selected Music From One Library to Another?
What is the best way to copy selected music from one library to another? I have a big and growing iTunes library -- 33,000 songs. A year ago I copied my library to my daughter's new iMac. Now, a year later, I'm off to visit her and wonder how best t
-
How to use a jar from a external library DC Project?
I followed the steps of how to create DC, External Library Project, which contains the jar I want. I understood that this type of project can't be deployed so I build and deployed other DC Project from the type J2EE server component Library and added
-
Final Fantasy XIII - Midnight Release?
I have to admit, I fell out of the Final Fantasy series for a while, mainly because I bought an Xbox, and then a 360; so you can imagine how pumped I am to here that they are releasing it on 360. Strangely enough, however, I recently bought a PS3 so
-
How do I remove stray digital images of backward slashes from my laptop screen?
How do I remove a stray digital image of a backward slash from my computer screen?
-
Upgraded to OS6, browser not going to my account (virginmobile)
I have a Blackberry Pearl 3G 9100 (Virgin Mobile Canada) I just upgraded to OS 6 Now my browser is not pointing to my account site and has bookmarks for Bell Mobile (which I'm not with). What would be the address to my mobile account? (it must be a g