Stephen Hanley

Greenhorn
+ Follow
since Apr 17, 2005
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 Stephen Hanley

I'm using the following code to output a string as a JSP to be read into my J2ME midlet.



It throws an exception due to the output stream having already be called. This isn't really a problem but it is messy.

Also when I test this in firefox the string comes up with four little boxes in front of it. I cannot read the String into my midlet either. it calls the url alright but can't read the reply.
The JSP imports HttpServletRequest/Response.

Is this the same thing?

It creates the EJB etc. I just can't decipher the response due the weird stuff at start of stream.

I can read the string from the diagnostics of the Nokia Series 40 Developer SDK.
16 years ago
I'm using the following code to output a string as a JSP to be read into my J2ME midlet.


It throws an exception due to the output stream having already be called. This isn't really a problem but it is messy.

Also when I test this in firefox the string comes up with four little boxes in front of it. I cannot read the String into my midlet either. it calls the url alright but can't read the reply.
16 years ago
Many thanks.

That solution may well have saved my final year project demo next week.
16 years ago
Any idea why this is not working? It works from netbeans.

C:\NetBeansProjects\JamboIn\dist>java -jar -cp .:C:\j2ee\environment\j2sdk1.4.2_
05\jre\lib\comm.jar JamboIn.jar
To start listening for new messages type letter G:
g
Exception in thread "main" java.lang.NoClassDefFoundError: javax/comm/CommPortId
entifier
at sms.SMSAgent.open(SMSAgent.java:48)
at sms.SMSAgent.<init>(SMSAgent.java:34)
at sms.Main.<init>(Main.java:32)
at sms.Main.main(Main.java:52)
16 years ago
Hi,

I'm in the middle of writing documentation for my thesis project. I'm writing a paragraph about why I chose JBoss. Obviously because it's free but is JBoss still the only open source application server?

Thanks,

Steve.
Jeanne,

Thanks again for your help.

I was just discussing this with a colleague on the phone.

I am new to J2EE, RMI-IIOP, JNDI and the rest.

Do you mean I have to have the files in the folder 'ejbsrc' available to my console app?

Do I have to import my EJB Module (.jar) into the consoles class path or is that overkill?

(Or am I just out of my depth? :eek

Kind regards,

Stephen Hanley.
Jeanne,

Thanks for your reply.

That's the approach I had thought I would be able to take. It's obviously not as easy as it seems. The following is a snippet of the code i was trying:


ie.spraoi.jambo.stateful.MessageManagerHome.JNDI_NAME is my MessageManagerBean stateful session bean's home interface. Eclipse is underlining red and saying it cannot resolve it?
I it possible to remotely call a bean method from a J2SE console App?

The two are running on the same server.
I had this problem already this month with a web application. Closest I've come to crying in many many years.

I am attempting to import the javax.comm package so that I can access a Nokia mobile phone over the parallel port.

I have followed all of the installation instructions.

I have two SDKs and JREs. One is in my J2EE environment and the other is used by NetBeans and is contained in my program files folder. For each of the SDK and JRE folders I did the following:
1)put DLL in bin folder
2)put JAR in lib folder
3)put javax.comm.properties file in the lib folder

Is there something I missing here? the package is not available in NetBeans.
16 years ago
To be more specific:

I have a String which I wish to include as part of a URL I am calling.

This string is being passed as one of the parameters of a GET call.

The String contains spaces, the String needs to be encoded so that the spaces do not cause a problem.
16 years ago
Is there a way to encode a url in J2ME using the standard packages?

Would it be difficult to write my own class to do this?
16 years ago
Nearly two weeks this has been wrecking the proverbial head.

Finally working perfectly. Thanks all at Javaranch for your help.
Anyone feeling generous and like to read the below?

It's throwing a "java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException" error?

/**
* @ejb.interface-method
* view-type="remote"
*
*/
public String sendMessage(String sender, String recipient, String text){
HttpClient client = new HttpClient();
String url = "http://myapi.com/http/sendmsg";
String username = "aaa";
String password = "bbb";
String api_id = "ccc";
String status = "";
String responseBody = "";
PostMethod method = new PostMethod(url);
NameValuePair[] data = {
new NameValuePair("user",username),
new NameValuePair("password",password),
new NameValuePair("api_id",api_id),
new NameValuePair("from",sender),
new NameValuePair("to",recipient),
new NameValuePair("text",text)
};

method.addParameters(data);

DefaultMethodRetryHandler retryhandler = new DefaultMethodRetryHandler();
retryhandler.setRequestSentRetryEnabled(false);
retryhandler.setRetryCount(3);
method.setMethodRetryHandler(retryhandler);

try {
// Execute the method.
int statusCode = client.executeMethod(method);
if (statusCode != HttpStatus.SC_OK) {
System.err.println("Method failed: " + method.getStatusLine());
}

// Read the response body.
responseBody = method.getResponseBodyAsString();

// Deal with the response.
// Use caution: ensure correct character encoding and is not binary data
//status = new String(responseBody);

} catch (IOException e) {
System.err.println("Failed to download file.");
e.printStackTrace();
} finally {
// Release the connection.
method.releaseConnection();
}
return responseBody;
}