Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

Fergus Red

Ranch Hand
+ Follow
since Apr 25, 2002
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 Fergus Red

What I mean by the above is, if I have a Java developed website, then if I press a link on a jsp page etc, then is it possible that this link could open an application on the Client machine who is accessing the website through their browser.
For example when I click on the link, Excel, or Word opens on the client machine (if it is installed).
I'm not sure if this is possible, but maybe it is as after all cookies etc can be created on a client machine from a website.
If this is possible then how is this possible, any info and examples would be great etc?
19 years ago
Hi, I've asked a similiar question to this forum already but could not get it solved.
What I said before was that I am getting a "Unsupported Data Conversion" on trying to insert a value in a database using a create() method in my EJB.
I've now realised that the error occurs in my container managed EJB because I am trying to return the primary key value for my new record inserted.
If I do not try to retrieve this value from my insert, my insert works fine.
I am using Microsoft SQL Server JDBC Driver. Before this I was using a JDBC-ODBC bridge and the error did not occur but since I moved to my SQL Server driver my error results.
My Stored Procedure called is as follows:
CREATE PROCEDURE spr_ins_ContactEvent
@cSession int,
@aSession int,
@interactiveItemKey int,
@accountKey int,
@treatKey int,
@methodOfContact char(6),
@promoCode char(6),
@direction char(1),
@contactDate datetime,
@contactEventKey int OUTPUT
AS
BEGIN
INSERT INTO contactEvent(cSession, aSession, interactiveItemKey, accountKey, treatKey, methodOfContact, promoCode, direction, contactDate)
VALUES (@cSession, @aSession, @interactiveItemKey, @accountKey, @treatKey, @methodOfContact, @promoCode, @direction, getDate())
SELECT @contactEventKey = MAX(contactEventKey) FROM contactEvent
END
GO
My XML insert method is as follows:
<env-entry>
<env-entry-name>ejipt.createSQL</env-entry-name>
<env-entry-value>{call spr_ins_ContactEvent (?,?,?,?,?,?,?,?,?,?)}</env-entry-value>
</env-entry>
<env-entry>
<env-entry-name>ejipt.createSQL.source</env-entry-name>
<env-entry-value>myjdbc</env-entry-value>
</env-entry>
<env-entry>
<env-entry-name>ejipt.createSQL.params</env-entry-name>
<env-entry-value>cSession,aSession,interactiveItemKey,accountKey,treatKey,methodOfContact,promoCode,direction,contactDate,contactEventKey UT</env-entry-value>
</env-entry>
<env-entry>
<env-entry-name>ejipt.createSQL.paramTypes</env-entry-name>
<env-entry-value>INTEGER, INTEGER, INTEGER, INTEGER, INTEGER, CHAR, CHAR, CHAR, TIMESTAMP, INTEGER</env-entry-value>
</env-entry>
<env-entry>
<env-entry-name>ejipt.createSQL.fields</env-entry-name>
<env-entry-value>contactEventKey</env-entry-value>
</env-entry>

Can anyone see where my problem lies, or do you know if Microsoft SQL Server JDBC drivers always cause this problem?
Cheers in advance,
Fergus
I found out that my unsupported Data Conversion occurs as a result of trying to return an integer from my Create ststement.
I am trying to reurn the key from the database but cannot seem to do so without recieving an error.
Does anyone have any more suggestions on why thiw may be occuring and how to solve it?
Cheers for the help. I'll try and determine compatibality between my database and driver now.
Hi,
I am trying to change from a jdbc-odbc driver to a jdbc driver for a web sire which is created using EJB architecture.
I am changing to a SQLServer jdbc driver and as my web site is running and deployed off a JRUN 3.1 application server, I am moving to use a jdbc:jrun:sqlserver jdbc driver.
I have created a datasource using this driver and deployed my changes to the server.
My web site seems to run fine in reading data from the database but I get an error when i try to connect from a session bean to a create method in one of my entity beans. The error I get is an "[JRun][SQLServer JDBC]Unsupported Data Conversion error"

My error occurs at the following code:

try {
contactEvent = contactEventHome.create(sessionKey, sessionKey, interactiveItemKey, zccountKey, treatKey,
methodOfContact, promoCode, direction);
return ((ContactEventPK)contactEvent.getPrimaryKey()).contactEventKey;
}
catch (CreateException ce) {
throw new EJBException("ContactSys - failed to create new ContactEvent");
}
}catch (java.rmi.RemoteException re) {
throw new javax.ejb.EJBException(re);
}
The error is thrown within the "catch (java.rmi.RemoteException re) {" statement.

DO you know why my error is occuring, and how I can solve this?
Cheers in Advance.
I Wish Dan I knew why this happens. Also I have not tried this in Linux as only done so in Windows.
Obviously it's not the most stable way of keeping memory levels low, but as I could not get any other way to work I had to use this method temporarily.
If anyone can explain why this works, and if it is possible to create a program which constantly releases memory as in the window minimising and maximising function then any info on this would be great.
Cheers for the help.
19 years ago
Cheers for the info karl koch>
Here's another weird point which some of you might be able to explain.
In My Windows Task Manager programme. I monitor the memory levels used by my Java processes.
My web site was running Javaw.exe processes, but I've now changed to run a java.exe.
I leave the java.exe process running in a dos window on my web server.
If my memory levels are high for my java.exe process. Then If I minimize my dos window (where my java.exe is running) and then maximize this window again, my memory levels drop from my java.exe in my Task Manager processes.
Can any of you explain why this happens. I am currently using this manual way to keep my memory levels low. Does minimising my dos window somehow initiate Garbage Collection, and if so is thee some way I can program this to happen automatically?
[ March 10, 2003: Message edited by: Fergus Red ]
19 years ago
Hi,
I am having a lot of memory leakage problems with an EJB developed web site which runs on a JRUN 3.1 application server.
I wondered do you know if using "System.gc()" is a good wayt to help solve memory leakage problems and if so, then would I have to implement it in every Java class (seems a bit of a pain to have to do) or can I just write a class which uses this method and takes care of memory usage for the whole application server?
Any help on this or any ideas would be greatly appreciated.
19 years ago
Note also: I have placed the jndi.jar file in H:\Allaire\JRun\servers\ormoe1x1\default-app\WEB-INF\classes folder and reference this is in my classpaths in dos
Hi,
I am trying to execute a dos command which calls a class which then uses some EJB's in it's processing.
I keep getting errors at the line jndiContext.lookup("java:comp/env/ejb/" + ejbName); in my class
I have added the fscontext.jar and providerutil.jar files to my lib folder, and added them to my classpath's in my dos command, but this still has not resolved my problem.
My EJB jar files are stored under the deploy folder under my JRun server.
Do you know what I do if I am to replace the line ("java:comp/env/ejb/" + ejbName); in my class. Do I use somew other line of code to reference my EJB's or do I need to add somethign to make them accessible using the line above.
Any help on this would be greatly appreciated.
Note: My EJB's worked fine when i used them from servlets and JSP. It just seems to be a problem i am getting through Dos.
[ January 27, 2003: Message edited by: Fergus Red ]
Hi,
I am trying to run a java class from a dos command. This class tries to instantiate EJB session beans.
I can run this class from calling a servlet from a JSP page but need to run the same process from a dos command also so I have created a new class to carry out the same functions as my servlet.
When I try to creat my home object for my session beans from my new class I cannot seem to do so. It breaks down in the following method.
public static Object getEJBHome(String ejbName) {
// lookup the Session bean home object using JNDI
Object homeObj = null;

try {
javax.naming.Context jndiContext = new javax.naming.InitialContext();
if(jndiContext == null) {
System.out.println("jndiContext == null");
}else{
System.out.println("jndiContext != null");
}
System.out.println("About to retrieve homeObj");
System.out.println("ejbName = " + ejbName);
homeObj = jndiContext.lookup("java:comp/env/ejb/" + ejbName);
if(homeObj == null) {
System.out.println("homeObj == null");
}else{
System.out.println("homeObj != null");
}
} catch (javax.naming.NamingException ne) {
System.out.println("NamingException ne = " + ne.toString());
//throw new ServletException(ne);
}
return homeObj;
}
I receive a NamingException as follows:
NamingException ne = javax.naming.NoInitialContextException: Need to specify
class name in environment or system property, or as an applet parameter, or in
application resource file: java.naming.factory.initial

I do not receive this exception when i run similiar operations from jsp and servlets. Does anyone know how I can run my dos command without getting this problem?
19 years ago
Hi all, I managed to get this working myself - cheers all the same. My answer was as follows.
To execute the following.

C:\jdk1.3\bin\java -cp .;d:\Allaire\jrun\servers\server10\default-app\web-inf\classes\utils.jar;d:\Allaire\jrun\servers\server10\default-app\web- inf\classes\remoteAndHomeInterfaces.jar dev.projectA.utils.TriggerEmailDispatchTest
19 years ago
Hi, yesterday i posted a question in the java intermediate section regarding the execution of a java class from a dos batch command. my question was as follows
"Hi,
I am trying to execute a java class from a dos batch file. The java class exists in a jar file on my Jrun application server.
I have successfully executed java classes from batch commands before, however on these instances the java class did not reside in a jar file. In this instance, I cannot seem to execute my java class that resides in my jar file.
My batch command is as follows
C:\jdk1.3\bin\java -cp d:\Allaire\jrun\servers\server10\default-app\web-inf\classes\utils.jar dev.projectA.utils.TriggerEmailDispatchTest
When I try to execute the batch command it seems as if it has run currently, however it does not execute my Java class as rewquired.
Can you see where I am going wrong? Or what do I need to do differently to execute a java class from a dos batch file?
The reason I am executing this from a batch file is because i will be adding this to my windows scheduler to run at scheduled times.
Cheers in advance for the help. "

The answer I received and accepted was as follows:
"C:\jdk1.3\bin\java -cp .;d:\Allaire\jrun\servers\server10\default-app\web-inf\classes\utils.jar dev.projectA.utils.TriggerEmailDispatchTest"
This solved my problem to run my TriggerEmailDispatchTest class which sits in my utils.jar file.
However the TriggerEmailDispatchTest class uses a class (AccountSysHome) which is held in another jar file. This jar file is d:\Allaire\jrun\servers\server10\default-app\web-inf\classes\remoteAndHomeInterfaces.jar
I cannot seem to instantiate my AccountSysHome class as it cannot seem to be found from my TriggerEmailDispatchTest class held in my utils.jar file.
Does anyone have any suggestions as to how I can get this working.
Thanks in advance
[ January 21, 2003: Message edited by: Fergus Red ]
19 years ago
Hi, I've managed to get it working without altering the manifest file.
I ran the following command
c:
cd jdk1.3\bin
java -cp ;d:\Allaire\jrun\servers\server10\default-app\web-inf\classes\utils.jar dev.projectA.utils.TriggerEmailDispatchTest
19 years ago