J Waldinger

Greenhorn
+ Follow
since Sep 05, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by J Waldinger

Hi,
I have a finder method in an EJB that can return multiple results. However, the finder method's return type is the local interface - not a Collection.
This worked fine when the code was running in an EJB 1.0 container, but now that it has been upgraded to EJB2.0, it is breaking when more than one record comes back from this finder query.
Do I need to change the return type to Collection and then modify all the calling classes accordingly? Or is there some other way to get around this?
Thanks much,
Jamie Waldinger
Hi,
I have a stateless session bean with bean-managed transactions. It is throwing an IllegalStateException when it tries to call:
utx = mySessionCtx.getUserTransaction();
where utx is a javax.transaction.UserTransaction and mySessionCtx is a javax.ejb.SessionContext. The bean is defined as follows:
<session id="Session_1061575773750">
<ejb-name>ReservationManager</ejb-name>
<home>com.bostoncoach.gtx.ReservationManagerHome</home>
<remote>com.bostoncoach.gtx.ReservationManager</remote>
<ejb-class>com.bostoncoach.gtx.ReservationManagerBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<env-entry id="EnvEntry_1061575892797">
<env-entry-name>ejb10-properties/loglevel</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>bleach</env-entry-value>
</env-entry>
</session>
According to JavaDoc, getUserTransaction throws "java.lang.IllegalStateException - The Container throws the exception if the instance is not allowed to use the UserTransaction interface (i.e. the instance is of a bean with container-managed transactions)."
However, according to the definition of my bean in the deployment descriptor, this is a stateless session bean with bean-managed transactions, and hence should be fine. So what's up?
Many thanks for any help.
Jamie
Hi,
I am running an application in WAS 5 for the first time. The application compiles, installs, and starts up fine - no errors. Yet when I try and invoke an EJB, I get the following error:
NMSV0602E: Naming Service unavailable. A communications error occurred. A connection to the name server could not be made when attempting create an initial context.
I understand what this means, yet I am not sure how to check that it is set up correctly. Can anyone help?
Thank you,
Jamie
21 years ago
Well, true - but I'm not using ANT to do builds I'm using WSAD. There's various workarounds for this problem, but it just seemed wrong to me that /conf and /lib weren't in the classpath - and I don't know how to correct that.
Hi,
I have a Web app that is packaged in a WAR file. I am using a properties file which I need to be in the classpath in order for it to get loaded. I have tried putting it under /WEB-INF/conf and under /WEB_INF/lib, but neither one works - those directories don't seem to be in the classpath. How can I add them to the classpath?
I've tried putting the file under /WEB-INF/classes, and this works. However, I don't want it to be there because it gets overwritten every time I do a build.
Thanks,
Jamie
Hi,
I have two problems that I would greatly appreciate help with. They are both related to setup of my enterprise app in WSAD. I have been migrating the code from WAS 3.5, and I believe I have all the code changes complete.
However, there are two issues I'm having when I try to start the application in the embedded WAS Test environment. Here they are:
1) When it tries to start the EJB's, it fails to find several helper objects which are packaged with my Web app. The EJB's all compile fine b/c I have the web app project included as a required project on the build path. Yet when the EJB's start up, I get several errors like this:
[9/9/03 17:13:52:000 EDT] 41379115 BeanMetaData E CNTR0075E: The user-provided class "<null>" needed by the EnterpriseBean could not be found or loaded.
[9/9/03 17:13:52:016 EDT] 41379115 EJBContainerI E WSVR0209E: Unable to prepare EJB jar GTXEJB.jar [class com.ibm.ws.runtime.component.DeployedModuleImpl], enterprise bean com.ibm.etools.ejb.impl.ContainerManagedEntityImpl(ProfilePromotionMap) (reentrant: false) (version: 2.x, abstractSchemaName: CO_USER_PROMO)
java.lang.NoClassDefFoundError: com/bostoncoach/gtx/helperobjects/Promotion
at java.lang.Class.getMethods0(Native Method)
at java.lang.Class.getMethods(Class.java:782)
at com.ibm.ejs.container.util.DeploymentUtil.getMethods(DeploymentUtil.java:124)
at com.ibm.ejs.container.BeanMetaData.initializeBeanMethods(BeanMetaData.java:1499)
...which indicate to me that it can't find these required classes even though they are packaged in the web app. I am also getting this error, which may or may not be related:
[9/9/03 17:13:51:938 EDT] 41379115 IndirectJndiL W NMSV0701W: An IndirectJNDILookup object was created with an empty name. Lookups using this object will fail.
java.lang.Throwable
at com.ibm.ws.naming.util.IndirectJndiLookup.init(IndirectJndiLookup.java:239)
at com.ibm.ws.naming.util.IndirectJndiLookup.<init>(IndirectJndiLookup.java:161)
Thanks very much for any assistance.
-Jamie
21 years ago
Thanks for the help. I have but one remaining error in my new 2.0 compliant ejb-jar file. The error is:
"unknown EJB or ASN name: com.bostoncoach.gtx.AFReceiptRegistryKey"
Here is the query:
<query>
<description>Converted from IBM version 1.1 extensions.</description>
<query-method>
<method-name>findByReservationReferenceNumber</method-name>
<method-params>
<method-param>com.bostoncoach.gtx.AFReceiptRegistryKey</method-param>
</method-params>
</query-method>
<ejb-ql>select object(rr) from AFReceiptRegistry rr where rr.reservationReferenceNumber = ?1</ejb-ql>
</query>
I thought perhaps this was due to a change in the EJB 2.0 spec, however when I created a new query using WSAD's tools, using the same class as a method parameter, it created a query that looked identical to this one. Given that this class (AFReceiptRegistryKey) is located within this project's EJB module, why am I getting this error?
Thanks,
Jamie
My 1.1 beans were CMP. And WebSphere is my application server. The application was coded to use these findForUpdate() methods throughout - although I'm not certain what the impact would be of replacing them with regular finder methods.
It appears that the WebSphere implementation of this is called 'Access Intents'. There are 6 different kinds of access intent - I'm guessing that the one I want is: wsPessimisticUpdate.
Jamie
Hi,
I am converting an application with EJB 1.1 to EJB 2.0. In my original EJB's, I have several findForUpdate methods defined for my CMP Entity beans. However, EJB2.0 and EJB-QL doesn't seem to support the "FOR UPDATE" clause in the ejb-ql statements. How do I is this done in EJB 2.0 ?
Thanks,
Jamie
Lasse,
That worked just fine. (Or, at least, it compiles...)
Thanks very much for your help - I hadn't realized you were supposed to use the EJB field names in the query as opposed to the column names. It strikes me as odd, then, that you still use the table name in the 'from' clause...
Jamie
Sure thing. It's a bit long, but here is the section from the ejb-jar.xml:
<entity id="ContainerManagedEntity_1061575772906">
<ejb-name>ProfilePromotionMap</ejb-name>
<home>com.bostoncoach.gtx.ProfilePromotionMapHome</home>
<remote>com.bostoncoach.gtx.ProfilePromotionMap</remote>
<ejb-class>com.bostoncoach.gtx.ProfilePromotionMapBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>com.bostoncoach.gtx.ProfilePromotionMapKey</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>CO_USER_PROMO</abstract-schema-name>
<cmp-field id="CMPAttribute_1061575892234">
<field-name>sequenceNo</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_1061575892235">
<field-name>profileID</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_1061575892236">
<field-name>memberCode</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_1061575892237">
<field-name>promotionProgram</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_1061575892238">
<field-name>lastUpdateKey</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_1061575892239">
<field-name>promotionProgramMemberID</field-name>
</cmp-field>
<query>
<description>Converted from IBM version 1.1 extensions.</description>
<query-method>
<method-name>findPromotions</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>select object(up) from CO_USER_PROMO up where up.MEM_C=?1 AND up.USER_ID=?2</ejb-ql>
</query>
<query>
<description>Converted from IBM version 1.1 extensions.</description>
<query-method>
<method-name>findForUpdate</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
<method-param>char</method-param>
</method-params>
</query-method>
<ejb-ql>MEM_C=? AND USER_ID=? AND SEQ_N=?-1</ejb-ql>
</query>
<query>
<description>Converted from IBM version 1.1 extensions.</description>
<query-method>
<method-name>findPromotionsForUpdate</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>MEM_C=? AND USER_ID=? FOR UPDATE</ejb-ql>
</query>
</entity>
Not that these ejb-ql methods were auto-generated from 1.1 finder methods. The first one is the only one I have tried to fix so far - the second two still give vanilla syntax errors - I imagine because the don't have a select clause, etc.
Is the following what you mean by 'vendor-specific' files? The following came from ibm-ejb-jar-ext.xmi. I am not very familiar with this file.
<ejbExtensions xmi:type="ejbext:ContainerManagedEntityExtension" xmi:id="ContainerManagedEntityExtension_18">
<runAsSettings xmi:id="SecurityIdentity_28">
<methodElements xmi:id="MethodElement_72" name="*" type="Unspecified">
<enterpriseBean xmi:type="ejb:ContainerManagedEntity" href="META-INF/ejb-jar.xml#ContainerManagedEntity_1061575772906"/>
</methodElements>
<runAsMode xmi:type="ejbext:UseSystemIdentity" xmi:id="UseSystemIdentity_28"/>
</runAsSettings>
<enterpriseBean xmi:type="ejb:ContainerManagedEntity" href="META-INF/ejb-jar.xml#ContainerManagedEntity_1061575772906"/>
</ejbExtensions>
Thanks very much for your help.
Jamie
Hi - I am upgrading an EJB 1.0 application to EJB 2.0, and am having some difficulty getting my EJB-QL to compile for my additional finder methods. I'm using WSAD 5, and am getting an error: "TABLE_NAME does not have a field COLUMN_NAME". I know for a fact that it does have this column, but how do I let the compiler know this? Here is my query:
<ejb-ql>select object(up) from table_name as up where up.column_name = ?1 and up.other_column = ?2</ejb-ql>
Thanks for the help,
Jamie
[email protected]