Search Results

Search found 19 results on 1 pages for 'noona'.

Page 1/1 | 1 

  • using wsgen utility

    - by Noona
    I have a web service implemented in this folder in package in eclipse: src\hw2\agency\server to generate the client classes using WSGEN utility, I entered the following command in cmd: C:\Users\NOONA\workspace\HW2>wsgen -d . -keep -wsdl -classpath . hw2.agency.server.AgencyServiceServerImpl but I get the following error: Class not found: "hw2.agency.server.AgencyServiceServerImpl" so I was wondering, what should I do to make it find the class? thanks

    Read the article

  • making class accessible from class path in dynamic class loading

    - by Noona
    I have a project created in Eclipse, and I defined an interface and a class for dynamic class loading, the class is in the project directory, so I have this code in my project: if (handlerClassName != null) { TypeHandler typeHandler = null; try { typeHandler = (TypeHandler) (Class.forName(handlerClassName).newInstance()); but I get this exception: java.lang.ClassNotFoundException: "handlerClassName" what should I do to make the JVM recognize the class "handlerClassName" in my project? thanks

    Read the article

  • RMI on client side generating exception when getting a reference to the RMI server

    - by Noona
    When I try to run an RMI client after running the RMI server I get the following exception: EncodeInterface exception: java.lang.ClassCastException: $Proxy30 cannot be cast to hw2.chat.backend.main.EncodeInterface java.lang.ClassCastException: $Proxy30 cannot be cast to hw2.chat.backend.main.EncodeInterface at hw2.chat.backend.main.EncodingRmiClient.initialiseRMIClient(EncodingRmiClient.java:26) And the relevant code in the RMI client is: EncodeInterface encodeInterface; Registry registry = LocateRegistry.getRegistry(host, portNumber); encodeInterface = (EncodeInterface)registry.lookup("RmiEncodingServer"); //line 26 And in the RMI server: try { EncodeInterface encodeInterface = new EncoderImpl(); Registry registry = LocateRegistry.getRegistry(); registry.rebind("RmiEncodingServer", encodeInterface); System.out.println("RmiEncodingServer is running..."); } EncodeInterface is the interface that extends Remote and that is present in the client side too. Host is "127.0.0.1" and portNumber is 1099 (I am assuming it should be the default value which is 1099 since I didn't specify it when I ran my RmiEncodingServer). If I don’t run the RMI server I get the same exception, any ideas as to why this is happening? thanks

    Read the article

  • Specifying a variable name in QUERY WHERE clause in JDBC

    - by Noona
    Could someone please give me a link on how to create a query in JDBC that gets a variable name in the WHERE statement, or write an example, to be more specific, my code looks something like this: private String getLastModified(String url) { String lastModified = null; ResultSet resultSet; String query = "select LastModified from CacheTable where " + " URL.equals(url)"; try { resultSet = sqlStatement.executeQuery(query); } Now I need the syntax that enables me to return a ResultSet object where URL in the cacheTable equals url from the method's argument. thanks

    Read the article

  • web service - client classes

    - by Noona
    The web service that I implemented is up and running, when I try to run the client I get the following error with regard to the classes that were generated using wsimport, Caused by: java.security.PrivilegedActionException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 4 counts of IllegalAnnotationExceptions Two classes have the same XML type name "{http://server.agency.hw2/}userJoined". Use @XmlType.name and @XmlType.namespace to assign different names to them. this problem is related to the following location: at hw2.chat.backend.main.generatedfromserver.UserJoined at public javax.xml.bind.JAXBElement hw2.chat.backend.main.generatedfromserver.ObjectFactory.createUserJoined(hw2.chat.backend.main.generatedfromserver.UserJoined) at hw2.chat.backend.main.generatedfromserver.ObjectFactory this problem is related to the following location: at ChatCompany.BackendChatServer.hw2.chat.backend.main.generatedfromserver.UserJoined Two classes have the same XML type name "{http://server.agency.hw2/}userJoinedResponse". Use @XmlType.name and @XmlType.namespace to assign different names to them. this problem is related to the following location: at hw2.chat.backend.main.generatedfromserver.UserJoinedResponse at public javax.xml.bind.JAXBElement hw2.chat.backend.main.generatedfromserver.ObjectFactory.createUserJoinedResponse(hw2.chat.backend.main.generatedfromserver.UserJoinedResponse) But I can't figure out what exactly is meant by the error. I am assuming I need to change something in annotations in this class as pointed out by the compiler: @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "userJoinedResponse") public class UserJoinedResponse { } could someone please point out why there's a name collision and what annotations I need to change? thanks

    Read the article

  • handling java exception

    - by Noona
    This questions is related to java exception, why are there some cases that when an exception thrown the program exits even though the exception was caught and there was no exit() statement? my code looks something like this void bindProxySocket(DefaultHttpClientConnection proxyConnection, String hostName, HttpParams params) { if (!proxyConnection.isOpen()) { Socket socket = null; try { socket = new Socket(hostName, 80); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { proxyConnection.bind(socket, params); } catch(IOException e) { System.err.println ("couldn't bind socket"); e.printStackTrace(); } } } and then I call this method like this: bindProxySocket(proxyConn, hostName, params1); but, the program exits, although I want to handle the exception by doing something else, can it be because I didn't enclose the method call within a try catch clause? what happens if I catch the exception again even though it's already in the method? and what should I do if i want to clean resources only if an exception occurs and otherwise I want to continue with the program? I am guessing in this case I have to include the whole piece of code until I can clean the resources with in a try statement or can I do it in the handle exception statement? some of these questions are on this specific case, but I would like to get a thorough answer to all my questions for future reference. thanks

    Read the article

  • Applying different Cascade Style Sheets to the same html page

    - by Noona
    To apply a CSS to an existing html page I need to add a link that links to the css file, I am asked to include a link in the webpage that I am building that would link to the same html page but with a different css file, I am thinking I need to create a different css file, then create another .html page by copy the exact content from the first page and only change the link of the css file, but it doesn't seem so efficient and I am assuming there should be a standard method to do this. thanks

    Read the article

  • running an RMI server in command line and eclipse

    - by Noona
    I need to run my RMI server using the command line, my class files reside in this folder: C:\workspace\distributedhw2\AgencyServers\RmiEncodingServer\RmiServerClasses in package hw2.rmi.server The code base reside in this folder: C:\workspace\distributedhw2\AgencyServers\RmiEncodingServer\RmiServerCodeBase in package hw2.rmi.server I use the command line: java –classpath C:\workspace\distributedhw2\AgencyServers\RmiEncodingServer\RmiServerClasses\ -Djava.rmi.server.codebase=file:/C:\workspace\distributedhw2\AgencyServers\RmiEncodingServer\ Djava.security.policy=c:\HW2\permissions.policy hw2.rmi.server.RmiEncodingServer but I get a "class not found" exception as follows: Exception in thread "main" java.lang.NoClassDefFoundError: ûclasspath Caused by: java.lang.ClassNotFoundException: ûclasspath at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class: GÇôclasspath. Program will exit. where have I gone wrong? also, if you can provide instructions on how to run the server in eclipse, I added the following as a VM argument, but I get a class not found exception to a class that is in the RmiServerCodeBase: -Djava.security.policy=C:\workspace\distributedhw2\permissions.policy -Djava.rmi.server.codebase=file:/C:\workspace\distributedhw2\AgencyServers\RmiEncodingServer thanks

    Read the article

  • connecting to MySQL using JDBC in eclipse

    - by Noona
    Hello, So I want to create a JDBC connection to MySQL server that is installed on my pc, here are the steps, I installed MySQL with the username and password "root", downloaded mysql-connector-java and from theere I coped the JAR "mysql-connector-java-5.1.12-bin" to "C:\Sun\SDK\jdk\jre\lib\ext", I then added it as an external JAR in my project in eclipse, now in my class I have this code: public void initialiseDatabase() { try { // Load the Driver class. Class.forName("com.mysql.jdbc.Driver"); //Create the connection using the static getConnection method databaseConnection = DriverManager.getConnection (databaseUrl+databaseName, dbUserName, dbPassword); sqlStatement = databaseConnection.createStatement(); } catch (SQLException e) {e.printStackTrace();} catch (Exception e) {e.printStackTrace();} } (this is going to be psuedocode cause I am reading from a properties file and don't want the one helping me reading through long lines of code from main to figure out all the variables), where databaseUrl = "127.0.0.1" dbUserName = "root" dbPassword = "root" databaseName = "MySQL" //this one I am not sure of, do I need to create it or is it set inherenrly? now the MySQL server is up and running, but when I call the method initialiseDatabase the following exception is thrown: "java.sql.SQLException: No suitable driver found for rootroot at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at Proxy$JDBCConnection.initialiseDatabase(Proxy.java:721)" when line 721 is: sqlStatement = databaseConnection.createStatement(); Where have I gone wrong? thanks

    Read the article

  • "java.lang.ArrayIndexOutOfBoundsException" with System.arraycopy()

    - by Noona
    These few lines of code are giving me a "java.lang.ArrayIndexOutOfBoundsException" exception, could someone please take a look and point out why (the exception is caused in the second arraycopy() call): byte [] newContentBytes = EntityUtils.toByteArray((serverResponse.getEntity())); newContent = new String(newContentBytes); System.out.println( newContent); byte [] headerBytes = headers.getBytes(); byte[] res = new byte[newContentBytes.length + headerBytes.length]; //headerBytes. System.arraycopy(headerBytes, 0, res, 0, headerBytes.length); System.out.println( "length: " + newContentBytes.length); System.arraycopy(newContentBytes, 0, res, newContentBytes.length , newContentBytes.length); The problem is in allocating res size, for example if I write new byte[newContentBytes.length + headerBytes.length+ 2000] instead the exception doesn't occur, so what should the accurate size be?

    Read the article

  • building a web application in eclipse

    - by Noona
    As a concluding assignment for the technologies taught in a data management course, we have to write a web application using the technologies taught throughout the course, this mostly includes xhtml, css, JSP, servelets, JDBC, AJAX, webservices. the project will eventually be deployed using tomcat. we are given the option of choosing the technologies that we see fit. since this is my first time developing a web application I am having some uncertainties about where to start, so for example now I am writing the object classes that will be used in the database and implementing the operations that will be performed on the database, but I am not sure about how to make these operations available to a client through the website, I mean I think I have to write a servlet through which I can extract the request parameters and set the response accordingly, but I would still like a more specific overview of what I am going to do, so if someone can link me to a tutorial with an example that makes use of these technologies while illustrating the stages of the design so that I can see how all these things are linked together in a web project. thanks

    Read the article

  • communication between threads in java

    - by Noona
    How can I make a thread run only if the other thread is running too, meaning, if I return from run in one thread, then I want the other to stop running too, my code looks something like this: ClientMessageHandler clientMessagehandler = new ClientMessageHandler(); ServerMessageHandler serverMessagehandler = new ServerMessageHandler(); Thread thread1 = new Thread(serverMessagehandler); Thread thread2 = new Thread(clientMessagehandler); thread2.start(); thread1.start(); i want to cause thread1 to stop running when thread2 stops running. thanks

    Read the article

  • setting a timeout for an InputStreamreader variable

    - by Noona
    I have a server running that accepts connections made through client sockets, I need to read the input from this client socket, now suppose the client opened a connection to my server without sending anything through the server's socket outputstream, in this case, while my server tried to read the input through the client socket's inputstream, an exception will be thrown, but before the exception is thrown i would like a timeout say of 5 sec, how can I do this? currently here's how my code looks like on the server side: try { InputStreamReader clientInputStream = new InputStreamReader(clientSocket.getInputStream()); int c; StringBuffer requestBuffer = new StringBuffer(); while ((c = clientInputStream.read()) != -1) { requestBuffer.append((char) c); if (requestBuffer.toString().endsWith(("\r\n\r\n"))) break; } request = new Request(requestBuffer.toString(), clientSocket); } catch (Exception e) // catch any possible exception in order to keep the thread running { try { if (clientSocket != null) clientSocket.close(); } catch (IOException ex) { ex.printStackTrace(); } System.err.println(e); //e.printStackTrace(); }

    Read the article

  • Compiling a class using Java code using process

    - by Noona
    I have this piece of code that compiles a class called tspClassName, when I compile using this code: Process compileProc = null; try { compileProc = Runtime.getRuntime().exec("javac -classpath ." + File.separator + "src" + File.separator + File.separator + "generated." + tspClassName + ".java -d ." + File.separator + "bin"); // catch exception if (compileProc.exitValue() != 0) { System.out.println("Compile exit status: " + compileProc.exitValue()); System.err.println("Compile error:" + compileProc.getErrorStream()); it outputs this: "Compile exit status: 2 Compile error:java.io.FileInputStream@17182c1" The class tspClassName.java compiles without errors otherwise, so I am guessing it has to do with the path,and in my eclipse project, the tspClassName.java resides in package homework4.generated inside src, is there something wrong with the path that I use in the code? thanks

    Read the article

  • project hierarchy

    - by Noona
    Is there a difference between a package and a folder in eclipse? for example, if I have this hierarchy requirement: java –classpath C:\ChatCompany\BackendChatServer\ -Djava.security.policy=c:\HW2\permissions.policy hw2.chat.backend.main.ChatBackendServer when the package's name is: "hw2.chat.backend.main" and "ChatCompany\BackendChatServer\" is the folder name, then how can I make this separation between a package and a folder in eclipse, so that I can write "package hw2.chat.backend.main" and not "package ChatCompany.BackendChatServer.hw2.chat.backend.main"? thanks

    Read the article

  • designing database tables using JDBC

    - by Noona
    I am creating a users table using JDBC and mysql, each user has a permissions list that comprises Integer values, I am wondering if I should use an array for storing these values and then have only 1 record for this user in the table, or simply create a new table that comprises 2 columns: user ID and permissions, and then have multiple records for each user that specify the user name in one columns and one permission value in the second column, the second option seems to be redundant since a permission value is a simple object that isn't associated with any other objects (like a student and courses list for example, because the course is associated with many other objects, like grade, teacher, etc, so in this case it is natural to have multiple records), but the first one seems to be a bit unnatural to me, so if someone has experience with these things and direct me? thanks

    Read the article

1