Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

Aleksandar Babic

Ranch Hand
+ Follow
since May 30, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Aleksandar Babic

I resolve it by using EJB2.1.
I tried everything that comes to my mind including @RemoteHome annotation, without success.
But you can have separate 2.1 and 3.0 modules in same ear. Use 2.1 only for task class that need to implement home interface, and write rest of the code in 3.0

If I recall correctly, if you use scheduler to send JMS message you won't need EJB 2.1 module.
6 years ago
Thank you for a very useful answer.

I wish you all the best in your future work, and many great books.
//Aleksandar
7 years ago
@Marko Gargenta

Still haven't tried to do it with AlarmService, but I've found some snippet that is using Handler to initiate scheduled task.
I had problem to update map when using Timer because it's not allowing to access UI from non UI thread (ERROR: Can't create handler inside thread that has not called Looper.prepare()).
Now I've created something like this in onCreate

In location listener I call removeUpdates inside onLocationChanged to stop GPS updating after retrieving location.
Now it's requesting location every 20sec (and move the marker across the map)

Is this approach good, or it has some hidden issues?

ps. Your book will certainly come to rescue
7 years ago
I never thought of using alarm service for that.
Thanks.
7 years ago
I'm developing application that should update users current location on few minute interval.
Existing built-in timeInterval option on LocationManager.requestLocationUpdates method is not reliable.
I found few solutions that solve the problem by using timer and manual control of requestLocationUpdates interval.
Is there some other solution or using timer is the best option?
7 years ago
It seems that scheduler in WAS7 is not upgraded to work with EJB3.0
After creating BeanTaskInfo we need to call method taskInfo.setTaskHandler that receives TaskHandlerHome as param.
Since EJB3.0 is missing home interface method is throwing ClassCastException.
With EJB2.1 everything is ok.

Is there a way to use EJB3.0 stateless bean with WAS7 Scheduler BeanTaskInfo?
7 years ago

Yes, you can replace it with String object ( it's string ether way )

If you managed to get response in j2me, than only thing you need to do is to read input stream into String(or StringBuffer) and show it in textbox.
If you don't know how to do that you can do it like this

Haven't tried this one but it might work
8 years ago
(@ Anshal Patel)
I haven't quite understand your problem.
Have you succeed to transfer string to mobile phone or not?

To print on mobile phone you can create textbox and set string as it's value.
out.println can be used for debug purpose but should be removed in production.

You can create something like this:
Create textbox where user will input student name.
After submitting open http connection and send request with name as parameter to webservice (or simple page, whatever)
On server side pick student name, do the sql query on db and send roll_no in response.
On mobile retrieve response and print it into textbox.

Simple example of textbox
http://www.devx.com/tips/Tip/20098
8 years ago
Knowledge of Java/J2EE is essential since those are java frameworks. You don't need j2me.
Best way to learn is to practice so grab some examples and start. The longer you think the more time you lose ;)
8 years ago
You need to learn them separately first and it doesn't matter in which order.
After that I suggest that you try to create some test app that will include both frameworks.
There are lot of examples on the net like this one
http://www.vaannila.com/spring/spring-hibernate-integration-1.html
8 years ago
ahhh
OK

I haven't look at the code much (and don't need to), but first thing you should do is to think it out. What do you need to create app for?
Currently you have crated app for non existing website so it actually don't do anything.
I can suggest that you find some working service over the net, or create your own, and than make appropriate application for it.
Since it's client-server relationship, you first need to find/create server and than client. Now you have client without server.

Maybe you could also create some test app that will support your current app but that depends on your skill
You should decide what will need less work. Crate server or to re-factor app.
8 years ago
Well, how do you mean to connect to server if it doesnt' work

this

must be a valid address that works. If you have some local application on 8080 port with loginServlet mapping, than make it work.
Error you are receiving is probably produces by unreachable server. Application tries to connect but it doesn't have valid working address.

You could try using .netbeans with integrated wtk (or better newest version with integrated Java ME SDK 3.0.)
Than you can use debugger (and try/catch blocks or some logger) to find exact spot where error occurred.

To connect over lan you also need to have working server on one machine
and from application point to that machine with it's IP address. Port would be needed too.
(you need to have static ip addresses on both machines)
8 years ago
I guess you are using emulator
1.Check firewall (disable it).
2. Does the link work at all. I guess you are using localhost (127.0.0.1) as an conn_url, so check it out from browser.



8 years ago
While waiting you could do a search on this forum
but here's recommendation

http://www.coderanch.com/t/467217/Java-Micro-Edition/Mobile/some-help
on this topic look for the last post
book name is
Kicking Butt with MIDP and MSA: Creating Great Mobile Applications
8 years ago