Win a copy of Microservices Testing (Live Project) this week in the Spring forum!

Lidia Cyc

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

Recent posts by Lidia Cyc


i have to build a following code module:
a timer mbean calls after every pre-set time interval a listener implementing NotificationListener, which should trigger a business method of a slsb.

i have two problems:

1. i need the mbean to start the calls automatically. but jmx server is loaded before the application server, and therefore any attempt to call a sessionbean from the listener will fail due to the lack of application context. what is the right solution for this issue? should i build a slsb which will register the mbean programatically and run the mbean's method that sends a notification after the registration?

2. if i try to run mbean's method that sends a notification to the listener manually (by using administration control panel) when the app server is running, the listener still fails to make a jndi name lookup of the slsb's name, throwing an exception that it's not running in the app.server's environment. i guess the listener instance, registered with mbean, is created in jmx server too. but shouldn't there be a way to get a reference to the app.server context also from the jmx server?

thank you for your time!

i need a newbie help.
i'm looking for a tool/technology that can build an xml document/schema, representing a java bean, and visa versa can load a data from an xml document into a java bean object .

there is always an option to build something like this, but i guess there are well designed ready applications that can save my time and efforts.

thanks for your help.
Hello gurus,

I've never coded web services earlier, but now I have to develop
a service for a pretty old and complicated application.

I use AXIS and the problem I am expecting is as follows:

I have to deliver beans that include ArrayLists, Vectors and Hashtables.
While creating new beans for use with WS, AXIS replaces Hashtables with Hashmaps, ArrayLists with object arrays, and just Vectors are left as they are. As I already mentioned, the application is large and old and there is no way I can replace Hashtables and ArrayLists in the existing beans to fit
The AXIS/SOAP requirements.

My first idea was to create a new set of beans that will include Hashmaps and Vectors instead of Hashtables and ArrayLists to avoid the problems with AXIS/SOAP complex types mapping, and to build an introspection mechanism in my WS-handler class that will receive the new type of beans, parse them into the old types, trigger the existing system logics, introspect the old type beans received from the application back into the new types of beans and send a response back to the client.

But then I realized that Hashmaps and Vectors won't solve the problem in case the client will be written in .NET. Which means I can't even use Hashmaps and Vectors, but just arrays of objects. In case of Vectors this also can be solved, but I'm pretty puzzled how can the Hashmaps be represented in this case.

Anyway, my questions are:
1. Do you think the two bean types plus introspection scenario is the right one, or there are any other better solutions around?
2. Should I use Vectors and Hashmaps instead of ArrayLists and Hashtables, or the right way is to go down with simple arrays of objects?
3. If the answer to the second question is positive, how can Hashtables be represented by arrays of objects?

Thank you for your time!
15 years ago
a strange thing i can't find a sollution for.

i have a web app that runs in tomcat's root (placed in \webapps\ROOT).
don't ask me why, it's just there.
the controller servlet of the app has <load-on-startup>1..
it also prints in output "START INIT" when loaded.

when i start tomcat i see this:

and then once more the same thing:

tomcat not only prints the report twice, it loads the webapp twice, because right after the second time i get a nasty exception:

tomcat doesn't die, and the application runs ok. but still, i don't wanna leave it as it is,, knowing that something is wrong.
any ideas?
17 years ago
hi, i need a javascript plug-in. so i downloaded one from wdte project.
i'm totally new to eclipse, so i just unzipped the plug-in's jars into the plugin folder, and restarted the ide.
while checking in help->about->plug-in details i see that the new plugins (actually there are 4 of them) are in the plug-ins list. so i guess that's it.
when i open an existing .js file i can see the highlighting , but there is no automatical methods addition (i mean when write a java code and type a dot after an object name, u get a list of methods that can be called on it)..
when i start a new file, there is even no highlighting...

please help me,
thank you.
well, such request won't be simultanious..
ok, thanks a lot for replies.
ok. didn't see this in the books...

i thought the stateful session bean instance is serving one client only. the client which state is actually kept. how comes another client can call the same bean?
i had a written test as a part of a job interview. and there was a question which sounds very strange for me:

there is a living stateFUL bean in the middle of the business method.
a new client request arrives but the bean is not done yet with the request that arrived earlier. what happens?

what would you say?
i have a jsp file which <jsp:includes> two other files.
there is a link in one of those files which sends a request to a servlet that invalidates a session.
with cookies enabled everything works ok. with cookies disabled the session is not invalidated... may be a jsp file which includes 2 other files have some other session tracking technic?
18 years ago

i've seen on some pages, that they use an encryption for the parameters delivered by GET. for example, i wanna request an url with a couple of parameters, something like this:

instead of seeing this explicit url you get this one:

from this i can understand that the parameters have been encrypted and the string which actually includes encrypted parameters passed as a parameter by itself.
as i also understand, the server gets this "code" parameter and knows how to get the encrypted parameters from it.
my questions are:
1. is there any common way this thing can be done in java?
2. i'm sure there are encryption classes, but if all this works the way i think, if encryption used we need to parse the unencrypted string of parameters and values with tokenizers or something, because there is no "request.getParameter("age")" way..

18 years ago

i do know that there is a length limit of the url (255 chars), so i can't use GET, because i have to pass a high number of parameters, which names are 9 chars long and values are 21 chars long.

i'm wondering if there are any limits on the parameter name/value length, or a total length/size of parameters that can be passed without being truncated by server, or something like this....

i can't find in api that there is any limit, but still, if my app designed the way it needs to pass a lot of parameters with long names (9 chars) and long values (21 chars).

can this cause problems?

if not, is it a good taste to build app that can use POST request only?

18 years ago
my method has to check if a row already exists in db and in case it does - update it, or in case it does not - insert it.

the db table is unique indexed .

the mission sounds very simple, but i thought about 3 possible ways of doing this, and i'm not sure wich one will be the fastest + the best architecture.

way 1:
to run "select..." request, and then check if
if true - update, else - insert.

way 2:
to run "insert...". if the unique index does not exist, it will work
fine. if it exists, the sqlexception will be thrown. in the catch
block i check if exception.getMessage() includes a string "duplicate
entry" (i don't remember the message text right now...) if it does
include it - i run "update..".

way 3:
first of all i run "delete.." query, and then "insert..".

thanks in advance for your comments.
hey all,
2 design questions:
i develop a webapp trying to keep it mvc clean. so, there are business beans and data access classes responsible for those beans-to-database relations (loading, storing, etc).
1. i've seen that some folks make the methods of the data access classes static and some others don't. what is the better solution? does static in this case means thread safe?
2. there is a chance that in the code i'll need a number of those data access methods in a sequence. taking in account that i use a connection pooling, would you make those methods receive a Connection object from outside (this way a number of methods will be executed with the same connection, but i'll have to leave all connection.close() bla bla bla stuff
out of the method scope) or would you put all of the db connection logic inside the methods (this way i'll have to take a new connection from the pool for each method and method...) ?
and, if you are in the "let's help this guy" mood, take a look at this :
may be you'll give me a cool advice.
hi gurus, i need an advice for the right application architecture.
i am working on a webapp with a lot of different features which include a work with a db. i use tomcat's data pooling management - dbcp.
the InitialContext.lookup() is needed to get the DataSource object. i was thinking about the right way to make the number of lookups as few as possible-i belive this operation is really slow.
the first think i thought about is a servlet which gets the DataSource in its
init(). but pretty quickly i understood that this servlet will become a huge mess of control and business logics. to keep the mvc clean i wanna refactor it into one controller and a lot of servlets - each of them will deal with its own business objects. now, i still don't wanna make the lookup() in each of those sevlets.
i was thinking about a ServletContextListener which will make one lookup in its contextInitialized() method and set an attribute in the ServletContext with the DataSource object , which will be available through the whole context.
what do you think? is there anything impportant in this kind of design i didn't think about ?
18 years ago
i downloaded POI project from jakarta site.
everything works fine in stand alone applications -
the code compiles and runs .
when i try to use POI in a jsp page a get an error that
its package is not found by compiler.
where should i put the jars to make it available for tomcat?
thank you.
18 years ago