Antonio Foglia

Greenhorn
+ Follow
since Jun 30, 2013
Merit badge: grant badges
For More
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
5
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Antonio Foglia

prop.loadJposProperties() does



Yes, by "directly" i mean whe i call (1).
By "if i call a jar method" i mean call "prop.loadJposProperties()". Prop is a DefaultProperties object imported from an external jar. I've added alle xternal jar declarations to the jnlp file.
9 years ago
I'm developing an Applet that print a bar code using Jpos API. I need some jars and two configuration file. I've added jars to the classpath and configuration files in src directory. In Eclipse everything works fine.



Everything works fine in Eclispe but I can't find property files when i call the applet from a web page. So I've checked the JavaPos sources and I've paste the loadJposProperties() and xmlReg.load("wincor.jpos17.THxxx.xml") content in my source code:



The same method is used to found wincor.jpos17.THxxx.xml. So when I call applet form the browser I get INPUT STREAM FROM PROPERTIES OK!! from (1) and jpos/res/jpos.properties not found from (2).
So getClass().getClassLoader().getResourceAsStream works if i write it directly in my code, but doesn't work if i call a jar method.
I am really at a loss for what to try next in the debugging chain. Thanks
9 years ago
Hi everybody,
i've developed an Applet that manage some JavaPos devices. It works fine in eclipse but i get several errors when i try to deploy inside a wev page.
I've exported my applet into a jar including classpath and dependencies. Then i've added other jars dependencies in the .jnlp file under <resources>.
Now to refer an external folder in Eclipse its quite simple. But how can i do it outside of Eclipse? Should i add those external folders to .jnlp file?

Thank you
9 years ago

Paul Clapham wrote:You can't have your applet spy on keystrokes which are meant to be received by other applications running on the same computer.

However it seems to me that your actual requirements don't involve listening to the keyboard, but to events generated by some other hardware. Am I right? You didn't describe these devices, nor did you describe the events you want to listen to. If the events aren't keystrokes then your test which tries to work with keystrokes isn't very useful. So perhaps you could describe your requirements more clearly.



Ok i'll be clearer.
I've to implement some JavaPos code into my applet. In this first moment i am checking the requirements i need.
Thanks to javaPos i can run an application that listen to a card reader (as in my case). Still i haven't the necessary libraries to develop the application JavaPOS, so in this moment I want to better understand the functioning of the applet in a web page.
I need that my applet always listens for events, here's my solutions even if i don't know if are correct
-applet always on focus
-run a thread from the applet
-javascript check if the applet is alive
-javascript give the focusOn to the applet
-javascript listen to the applet

9 years ago
Here's my scenario: i have to develop an applet connected with some devices through JavaPos. There are some examples and i've done a couple of tests. Then i've to put this applet into a web page and always listen to events. I've made a simple keyListener Applet to real test interaction between the applet and an hardware. But when i go outside the applet interface it seems to not receive input from keyboard. I think it will be the same with JavaPos code. I want my applet to always listen for events! Is there a way to always running Applet code inside a web page? Is there a way to set a javascript function, inside of my web page, as a listener?

Thanks
9 years ago

Jayesh A Lalwani wrote:WHat's your end goal? DO you want to learn how to build a web application with Spring? You might want to go through the SPring tutorial if you haven't already

The reason why you don't see Hello world is this:- For SPring to load your bean and call it, something has to ask Spring to load the application context. Spring won;t do it just because you have it in class path. Someone has to call the correct API that tells Spring to load the XML file. Normally, in an SPring MVC application, you declare a DispatcherServlet in your web.xml. This is a servlet provided by Spring. WHen the DispatcherServlet initializes, it loads the Spring XML file.

Your problem will be fixed by including DIspatcherservlet in web.xml. However, you will be better off going through the SPring tutorial


thank you for your quick response
I had an EJB application that communicate with an android through MQTT protocol.
I've read about Spring, about IoC and about Spring Integration with MQTT. I foud it real interesting for several reasons(ioc, runnable as beans, integrations etc..)
So my real goal is to develop an application that receives, elaborate and store data received through Mqtt.
I also need a web interface too, like the one I had in the EJB application. I know i have to read a lot but i want to be sure if it is the correct way.
I will try with a web application in a first moment

Thanks
9 years ago
I'm new to Spring and i'm developing my first application. I want to run it on JBoss AS 7.1. First of all i've configured jboss to deploy spring application and it works fine.

18:10:50,940 INFO [org.jboss.snowdrop] (ServerService Thread Pool -- 28) Activating Spring Deployer subsystem

So i've created my first simple Spring Maven Project and i've write a simple bean



So i've tried to include the Spring Project into an ear and then deploy it. I got no error but in the console i can't see "HELLO WORLD". I'm sure that i'm missing something to work fine with Spring
Thanks
9 years ago

Jaikiran Pai wrote:Injection is only supported in container managed classes. Random classes like an implementation of Runnable do not have Java EE injection support. Plain JNDI lookup is your alternative to such cases.


Ok but it seems no good for my application. I need to explain better
here's another question with the general scenario

https://coderanch.com/t/631528/EJB-JEE/java/Mqtt-Client-JEE-application-JBoss#2891891
Hi everybody.
I've developed a test JEE application to send and receive messages through MQTT protocol(tcp connection). Under JBoss 7.1 i got a @Singleton @Startup that instantietes an Eclipse Paho Client and a Callback class.


I want to update received values to another bean. But in my Callback class i cannot inject any EJB (it breaks tcp connection) so i get the PahoClient instance in this way as you can see above:


So when i receive a message on my callback method i update values in this way public class SubscribeCallback implements MqttCallback{



It seems to work fine. But in console i see is MQTT thread that updates message, not the EJB. And i don't know if with a lot connection this works. Any Suggestion? I was thinking about to develop a JCA Adapter for my MQTT Client and my JEE application. But i don't kno w if it's the right way.

Thanks
Does exist a method for inject an ejb into a Runnable? First time i've tried to make my Runnable class "@Stateless" and then inject through "@EJB", then i've tried with the context lookup

public class Pusher implements Runnable{
public Pusher(){
}
@Override
public void run() {
InitialContext ctx;
try {
ctx = new InitialContext();
VehicleStatusLocal vehicleS = (VehicleStatusLocal) ctx.lookup("statusBean");
//launch ejb method
vehicleS.update();
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
i know that the right way is to inject a bean inside the EJB context. But i have to update some data from a non-EJB class.

Thanks

Steve Luke wrote:Yes, that is correct. I see no reason why you couldn't use it with JBoss, the Java client is rather simple, with no pre-reqs that are standard Java. A quick google brought up JBoss Fuse which appears to have an MQTT layer, but I am not exactly sure what Fuse actually is. But it does indicate they are compatible I think. I think you would be using a separate broker.


Thanks again.
But now 'm not sure if it's model it's good for my application, cause i want to choose which device to forward the mesage. I don't want to push the message to all subscribed devices.
However i'll read all the documentation.
And if it can be interesting i've found another framework that can be useful for this scenario: openmobster (Open source Mbaas), "This Provides a mobile platform-independent Cloud-initiated Push Notification System.( In Android, the push mechanism is based an a persistent socket connection)"
10 years ago

Steve Luke wrote:Another option is something like MQTT, a light weight messaging protocol (look at mosquitto.org for an implementation). It is another bit of infrastructure (a broker both the computer and mobile device talk to) but you install and run the broker yourself, so your data doesn't go through 'the cloud'. It also allows two way communication (computer posts a message requesting info, then starts listening on a topic to receive it, mobile listens for the request and posts info on another topic) and is cross-platform - there is a Java client (Eclipse Paho) which works well on Android, there are C (which works with iOS) and Python clients as well.



Thanks
I'm reading the specification, is a publish/subscribe model right? So if i got more than one device registered as subcriber they all receive the same message?
Is it compatible with JBOSS?
10 years ago
Thank you
yes, GCM seems more suitable and lightweight for my application
i can use GCM to notify the device that i need its position, and then i want to start the alarm manager to send periodically this information
10 years ago
Yes i have to work on a WLAN company. In a first moment i have to do some tests.
Working with GCM seems easier. I've read some complete guides.. my only question is if i really need to register my device to google.

Thank you! Any seggestion is welcome. I'm looking also for other communication method between a java component and android. The only problem is that the device needs to offer information periodically.. and rest service seemed to me a good solutions cause i wish to do polling on the device that expose data i nedd
10 years ago
I want to put a Rest Server on my Android device. Is it possible? I've checked other questions but i am a little bit confused. I wish to use Jersey framework to expose rest services for a client running on JBoss. Can anyone show me some documentatios or some good tutorial? I don't want the code but i'm new in android and i don't know where to start and which http server to use. Thank you
10 years ago