Midlet-Servlet interaction
Hi there,
Could someone please help with a problem I am having when running a MIDlet on the POSE Emulator.I am trying to run a Midlet which calls a servlet to find the number of hits .I do not have any compilation errors.I am using J2me ToolKit 1.0.4.When I run the Midlet on the Emulator, I am able to reach only upto the point where I can select the program on the POSE Emulator.On selecting the application, I get an error : Uncaught Exception-java.lang.IllegalArgumentException.Please give some suggestions as to the cause of this error.I have been trying the J2me Tutorial Part II-Midlet Servlet Interaction(Sun).
Thanks in advance
Hi,
this exception means that you are trying to pass some variable data to a method and the data is not compatible with those in methods signature, e.g.
somemethod(java.util.Properties) and you call the method with somemethod(myData) where my data is corrupt or not a descendant of the HashTable or Properties object. If you post the code I will be able to help you better.
Regs jP
Similar Messages
-
Hi,
I tried almost all the midlets servlet connection examples on various tutorial sites including sun's, they all run perfectly fine on J2ME wireless toolkit emulator but when I download them on Seimens SL45i with WAP connection , J2ME compliant and on O2 XDA pda with GPRS and CrEme virtual java machine and me4se library for MIDlet support its not working. If I connect PDA with PC using MS active sync, the MIDLet is able to connect with servlet or normal web page and retrive data from that perfectly, but when I remove the pda from docking station and run MIDlet, its not able to connect with servlet. Is there something more you have to do to access GPRS or WAP feauture of PDA/mobile phone.
I am using normal HttpConnection to connect with the servlet.
Thanks in advance
DhirajI'm playing with some sockets.
can you please help me?!
J2ME uses only HTTP connections?
and what are the sockets? what is the difference between CLDC socket and J2SE Socket?
is there any other way to communicate with a Servlet?
and very important..
is there a difference if it's using GPRS or 3G?
would the http connection work for all? and just the connection speed would change?
help me!! -
Midlet & Servlet(Tomcat) Connection
I have built up a midlet that need to connect to the servlet which is hosted using Tomcat ...
When i click the submit button in the mobile emulator ... i received the following message in the console of Java Wireless ToolKit .... What is the problem actually ? .... Can anyone give me some guides ?
Any Helps will be appreciated
"<html><head><title>Apache Tomcat/5.0.12 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - Servlet RequestServlet is not available</h1><HR size="1" noshade><p><b>type</b> Status report</p><p><b>message</b> <u>Servlet RequestServlet is not available</u></p><p><b>description</b> <u>The requested resource (Servlet RequestServlet is not available) is not available.</u></p><HR size="1" noshade><h3>Apache Tomcat/5.0.12</h3></body></html>"
The following is my midlet :
public class SecondMidletServlet extends MIDlet implements CommandListener, Runnable {
Display display = null;
List menu = null;
TextBox input = null;
String user = null;
String url = "http://pup.no-ip.net:8001/Servlet/RequestServlet";
static final Command backCommand = new Command("Back", Command.BACK, 0);
static final Command submitCommand = new Command("Submit", Command.OK, 2);
static final Command exitCommand = new Command("Exit", Command.STOP, 3);
StringBuffer b = new StringBuffer();
String currentMenu = null;
Thread thread;
public SecondMidletServlet() {
public void startApp() throws MIDletStateChangeException {
display = Display.getDisplay(this);
menu = new List("Invoke Servlet", Choice.IMPLICIT);
menu.append("Add a user", null);
menu.addCommand(exitCommand);
menu.setCommandListener(this);
mainMenu();
public void pauseApp() {
public void destroyApp(boolean unconditional) {
notifyDestroyed();
void mainMenu() {
display.setCurrent(menu);
public void addName() {
input = new TextBox("Enter first name:", "", 5, TextField.ANY);
input.addCommand(submitCommand);
input.addCommand(backCommand);
input.setCommandListener(this);
input.setString("");
display.setCurrent(input);
void invokeServlet(String url) throws IOException {
HttpConnection c = null;
InputStream is = null;
OutputStream os = null;
//StringBuffer b = new StringBuffer();
TextBox t = null;
try {
c = (HttpConnection)Connector.open(url);
if(c == null)
System.out.println("PKPK");
else
System.out.println("PSPS");
c.setRequestMethod(HttpConnection.POST);
c.setRequestProperty("IF-Modified-Since", "20 Jan 2001 16:19:14 GMT");
c.setRequestProperty("User-Agent","Profile/MIDP-1.0 Configuration/CLDC-1.0");
c.setRequestProperty("Content-Language", "en-CA");
os = c.openOutputStream();
String str = "name="+user;
byte postmsg[] = str.getBytes();
System.out.println("Length: "+str.getBytes());
for(int i=0;i<postmsg.length;i++) {
os.write(postmsg);
// or you can easily do:
// os.write(("name="+user).getBytes());
os.flush();
is = c.openDataInputStream();
int ch;
while ((ch = is.read()) != -1) {
b.append((char) ch);
System.out.print((char)ch);
} finally {
if(is!= null) {
is.close();
if(os != null) {
os.close();
if(c != null) {
c.close();
//display.setCurrent(t);
public void run()
try
invokeServlet(url);
TextBox t = new TextBox("Second Servlet", b.toString(), 1024, 0);
t.addCommand(backCommand);
t.setCommandListener(this);
display.setCurrent(t);
catch(Exception ex){}
public void refreshScreen(StringBuffer b)
TextBox t = new TextBox("Second Servlet", b.toString(), 1024, 0);
t.addCommand(backCommand);
t.setCommandListener(this);
display.setCurrent(t);
public void commandAction(Command c, Displayable d)
String label = c.getLabel();
if (label.equals("Exit")) {
destroyApp(true);
else if (label.equals("Back")) {
mainMenu();
else if (label.equals("Submit"))
user = input.getString();
// try {
//invokeServlet(url);
thread = new Thread(this);
thread.start();
// catch(IOException e) {}
else {
addName();
//Servlet side
public class RequestServlet extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
BufferedReader br = request.getReader();
String buf = br.readLine();
System.out.println("LSLS");
out.print("Rec: "+buf);Hi,
Since you use POST Method for the request, you have to implement the doPost(...) Method in the servlet, right? Do a simple implementation of the doGet(...) Method and call the Servlet using a browser. So you can easily check, whether the Servlet is available or not. You got the Error 404 which means, that the Servlet cant be found on the Tomcat. Make sure, that it is deployed correctly and your URL in the MIDlet is also correct.
hth
Kay -
Hello All,
I have a question if some one can kindly give his/her expert opinion.
1) Can we call a Servlet from a JSF Page the same way as calling it from an HTML or JSP Page?
2) If the answer to the above question is "Yes", how can a JSF page get the data from the response generated by a Servlet (In a JSP page, we can get the data from the Session object ).
Waiting for a favorable reply.
Kind Regards.
Hasnain Javed Khan.As far as I know JSF are servlets the same way JSP are, so it would work the same way. They bothe extend javax.servlet.Servlet, thus all the mothods belonging to the Sevlet class would be available to the etending classes in this case your JSF pages.
http://java.sun.com/javaee/javaserverfaces/1.2_MR1/docs/api/index.html
MeTitus -
Midlet gets null values from servlet
hey,
based on one of the source code examples on the java.sun.com website i made a midlet/servlet application. the midlet is sending a product id to the servlet, the servlet queries the database and shows the productinformation, the midlet reads the servlet output and displays it on his midlet form
when i invoke the servlet in my browser: http://localhost:8080/Magazijn/query?product=1 then everything works fine (i see: Product Name : Deur). when the midlet is invoking the servlet i see Product Name : null
after hours of searching the only thing i could come up with is that the servlet isn't passing the string retrieved from the resultset to the midlet
the strange thing is that when i papss a normal string, for instance:
String test = "test";
out.println(test);
that he shows this correct both in my browser and midlet
when i do this:
prodName = resutl.getString("name");
out.println(prodName);
i see "Deur" in my browser, but i see "null" in my midlet
anyone can help me?
here's the servlet source:
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.Date;
public class Magazijn extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
doPost(request,response);
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
String url="jdbc:mysql://localhost/test?user=root&password=root";
Connection con = null;
Statement stmt;
ResultSet rs;
String query;
int prodId;
String prodNaam;
String prodPlaats;
String prodAantal;
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
BufferedReader br = request.getReader();
String buf = br.readLine();
try {
//laden van de mysql driver
Class.forName("com.mysql.jdbc.Driver");
//maken van connectie met database
con = DriverManager.getConnection (url, "root", "root");
//aanmaken van statement object
stmt = con.createStatement();
//nakijken welke naam we zoeken van product
String prod = request.getParameter("product");
//uitvoeren van query en die opvangen in een resultset
query = "SELECT * from onderdelen where id="+prod;
ResultSet result = stmt.executeQuery(query);
result.next();
prodId = result.getInt("id");
prodNaam = result.getString("naam");
prodPlaats = result.getString("plaats");
prodAantal = result.getString("aantal");
out.println(new Date());
out.println("");
out.println("Product ID: "+prodId);
out.println("Productnaam: "+prodNaam);
out.println("Plaats: "+prodPlaats);
out.println("Aantal: "+prodAantal);
catch(ClassNotFoundException e) {
out.println("Could not load database driver: " + e.getMessage());
catch(SQLException e) {
out.println("SQLException caught: " + e.getMessage());
finally {
//sluiten database connectie
try {
if (con != null) con.close();
catch (SQLException e) {}
here's the midlet source:
import javax.microedition.rms.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.microedition.io.*;
import java.io.*;
import java.util.Vector;
public class MagazijnMidlet extends MIDlet implements CommandListener {
Display display = null;
List menu = null;
TextBox input = null;
String prodid = null;
String url = "http://localhost:8080/Magazijn/query";
static final Command backCommand = new Command("Terug", Command.BACK, 0);
static final Command submitCommand = new Command("Verstuur", Command.OK, 2);
static final Command exitCommand = new Command("Afsluiten", Command.STOP, 3);
String currentMenu = null;
public MagazijnMidlet() { }
public void startApp() throws MIDletStateChangeException {
display = Display.getDisplay(this);
menu = new List("Maak uw keuze", Choice.IMPLICIT);
menu.append("Opvragen product gegevens", null);
menu.addCommand(exitCommand);
menu.setCommandListener(this);
mainMenu();
public void pauseApp() { }
public void destroyApp(boolean unconditional) {
notifyDestroyed();
void mainMenu() {
display.setCurrent(menu);
//Vraag om productnummer op te geven
public void askProdid() {
input = new TextBox("Geef Productnummer:","", 5, TextField.ANY);
input.addCommand(submitCommand);
input.addCommand(backCommand);
input.setCommandListener(this);
input.setString("");
display.setCurrent(input);
//Maken connectie midlet + verwerking
void invokeServlet(String url) throws IOException {
HttpConnection c = null;
InputStream is = null;
OutputStream os = null;
StringBuffer b = new StringBuffer();
TextBox t = null;
try {
c = (HttpConnection)Connector.open(url);
c.setRequestMethod(HttpConnection.POST);
c.setRequestProperty("IF-Modified-Since",
"20 Jan 2001 16:19:14 GMT");
c.setRequestProperty("User-Agent",
"Profile/MIDP-1.0 Configuration/CLDC-1.0");
c.setRequestProperty("Content-Language", "en-CA");
// send request to the servlet.
os = c.openOutputStream();
String str = "product="+prodid;
byte postmsg[] = str.getBytes();
System.out.println("Length: "+str.getBytes());
for(int i=0;i<postmsg.length;i++) {
os.write(postmsg);
// or you can easily do:
//os.write(("product="+prodid).getBytes());
os.flush();
// receive response and display it in a textbox.
is = c.openInputStream();
int ch;
while((ch = is.read()) != -1) {
b.append((char) ch);
System.out.print((char)ch);
Form formProdGeg = new Form ("Gegevens product");
StringItem infoItem = new StringItem("",b.toString());
formProdGeg.append (infoItem);
formProdGeg.addCommand (backCommand);
formProdGeg.setCommandListener (this);
display.setCurrent (formProdGeg);
} finally {
if(is!= null) {
is.close();
if(os != null) {
os.close();
if(c != null) {
c.close();
display.setCurrent(t);
// event handler
public void commandAction(Command c, Displayable d) {
String label = c.getLabel();
if(label.equals("Afsluiten")) {
destroyApp(true);
} else if (label.equals("Terug")) {
mainMenu();
} else if (label.equals("Verstuur")) {
prodid = input.getString();
try {
invokeServlet(url);
}catch(IOException e) {}
} else {
askProdid();
tia
leeHi,
first for some efficeincy, in your place your connection to the database in the init() method so you can have on instance of the connection.
in your midlet place the ui initialization in its constructor
ok, Why dont you try the query in the url
i.e http://localhost:8080/Magazijn/query=";
then as you input the product id without setting requests
c = (HttpConnection)Connector.open(url+productid);
i think it will work properly
tell me what happens with you -
Some J2ME midlets doubts!! help needed urgently!!!
Hi,
I am currently working in a company where it does wireless technology like WAP and I am assigned a task of creating a screensaver midlet. I have some doubts on the midlets.
1) How do i use a midlet suites? From what I heard from my colleagues & friends, a servlet is needed for midlets to interact with one another. is it true?
2) How do I get the startin midlet to take note the phone is idling so that the screen saver midlet can be called?
Help needed urgently... if there is any source codes for me to refer to would be better... Thanks...
Leonardindicates that MIDlet suites are isolated (on purpose) from each other, so you can't write over another one's address space.
Also, I believe (at least on cell phones) that you have to specifically enter the Java Apps mode; unless you do the app won't execute. If you are in Java apps mode and a call comes in, the cell's OS puts the Java app currently executing on "Pause" mode and switches back to phone mode.
Not sure if you will be able to have a Java app do that automatically.
BTW why do you need a screensaver on an LCD display? Is it really intended to show an advertisement?
Download and real all the docs you can from Sun, once you get over the generic Java deficiencies MIDlet's aren't that hard. -
Applet Servlet communication compiles but does not communicate
Hi,
I have a applet which has a button named A. By clicking the button, the applet passes the letter A to the servlet. The servlet in turn accesses an Oracle database and retrieves the name corresponding to letter A from a table (name is Andy in the present case). The servlet interacts with the databse via a simple stored procedure and uses its output parameter to display the name Andy back in the applet.
Both the applet and servlet codes have compiled fine(servlet code compiled with -classpath option to servlet jar using a TOMCAT). However, on clicking button A in the applet, I do not get the name Andy.
Any help/suggestion in resolution of this is highly appreciated. Thanks in advance.
HTML CODE:
<html>
<center>
<applet code = "NameApplet.class" width = "600" height = "400">
</applet>
</center>
</html>
STORED PROCEDURE CODE:
procedure get_letter_description(
ac_letter IN CHAR,
as_letter_description OUT VARCHAR2) IS
BEGIN
SELECT letter_description INTO as_letter_description FROM letter WHERE letter =
ac_letter;
EXCEPTION
WHEN no_data_found THEN as_letter_description := 'No description available';
END get_letter_description;
APPLET CODE:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.util.*;
import java.io.*;
import java.net.*;
public class NameApplet extends Applet implements ActionListener
private TextField text;
private Button button1;
private String webServerStr = null;
private String hostName = "localhost";
private int port = 8080;
private String servletPath = "/examples/servlet/NameServlet?letter=";
private String letter;
public void init()
button1 = new Button("A");
button1.addActionListener(this);
add(button1);
text = new TextField(20);
add(text);
// get the host name and port of the applet's web server
URL hostURL = getCodeBase();
hostName = hostURL.getHost();
port = hostURL.getPort();
webServerStr = "http://" + hostName + ":" + port + servletPath;
public void actionPerformed(ActionEvent e)
if (e.getSource() == button1)
letter = "" + 'A';
private String getName(String letter){
String name = "" ;
try {
URL u = new URL(webServerStr + letter);
Object content = u.getContent();
name = content.toString();
} catch (Exception e) {
System.err.println("Error in getting name");
return name;
SERVLET CODE:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.sql.*;
import java.util.Properties;
public class NameAppletServlet extends HttpServlet {
private static Connection conn = null;
private static final char DEFAULT_CHAR = 'A';
private static final char MIN_CHAR = 'A';
private static final char MAX_CHAR = 'G';
private static final String PROCEDURE_CALL
= "{call get_letter_description(?, ?)}";
protected void doGet( HttpServletRequest request,
HttpServletResponse response )
throws ServletException, IOException
handleHttpRequest(request, response);
protected void doPost( HttpServletRequest request,
HttpServletResponse response )
throws ServletException, IOException
handleHttpRequest(request, response);
protected void handleHttpRequest( HttpServletRequest request,
HttpServletResponse response )
throws ServletException, IOException
String phrase = null;
char letter = getLetter(request, DEFAULT_CHAR);
if (letter >= MIN_CHAR && letter <= MAX_CHAR) {
try {
name = getName(conn, letter);
} catch (SQLException se) {
String msg = "Unable to retrieve name from database.";
name = msg;
} else {
String msg = "Invalid letter '" + letter + "' requested.";
//throw new ServletException(msg);
phrase = msg;
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
out.println(name);
private String getName(Connection conn, char letter)
throws SQLException
CallableStatement cstmt = conn.prepareCall(PROCEDURE_CALL);
cstmt.setString(1, String.valueOf(letter));
cstmt.registerOutParameter(2, Types.VARCHAR);
cstmt.execute();
String name = cstmt.getString(2);
cstmt.close();
return name;
private char getLetter(HttpServletRequest request, char defaultLetter) {
char letter = defaultLetter;
String letterString = request.getParameter("letter");
if (letterString!=null) {
letter = letterString.charAt(0);
return letter;
public void init(ServletConfig conf) throws ServletException {
super.init(conf);
String dbPropertyFile = getInitParameter("db.property.file");
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection(
"jdbc:oracle:thin:myserver:1521:CDD",
"scott",
"tiger");
} catch (IOException ioe) {
throw new ServletException(
"Unable to init ReinforcementServlet: " + ioe.toString());
} catch (ClassNotFoundException cnfe) {
throw new ServletException(
"Unable to init ReinforcementServlet. Could not find driver: "
+ cnfe.toString());
} catch (SQLException se) {
throw new ServletException(
"Unable to init ReinforcementServlet. Error establishing"
+ " database connection: " + se.toString());
}Hi,
I am not able to understand by which method you are doing Applet-Servlet commuincation.
If you want to use Object Serialization method, plz.get the details from following URL.
http://www.j-nine.com/pubs/applet2servlet/
Ajay -
I have a business delegate that delegates to a servlet from outside the
servlet container. For the actual servlet interaction, I'm using basically
URLConnection connection = ,,,
connection.openConnection()
readResponse
and then appropriate connection closing facilities.
This seems to work fine on some version of the Sun JVM (e.g. 1.3.1), but not
on others (e.g. 1.3.1x and 1.4).
This question is more about a specific pattern implementation (involving
servlets) than the pattern itself.
Thanks in advance.
-- Jay
"Jay" == Jay Baker <[email protected]> writes:
Jay> I have a business delegate that delegates to a servlet from outside the
Jay> servlet container. For the actual servlet interaction, I'm using basically
Jay> ...
Jay> URLConnection connection = ,,,
Jay> connection.openConnection()
Jay> readResponse
Jay> and then appropriate connection closing facilities.
Jay> This seems to work fine on some version of the Sun JVM (e.g. 1.3.1), but not
Jay> on others (e.g. 1.3.1x and 1.4).
Jay> This question is more about a specific pattern implementation (involving
Jay> servlets) than the pattern itself.
How can anyone help you if you don't give any indication of what the symptom
is?
===================================================================
David M. Karr ; Java/J2EE/XML/Unix/C++
[email protected] ; SCJP; SCWCD
-
Database Design/Application architecture question
I'm working on a Java web app that includes creating a database from scratch. The UI needs to model a mostly static set of choices that led to other choices that lead to other choices..... I'm trying to figure out how to model this in a table or set of tables and how to design the UI and servlet interaction. Here's an example, in Petstore lingo:
Do you need a dog house?
For a small dog?
Red?
Blue?
How many?
For a big dog?
Brown?
Yellow?
How many?
Side windows?
Do you need a bird cage?
How many water dispensers?
For big bird?
This sort of multiple dependent options seems hard to model in a database. I'm trying to do this at the database level so that I can have a dynamic front end, in which I get the collection of options and then use JSTL to populate the UI with the chocies for whatever level or step I'm at. Any suggestions? I haven't had to solve a design problem precisely like this where some choices may have dependent choices, but others do not, and some have dependent choices which have very specific dependent choices that have very specific dependent choices. Thanks.
KenI'm working on a Java web app that includes creating
a database from scratch. You mean the UI drives creating the database?
Why?
That is often driven by developer rather than business requirements and is often a bad idea. It is often done solely so the developer doesn't have to type as much. And not typing very much is solved by code generation while using meta data solutions for it is usually a bad maintainance idea.
But if you need to then you create meta data.
Table TheValues
- Field: Value Id.
- Field: Value Name
- Field: Value Value
Table: Collection
- Field: Collection Id
- Field: Collection Name
Table: Link table
- Field: Collection Id
- Field: Id type
- Field: Id (Collection or Value)
Display values can be kept in another table or used directly.
Notice that a collection can contain another connection.
You can combine the first two tables as well. -
i am wondering whats the "correct" or best way to connect to a DB using JavaBeans and using this in JSP pages?
i read abt creating a SQL "Helper" class that has some functions like connect etc... but i am thinking its a bit confusing...
if i have a function
public static Statement Connect() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:auction","","");
stmt = con.createStatement();
} catch (SQLException e) {
System.out.println("ERROR: SQLException occured!\n" + e.getMessage());
} catch (Exception e) {
System.out.println("ERROR: An Exception occured!\n" + e.getMessage());
return stmt;
}then i use it
Statement stmt = SqlHelper.connect();when i want to close the connection how do i do it? is it a must to close connections anyway?
or shld i do it the easy way, having the code
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:auction","","");
stmt = con.createStatement();on all JSP pages?
Thank youBalusC wrote:Do it in the data layer. Write DAO classes and SQL helper classes. Then let the business layer, the Servlet, interact with the data layer and let the presentation layer, the JSP, display the results.
And don't return a Statement, but a Connection. And yes, closing a Connection is a must, otherwise you're leaking resources which will cause your web application to crash due to a memory shortage.ya thats what i am trying to do... but how do i? like this? except i return a connection instead? and also, i shld return it by reference? mmm... in java isit like return &con?
package AuctionSystem;
import java.sql.*;
public class SqlHelper {
private static Connection con;
private static Statement stmt;
public SqlHelper() {
Connection con = null;
Statement stmt = null;
public static void Connect() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:auction","","");
stmt = con.createStatement();
} catch (SQLException e) {
System.out.println("ERROR: SQLException occured!\n" + e.getMessage());
} catch (Exception e) {
System.out.println("ERROR: An Exception occured!\n" + e.getMessage());
public static Connection getCon() {
return con;
public static Statement getStmt() {
return stmt;
public static void Close() {
con.close();
stmt.close();
public static String FormatString(String string) {
return "'" + string + "'";
}Edited by: iceangel89 on May 27, 2008 3:50 AM -
Hi folks
I am trying to configure netbeans with orion server. But, always the netbeans tries to access the tomcat server. I want to disable tomcat forever.
Do anyone know how ?
Thanks
PayalI don't understand your problem. I use orion with netbeans and it is excelent. You will have to write a little script to start the server for debugging:
cd /opt/orion
JAVA_HOME=/opt/jdk1.3.1
JAVA_PATH=/opt/jdk1.3.1
$JAVA_HOME/bin/java -classic -Xdebug -Xnoagent -Djava.compiler=NONE \
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5000 \
-Xbootclasspath/a:$JAVA_HOME/lib/tools.jar \
-jar orion.jar
Now you can attach to the server on port 5000 and debug away! If you have jsp's to debug configure the orion server to be in "development" mode (server.xml) and then mount the directory containing the jsp classes and .java files. You can then debug your jsp's and servlets interactively.
wcn -
Hi folks,
I am new to JWS.
Can JWS be launched from a hyperlink and import the
resources assoicated with the link immediately after
launching?
In other words, can JWS application be used in the
same way a MP3 player is used?
(Should a servlet be used? How can a servlet interact
with a JWS application?)
Thanks.Can JWS be launched from a hyperlink and import the
resources assoicated with the link immediately after
launching?If you click on a link that maps to a mp3 file your browser knows to start up your default mp3 player and plays that mp3 content through it.
This is because mp3 content will be served by most web servers with a mp3 MIME type and the browser knows that mp3 MIME typed content has to be played be the registered mp3 player.
With jnlp/jws it is the same, the link points to a jnlp file, which is MIME typed as jnlp content. The browser knows that jnlp content needs to get "played" via the JWS application (javaws.exe). And thus your JWS program starts up, shortly after you clicked the jnlp link.
(Should a servlet be used? How can a servlet interact
with a JWS application?Somes uses for servlets in the context of JWS are
- servlets for serving versioned jars
- servlets for serving difference jars (for shorter download times)
- servlets to generate custom jnlp descriptors on the fly
But you can live happily without servlets.
Regards,
Marc -
Sun Webproxy 4.0 POST redirect issue
Hi there,
I am currently evaluating the Sun Webproxy 4.0 server and am using it to be the front end proxy for my Weblogic 9.2 application server. The issue that I am running into is that one of my developers have written a HttpTestServlet that does a simple POST.
I have configured my server to do both Regular re-direct and Reverse-proxy re-direct. When I request the Proxy server address that is pointed to the actual servlet I see the proxy doing a POST but I get a HTTP 1.1/302 not found error. When I go directly to the Servlet the POST string works just fine and I get the desired results. Any help will be appreciated. I have tried numerous config types to get this going but nothing seems to help. ThanksHi, the error code was 302, our developer has fixed the midlet/servlet on the weblogic server. The servlet was missing a "/" at the end of their URL that the midlet was coded with. Once they added the "/" at both the midlet JAD file and the servlet on the server it worked beautifully. Thx
-
How would you access resources, such as media (mp3) stored on the device (flash card), list available such resources, download and save (rather than to the record store) etc.?
A little summery for future ref:
Intro
"The FileConnection API [JSR-075] gives access to file systems and support for file-oriented operations. The API assumes the existence of a file system in the device that can be located, for example, in removable memory cards, flash memory, or other types of persistent storage. This API is not meant to be a replacement for the Record Management System (RMS) but rather a complement to it allowing MIDlets to interact with native applications. For example, a MIDlet could access and manipulate images previously captured by a native application using a built-in digital camera. Those images are commonly stored in the device�s memory and with the FileConnection API they are made accessible to CLDC/CDC1 applications."
"The API is very simple containing just one class, two interfaces, and two exceptions. The most important part is the FileConnection interface, which extends the Connection interface and gives access to directories and individual files. Implementations of FileConnection are created using the Connector.open() method. The argument of the open() method is a URL with the format file://<host>/<path>, as defined in RFC 1738 [RFC 1738] and RFC 2396 [RFC 2396], where host is normally left empty and path starts with the root of the file system down to a particular file or directory. An example of a typical file URL in a Symbian device looks like the following: file:///C:/Nokia/Images/Image(001).jpg The roots of the file system are device-specific and they don�t necessarily correspond to physical memory units since they are logically defined by the device�s operating system."
"Since the FileConnection API is an optional extension, a system property has been added to indicate the API�s presence. The microedition.io.file.FileConnection.version system property contains the implemented version of the API. Currently this property should have the value 1.0 to indicate the current status of the API or null if the API is not present."
supporting environments:
IBM's J9, PalmOS 5, Windows Mobile 2003.
Some mobile phones supporting FileConnection are listed here: http://www.benhui.net/modules.php?name=Midp2Phones
Links:
http://www-128.ibm.com/developerworks/library/j-pda-op/
http://jcp.org/aboutJava/communityprocess/final/jsr075/index.html
http://itpapers.techrepublic.com/abstract.aspx?docid=104503
http://forum.java.sun.com/thread.jspa?threadID=524143&tstart=210 -
How can I run the toolkit/emulator on Solaris?
I am demonstrating applications to customers that has a mobile device MIDlet that interacts with a webservice that is running on SJSAS81SE. I am trying to showcase Sun's products but I can't find a method to run an emulator on Solaris. Even netbean's 4.1 mobile pack only runs on Linux or Windows.
If there isn't a workaround I will either have to carry 2 machines with me (1 Solaris of the appserver and 1 Windows for the emulator) or I can switch to running Windows.
Any help would be appreciated.Does this run Desktop software, or "Apps"?
Maybe you are looking for
-
My 3 external hd's are 500GB (total 1.5TB) and my Mac Mini is 500GB (Time Capsule is connected to this). I want to be able to have all the content from all these sources stored on my Time Capsule as if I only had 1 external drive. Is this possible? I
-
Is it possible to save pictures from a iphone in recovery mode?
My iPhone4 slipped into recovery mode randomly in the middle of the night, I have not had a chance to back it up lately. My daughters second birthday pictures along with other vaulable memories are on the phone. Is there anyway I could salvage them?
-
Count of characters in a string
Hi all, Is there any way to find the repeating characters in the string like 'L' in the example Hello .. Thanks in advance, Nalla ! Message was edited by: Nalla Nalla (Nallasivam)
-
Where is my online number?!
Hi, I ordered my online number about a week ago and only got around to paying it today, and I wanted to send it forward to family and friends, but I can't for the life of me find the actual number as I didn't write it down before. Can anyone tell me
-
Trial version not full functioning?
To ry out some features, I follwed the tutorial video for using the healing brush to remove objects from a photo - in my case two people from a group photo. I selected "Expert", then the spot healing brush, brush size 20px. Content-Aware was selected