Alister Pate

Ranch Hand
+ Follow
since Sep 13, 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 Alister Pate

Hi everyone.

I'm migrating to struts 2, and having difficulty with the use of the iterator tag.

I have a form on a web page


This relates to an action class


The action class .setup() action is called to populate the jsp form, which id does correctly. When I hit submit, I expect the allAvailableSuppliers list to be populated in the action class. But it isn't - it is still empty.

I know that getAllAvailableSuppliers is being called, but it doesn't seem to be being populated.

Further more, I am getting an error. Here is a snippet.


I have based this as closely as I can on the EditPerson thing in the struts 2 examples, but I'm obviously doing something wrong.

This is killing me! Any thoughts?
12 years ago
Thanks, that actually seems to have sorted it out. I'm using the sydeo plugin for eclipse to generate it, so I didn't think to query it.

Just goes to show... shouldn't trust machines!

Thanks Ezra-who-is-also-known-as-Jon.
15 years ago
Hi guys

I'm having a problem deploying my web-app. It works fine as a war file, but when I try to use the context in the server.xml, it doesn't pick up my files at all: I get 404 errors. And nothing appears in the workDir.

Here is my context entry:


<Context path="/iBAS/" reloadable="true" docBase="C:\IBAS\Development\webApplication" workDir="C:\IBAS\Development\work\org\apache\jsp" >
<Logger className="org.apache.catalina.logger.SystemOutLogger" verbosity="4" timestamp="true"/>
</Context>



This is the correct path, as far as I can see. Otherwise, I'm just using the default server.xml which comes with a new installation of tomcat4.

Other info: yes, it is nested correctly (i.e. inside the host). This is an automatically generated insert from eclipse, using the tomcat plugin. There are no errors when I start tomcat. Errrmmm... I'm using windows 2000 FWIW. The web app shows up quite happily in the manager. All the files are in the appropriate places. As I say, it works quite happily as a war file.

The reason I don't want to use a war is that I don't want to have to delete the old expanded war directory and restart tomcat every single time I make a change... it makes my development life hellish.

I really don't understand what the problem is here. Any suggestions gratefuly received....
15 years ago
I've come up with a very, very strange problem.

Very occasionally I find an event firing twice. This is potentially a very big problem because the event it fires sends potentially thousands of SMS messages off - at an embarrassingly large cost.

I'm trying some defensive programming to stop the event from resending, but I'd prefer to trap this at source.

Does anyone have any ideas?

Alister Pate
16 years ago
Thanks for the input guys.

I'll think about it in terms of responsibilities - you are right - I do tend to make things purely passive information blocks. This is probably the result of too early an introduction to J2EE with its session beans and entity beans! So I tend to write verb-classes which do things (like session beans) and noun-classes which hold data (like entity beans) and don't have much behaviour. I'm deliberately modeling it in a J2EE sort of way so that if I need to port it to an EJB server it won't be too much of a conceptual leap.

I'll have a think about this.

Perhaps I need to go back to basics here and rethink the entire system. It's probably a bit late for this project, but for next time, maybe.

Warren, the relationship I am modelling is that a Job can have a number of different activities associated with it - so, for instance, a job might have 100 sms-send-activities - so one table for job, one for activity (to capture the idea of an "sms-send-activity"), and a table to capture the relationship, including the idea of "100-ness", if you see what I mean. You're right of course, it is a many-to-many relationship. Each activity can relate to a number of jobs - and each job might have a number of activities. Sorry, I was being a bit dense.
Hey Guys.

A slightly long winded question here: Please bear with me while I explain it as well as I can.

I have two conceptual things (I hesitate to call them classes yet..): Job and Activity. An activity might be "Send an sms" or "forward an sms to email" or something - it tracks what the job has done (and has to do). I also want to record that a Job has, say, sent 100 SMS messages or whatever. The job needs to have a number of activities associated with it.

From a DB perspective, this is pretty straightforward. One table for the job, one for the Activity (to hold the name field), and a linking table to facilitate the one-to-many relationship. The mapping table also holds the number of occurrences of that activity for that job - so, if a job had sent 100 messages it would be stored here.

My question is: Should I have two classes - Job and Activity, and have a field in the Activity class to hold number - or should I have three classes - Job, Activity and ActivityType - so that I can distinguish between the idea of the activity, and individual instances of that activity? It's almost like the relationship between class and object.

Any thoughts anyone?
For "fair" please read "sensible"! Too much negotiation in my day today....
16 years ago
Oddly, that does seem to work.

I presume it works because it references the collection in your bean - so if you have a collection of addresses, addresses[1].id works while address[1].id doesn't - because there is no address collection to be accessed.

Does that sound like a fair solution?
16 years ago
Hi Guys

I'm looking for a good resource on tomcat security. Does anyone know of anything apart from the tomcat website?

Secondly: I'm looking at hosting the app myself (I've got a permanent ip address), but I'm a bit concerned about possible network vulnerability if I'm running tomcat. Does anyone have any thoughts? Or indeed a good website I could look at?

Any suggestions gratefully received! Sorry this is such a vague question - I'm at such an early stage of looking at security that I don't even know what questions to ask! :roll:

Alister Pate
16 years ago
Hurrah! I've fixed it.

For anyone else with similar problems, the solution is to use the addBatch() method on preparedstatement. Also, I set the size of my batch to 1000;
Just for the sake of interest:
Here is the error I'm getting:

Thanks for replying!

Ah. Sorry, should have mentioned - I batch them up in lots of 100. Perhaps I need to change the number of available connections in mysql. Hmm.

But what's odd is that out of the 10k, say 8k work ok. There is just a problem with some of them. And it isn't the first 8k which work - the errors happen in the last half of the upload, but some won't work, then some will work.
Hi Guys
Not sure whether this should be here or in the tomcat forum. I'm sure someone will move it if it is in the wrong place.

My problem is that I am trying to import a large number of rows (10,000) into a MySql database. If I import say 1000 it seems to work ok. But with 10,000 I get connection errors (sorry, i'm at home and can't lay my hands on a stacktrace but it says something like "connect is already in use"). I'm using straight jdbc - no fussing around with connection pooling or what have you at the moment.

I have a method getConnection which supplies all the connections, and it is synchronized, which I would have thought would solve this sort of problem.

My thought is that the jvm might be trying to be clever and open multiple threads to access the database simultaneously.

Any diagnostic thoughts? Any suggested solutions? Any better approaches that I could be using? Or should I be asking this in the Tomcat forum?
Thanks for that.

Actually, it seems it was problems with the displaying of my results which was causing the problem, not with select at all.

That's the problem with having a fountain of all knowledge at my fingertips: it encourages me to ask first, search for an answer second.

16 years ago