This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin Cookbook and have Ken Kousen on-line!
See this thread for details.
Win a copy of Kotlin Cookbook this week in the Kotlin forum!

john b. smith

Greenhorn
+ Follow
since Apr 08, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by john b. smith

I am stymied with a jndi problem; can anyone shed some light on it or forward it to someone who may be able to help me?

Context: in a J2ee application, I have three layers in the EJB container: Session EJB => ModelDomain object (pojo) => Entity EJB.

To access an Entity EJB from Domain Model, it needs the Local Home of the ejb; it does a context lookup to get it.

The name it looks up (in the jndi server) must be established as a Reference in the Session EJB that calls the particular Domain Model object.

I've created that reference in the Session EJB deployment descriptor file and see it in there. But it doesn't appear that the wizard of builder or whatever handles this ever actually registers it with the jndi. (In WSAD 5.1.2 when you do this same step, the ejb local ref includes an id when it is bound : <ejb-local-ref id="EJBLocalRef_1253792978067"> ). In RAD7.5, it does not include such an id.

The result is that when the program runs, the Domain Model throws an exception:
Naming Error in ModelDomainUser.getLocalHome.JNDI lookup: Name comp/env/ejb not found in context "java:".

Questions:

How can I force the Session Reference wizard to actually bind the reference in the jndi?

Can anyone see anything else that might be going wrong here?

thanks

jbs@cs.unc.edu
10 years ago
I'm trying to edit the mapping for java Strings in RAD7.5, which defaults to VARCHAR(250), in the mapping editor (Map.mapxmi file). With WSAD5.2.1, you can right click on an item and "open table editor." But in RAD7.5, I can't see any way to do this or something similar. I have tried to manually edit Table.ddl files, but this has not effect when the schema is exported to the dbms.

Anyone know how to edit table entry mappings in 7.5?
10 years ago
I have been working in wsad5.1.2 and am now beginning to work in rad7.0. Two familiar wsad tasks that i can't find a way to do in rad are:

1. open the column editor in ejb map view to edit column names and, for varchar columns, lengths.

2. export the map to the dbms to generate the tables.

I've looked at the redbook programmers guide for rad7, and no luck; can anyone tell me how to accomplish these tasks in rad7.0?

thanks.
11 years ago
here's a link to a set of lessons that illustrate, with code, how to do this in wsad.

http://www.cs.unc.edu/Courses/jbs/docs/lessons/java/java_struts/index.html

jbs
14 years ago
Has anyone successfully built a WebSphere Struts applicaiton, running in WSAD (5.1.2), that uses form-based authentication and in which the user's name can be accessed in the Struts Action class (using request.getUserPrincipal())?

I've followed as closely as I can the process outlined in Kyle's second book, but get a null whenever I try to get the java.security.Principal object in my Struts Action.

Details:

1) I have login.jsp and app.jsp pages. app.jsp is secured along with its action mapping, /actionApp. I have also specified both GET and POST methods in the securing dialog (and also tried it with neither method specified under the assumption tht none implies all).

2) when app.jsp is referenced, it dutifully displays login.jsp. j_security_check seems to work properly, letting in registered users and not letting in unregistered ones.

3) after successful login, the app.jsp page is displayed. When values are filled in and a button pressed, control passes through the Struts action servlet and arrives at my ActionApp class, coming in through that class's execute() method.

4) within the execute method of the AccionApp class, the first thing I do is issue the following statement:
Principal principal = request.getUserPrincipal();

5) principal is always null

6) I have tried numerous vairations, including adding /action, action, the actual name.do that show up in the app.jsp-generated html, etc.

Help!

Anybody gotten somethingsimilar to work? Anybody see something I'm doing wrong?

thanks,

jbs
14 years ago
Has anyone successfully built a WebSphere Struts applicaiton, running in WSAD (5.1.2), that uses form-based authentication and in which the user's name can be accessed in the Struts Action class (using request.getUserPrincipal())?

I've followed as closely as I can the process outlined in Kyle's second book, but get a null whenever I try to get the java.security.Principal object in my Struts Action.

Details:

1) I have login.jsp and app.jsp pages. app.jsp is secured along with its action mapping, /actionApp. I have also specified both GET and POST methods in the securing dialog (and also tried it with neither method specified under the assumption tht none implies all).

2) when app.jsp is referenced, it dutifully displays login.jsp. j_security_check seems to work properly, letting in registered users and not letting in unregistered ones.

3) after successful login, the app.jsp page is displayed. When values are filled in and a button pressed, control passes through the Struts action servlet and arrives at my ActionApp class, coming in through that class's execute() method.

4) within the execute method of the AccionApp class, the first thing I do is issue the following statement:
Principal principal = request.getUserPrincipal();

5) principal is always null

6) I have tried numerous vairations, including adding /action, action, the actual name.do that show up in the app.jsp-generated html, etc.

Help!

Anybody gotten somethingsimilar to work? Anybody see something I'm doing wrong?

thanks,

jbs
14 years ago
I'm trying to determine whether or not there is a bug in WSAD 5.0 (Windows XP) with respect to Container-Managed Relationships that are self-referencing (e.g., nested Sets). The problem I am having is with attempts to remove a CMP ejb within such a relationship. (All other function works as expected.)

Has anyone got a working example of a 2.0 CMP ejb for which a one-to-many CMR is defined on itself (e.g., Set ejb with parent and children CMR roles to support Sets of Sets . . . ) that supports a remove of the ejb?

All functions work as expected when the relationship is defined between different EJBs (e.g., Set and SetMember) and all except remove work for self-referencing relationship (Set and Set). But remove casues exception buried within generated class.

Thanks.

thanks
15 years ago
oops:
Here are version of 3 and 4 from my earlier post, which I hope will show up:
<pre>
3. In the ejb.jar file, the folowing appears:
<ejb-local-ref id="EJBLocalRef_1065716243405">
<description></description>
<ejb-ref-name>ejb/SetLocalHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>ooc.ejb.td.set.SetLocalHome</local-home>
<local>ooc.ejb.td.set.SetLocal</local>
<ejb-link>Set</ejb-link>
</ejb-local-ref>
That looks right to me.
4. In the ibm-ejb-jar-bnd.xmi file, the following appears:
<ejbBindings xmi:id="EnterpriseBeanBinding_1062775164067" jndiName="ejb/ooc/ejb/td/set/SetHome">
<enterpriseBean xmi:type="ejb:ContainerManagedEntity" href="META-INF/ejb-jar.xml#Set"/>
<ejbRefBindings xmi:id="EjbRefBinding_1065716243405" jndiName="ejb/ooc/ejb/td/set/SetHome">
<bindingEjbRef xmi:type="common:EJBLocalRef" href="META-INF/ejb-jar.xml#EJBLocalRef_1065716243405"/>
</ejbRefBindings>
</ejbBindings>
</pre>
16 years ago
Has anyone ever gotten an ejb cmp entity bean with (only) local interfaces to work? That is, has anyone been able to do a lookup using JNDI on one and then either a cast or narrow to get the LocalHome interface?
I've read everyting I can find on this, tried everything I can think of, and am still hung up after a week's work. (I need to do this since I am using entity relationships which are defined only on the local interfaces.) This includes Kyle's suggestions of March 4, Mike Cox's "Use java:comp to Locate . . . " article, developerWorks' "Deploying multiple applications . . . " article. Etc. I'm stymied and wonder if anyone has ever gotten a local ejb interface to work. I am using WSAD 5.0.1 on a Windows XP machine.
Here are the specifics:
0. I do have a specified DataSource that I can lookup using the "java:comp/env/NAME" form for the local JNDI namespace, and I have looked at the .xml files which seem similar to those I have for my ejbs.
1. I have a cmp ejb with (only) local interfaces, called Set, withich generates SetBean, SetLocal, and SetLocalHome.
2. Under the deployment descriptor's References tab, I create an "EJBLocalRef" called ejb/SetLocalHome. I corretly points to the Local and LocalHome for the bean and results in the following WebSphere Baindings;" ejb/ooc/ejb/td/set/SetHome.
3. In the ejb.jar file, the folowing appears:
<ejb-local-ref id="EJBLocalRef_1065716243405">
<description></description>
<ejb-ref-name>ejb/SetLocalHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>ooc.ejb.td.set.SetLocalHome</local-home>
<local>ooc.ejb.td.set.SetLocal</local>
<ejb-link>Set</ejb-link>
</ejb-local-ref>
That looks right to me.
4. In the ibm-ejb-jar-bnd.xmi file, the following appears:
<ejbBindings xmi:id="EnterpriseBeanBinding_1062775164067" jndiName="ejb/ooc/ejb/td/set/SetHome">
<enterpriseBean xmi:type="ejb:ContainerManagedEntity" href="META-INF/ejb-jar.xml#Set"/>
<ejbRefBindings xmi:id="EjbRefBinding_1065716243405" jndiName="ejb/ooc/ejb/td/set/SetHome">
<bindingEjbRef xmi:type="common:EJBLocalRef" href="META-INF/ejb-jar.xml#EJBLocalRef_1065716243405"/>
</ejbRefBindings>
</ejbBindings>
5. My code to lookup the local interface is the following:
SetLocalHome setLocalHome = null;
InitialContext context;
context = new InitialContext();
Object obj = context.lookup( "java:comp/env/ejb/SetLocalHome" );
setLocalHome = (SetLocalHome)(javax.rmi.PortableRemoteObject.narrow( obj, SetLocalHome.class ));
6. After "generating deployment and rmic code" and rebuilding the project, I get the following error (within a NameingException block):
Naming Error in SetMapper.getSetLocalHome.JNDI lookup: Name comp/env/ejb not found in context "java:".
7. I can see the global-named SetHome" interface in the JNDI client test program, but haven't been able to do a direct invokation using any name I can think of to use.
8. I have tried every combination of name, build and deploy sequence, and everything else I can think of, including rebooting system to get a fresh JNDI server, stoping WAS while WSAD is running, etc., etc.
9. HELP!!!
16 years ago
I'm a newbie to WebSphere/WSAD transactions. I'm trying to get a simple cmt transaction to work in which a method in a session ejb creates an instance of ejb1 and then an instance of ejb2. In the catch statment, I do a "mySessionCtx.setRollbackOnly()." ejb1 is a bmp bean with cmt set to "required." ejb2 is a cmp bean with similar cmt setting. In the server configuration (WSAD), I have defined the following provider, with brings in the XADataSource: COM.ibm.db2.jdbc.DB2XADataSource.
I am using db2v8.1 and WSAD 5.0, running on Windows 2000 Professional on an IBM 220 server pc.
If both creates work, all is fine. If the second create fails (I'm forcing this with an invalide key in the ccreate statement), the system does, in fact, do the rollback on ejb1, as it should, but it throws several exceptions:
1) XAException occurred. Error code is: XAER_PROTO.
2) An exception occurred while invoking rollback on an XA Resource Adapter from dataSource jdbc/ooc, within transaction ID {XID: formatId(57415344), gtrid_length(26), bqual_length(25), data(00000001 041420A3 0D66AB6D F15A0F12 AA445A5A BBFEC1E4 CA3C0120 A30D66AB 6DF15A0F 12AA445A 5ABBFEC1 E4CA3CE9 827C51)}: javax.transaction.xa.XAException.
3) 7d5cc2f0 JTAXAResource u Encountered an XA resource error during an XA rollback operation: error code: -6.
The exception comes in the ejb lifecycle on the return from the ejb1 ejbStore method.
Can anyone tell me what is happening here and how to fix the problem?
thanks
16 years ago
I have a simple tutorial meant to be used in a workshop format. It is based on a very simple, "hello, world" level application that goes from front to back. If you want to look at it, you can at: http://www.cs.unc.edu/~jbs/talks/websphere5_0_workshop/.
jbs
16 years ago
I am using the DB2 Control Center heavily in developing ejbs in WSAD5.0. All of a sudden, after three months of trouble-free use, it won't start. (Neither will the Command Center.) After a boot, the logo comes up, the progression bar gets 1/3 the way across and it simly stops. After that, ti stops quicker.
Here are the various messages I see in the logs:
1)run time error on SERVPRE log: D:\MyServers\DB2\BIN\iwh2serv.exe
2)Log log:
***** Log Server Had a Fatal Error *****
* Error point: VWConfiguration::init
* RC1: 2009
* RC2: -5035
* Domain: ODBC
* SQLState: 55001
* SysMsg: [IBM][CLI Driver] SQL5035N The database requires migration to the current release. SQLSTATE=55001

* Comment: VWConfiguration::init
***** Log Server Has Aborted!!! *****
3)LOGC message: VWRC Method Name : VWKernelService::stop
*************************************
In the 12 hours before it quit, two unusal things happened:
1) the evening before, I went to use one of the help menu items on the DB2 Control Center -- I believe the general help one -- and the system just froze. A distorted window came up, even when killed the system was really dragging (unusable). I closed down (gracefullY) and did not reboot until this am.
2) I'm experimenting with XA transactions within WSAD. I defined a new data base resource using the XAResrouce, datasource and connection files. I then ran a version of that server inside WSAD. that all seems ok.
3) In current state, even though can't run Control Center and the Command Center, the database, itself, still seems to be working properly.
4) I ran the repair option on the DB2 download, but to no effect. I am considering reinstalling the whole thing, but hate to lose tables I have.
Any suggestions on how to get this very necessary tool for working with WSAD back?
john
16 years ago
Thanks, Dave. I now have a gen-u-wine 2-phase seesion ejb that in the same method can create instances of two different entity beans. All works fine now (e.g., no throuwn exceptions as described in original message) when both beans are successfully created. However, I'm getting exceptions during the rollback. I suspect I need to do something in my bmp ejb in ejbLoad and/or ejbStore, but I'll work on that.
In the meantime, I'll pass on a couple of things I have learned re. the "db2xadriver."
1) I don't think there is any such beast. I believe at the driver level it using the same "universal db2driver." What it seems to need is a set of XA classes including DB2XAResource DB2XADataSource and DB2XAConnection classes which are in the db2java.zip file.
2) The critical missing step is to define a new XA JDBC Provider and datasource objects. (I created a new Test Server and configuration to keep it separate from the 1-phase version.) Then, going to the Data Soruce tab for the new server, I created a new JDBC Provider, selecting COM.ibm.db2.jdbc.DB2XADataSource as the implementation class. I also added a new DataSource to be used with this provider.
Thanks for the pointer. On to the next problem!
john
16 years ago
I'd like to use CMP EJBs. I'd like to have a DB2 table that includes a primary key supplied by the EJB (contentID) and a second column (fileID)that has sequential integer values generated by DB2 (i.e., DB2 Identity values).
I know that I can't do a Top-Down mapping to get this, but thought I should be able to do a Bottom Up one. So, I created the table in DB2, generated the EJB using WSAD5.01 with the Bottom Up option. It generates the EJB and everything looks fine (e.g., it includes the expected create method in the EJB Home object that includes the single to-be-supplied key value --contentID). It also deploys fine.
However, when I try to run it in the TestServer and use the single valaue create method in Home, it generates the following error:
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0798N A value cannot be specified for column "FILEID" which is defined as GENERATED ALWAYS. SQLSTATE=428C9
javax.ejb.EJBException: nested exception is: com.ibm.ws.ejbpersistence.utilpm.PersistenceManagerException: PMGR6022E: Error using adapter to create or execute an Interaction. com.ibm.ws.rsadapter.cci.WSInteractionImpl@124cbe71
But, I'm not supplying a value for fileID and no such method is visible in a class that I can see. I suppose the driver is doing this under the hood somewhere.
Questions:
1) can anyone shed any light on what is going on here?
2) is it possible to generate a CMP EJB from a DB2 table that includes an autogenerated column?
3) if so, can you point me in the right direction to do it?
thanks
16 years ago
've got a copy of that redbook; if you send me an email address, i'll send you a url to it.
16 years ago