JSF :: Connecting To POJOs Through TomEE Plus Server?
Nov 19, 2014
I've created a Dynamic Web Project in Eclipse Kepler EE, connected it to a Tomee plus 1.7.1 server and created a servlet and a POJO. So after opening the browser and trying to do something with the classes, the servlet worked as expected, but the POJO returns error 404.
The actual code is something like this:
// The servlet
public class MyServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("I'm a servlet.");
[Code] ......
So when I type "localhost:8080/<project_name>/MyServlet" I get the expected "I'm a servlet." message. The problem is with the POJO:
//The POJO
@Path("/MyPOJO")
public class MyPOJO {
@GET
public String get() throws IOExeption {
return "I'm a POJO.";
}
}
I have nothing about that class in the web.xml file. I have this class, that I don't really know what it does:
@ApplicationPath("/sth")
public class ApplicationConfig extends Application {
@Override
public Set<Class<?>> getClasses() {
return new HashSet<Class<?>>(Arrays.asList(MyPOJO.class));
}
}
Application is a class from M2_REPOjavaxws
sjavax.ws.rs-api2.0.1javax.ws.rs-api-2.0.1.jar
So when I enter "localhost:8080/<project_name>/sth/MyPOJO", I get error 404, no exceptions no logs. I've tried to debug but it doesn't hit any breakpoints.
Maybe it has something to do with the exception I get when I start the server:
Nov 19, 2014 6:44:50 PM org.apache.myfaces.ee6.MyFacesContainerInitializer onStartup
INFO: Added FacesServlet with mappings=[/faces/*, *.jsf, *.faces]
Nov 19, 2014 6:44:51 PM org.apache.myfaces.config.DefaultFacesConfigurationProvider getStandardFacesConfig
INFO: Reading standard config META-INF/standard-faces-config.xml
[code]....
I've tried to add the line that is missing in the server.xml file but then the server doesn't start at all.
When my college tries to run it on his PC, it work with both the POJO and the Servlet. We can't find any reason why it's not running on my PC.
View Replies
ADVERTISEMENT
Jan 29, 2015
I know that Servlets are meant to do the JDBC tasks, JSP are only for displaying the final information forwarded by the Servlet.
JSP are Servlets too, but I heard an idea that it is safer to make database operations in a Servlet.
The idea is that I have a few JSP that use JSTL tags to retrieve some database information. By doing this I was concerned that this may be bad design, though I really wanted to get in fit with the JSTL tags.
Are there any security weaknesses if doing some JDBC stuff in a JSP, by using JSTL or plain Java code in <%...%>?
P.S. In my JSP I only retrieve data, not modifying it.
View Replies
View Related
Jan 16, 2015
I have multiple classes in one package and was wondering how to I use one class while in another?
What I mean is I have one sheet with a class and another sheet with another class. (Separate tabs in Eclipse).
View Replies
View Related
Nov 8, 2014
May I know what it means when you say "What is the OOP mechanism is used to link the library and the swing framework?"
What are the examples of OOP mechanisms? Is there a website explaining this in detail?
View Replies
View Related
Nov 6, 2014
Question 1: Upon importing the Play Framework content in Eclipse there's a default codes as localhost:9000 is immediately routed to play framework website controllers, checked and running fine test, checked and running fine conf, checked and running fine the problem is the views under app on all youtube tutorials and other websites, the contents of views is editable but when my brother tried to, he cant edit it
Question 2: Is there an easy tutorial on POST, PUT, GET, and DELETE for eclipse-playframework
Question 3:my brother is using POSTMAN - RESTCLIENT to test his HTTP METHODS (post, put, get, and delete)and is there a tutorial where they also test the HTTP METHODS using POSTMAN?
View Replies
View Related
Sep 17, 2014
I am new to Java Stored Procedures. There is a PL/SQL package in our legacy application(Oracle 9i) which pulls data from Oracle 8i source database through a DB link. Now we have upgraded our databas to Oracle 11g R2 from 9i. So the DB lint to Oracle 8i will no longer work in 11g. Hence I have created a Java stored procedure that establishes JDBC thin connection to the source 8i database. I have loaded the java stored procedure in the database using loadjava and have created a call specifaction.
I have called this java stored procedure inside the PL/SQL package. Now while executing the PL/SQL package, it takes the default driver ojdbc6.jar to establish JDBC connection and fails to connect to the 8i database giving ArrayIndexOutOfBounds Exception. While running the code in the linux application server with classes12.jar the code succeeds. But when the same is called in the database it fails.
1. How can I make my PL/SQL call use classes12.jar while calling the Java Stored Procedure?
2. How can I load the jar file(which includes my classes and the classes12.jar) into the datase as one object? (When I tried to load the whole jar, in database the classes and dependent jar loaded separately)
3. Is there a way to use classpath while calling the Java Stored Procedure like how we do from Unix?
View Replies
View Related
Apr 10, 2015
I am trying to connect to Sql Server database using Oracle UCP with sqljdbc4-3.0 JDBC driver for Sql Server,with different ports and instances.
– the issue is with the port being ignored in the server string.
For example, using port 1440 connects to the default instance (which is on port 1433) rather than MSSQLINSTANCE1 which is on 1440.
Below are Server hosts used.
sql005.sqlasoftware.com (connects correctly to the default instance)
sql005.sqlasoftware.com:1440 (connects incorrectly to the default instance on port 1433)
sql005.sqlasoftware.comMSSQLINSTANCE1 (connects correctly to the named instance)
View Replies
View Related
Jul 22, 2014
.
.
.
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/MyServletPDF?username=TEST");
response.setContentType("application/pdf");
dispatcher.include(request,response);
%>
While debugging everything is going through... even it passes through the last line. But the pdf is not launching... showing only a blank screen in its status bar as "Connecting"... Earlier it was launching.. but suddenly this issue is raising up. Is there any IE settings need to be checked?
View Replies
View Related
Jun 25, 2014
I get the following error when trying to run code.
java.lang.NullPointerException
at conntecttoDB8.SSHCommandExecutor.main(SSHCommandEx ecutor.java:26)
package conntecttoDB8;
import java.io.InputStream;
import com.jcraft.jsch.Channel;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session;
[Code] ....
View Replies
View Related
Jul 9, 2015
We currently have an application which uses JDBC to connect to the backend database (DB version - 11.2.0.3 ). The application uses a properties file in which the password for the db schema is hardcoded in plain text format. Due to security restrictions we have been asked to make sure the password is encrypted in the file and no direct access is made to the schema using the plain text password. Best options we can use to make this password encrypted both at Oracle DB side and Java side.
View Replies
View Related
Jul 27, 2014
I am developing a web application using JSF-2.0 on weblogic 10.3.6. I am using Facelets as VDL. I have 5 different machine. They are different according to their OS and their geographical location. On my first xhtml page server (machine) is decided. Then on next page file upload and rest of processing takes place. My restriction is that SSO configuration can be done on only one machine.
So I am restricted to using xhtml files from only my primary server where SSO configuration is done. But I have to connect to servlets or managed-bean of different machine as requests are machine specific and file needs to be uploaded to those machines for processing. So I cannot use redirectUrl as I need to be only on one machine. Is it possible that xhtml on one server can talk to managed-bean on other server(different machine)?.
View Replies
View Related
Apr 1, 2014
I am working on a chess game. I need to construct a game room where all the player are present and room chat is up. Also some tables where games are being played. Now my question is how to create this game room?
To me this room must need to be like static or global (if I am not mistaken) that is up when server starts and players can join this room and should be down when server is done. How can I implement such room that would stay up for infinite time.
View Replies
View Related
Apr 11, 2014
I have developed a code to connecting remote windows M/C from local M/C by using SSH2 (ganymed-ssh2-build209.jar) API. when I run the code its giving below error. Is there any other way to connect remote windows system using java code.
Exception.
java.io.IOException: There was a problem while talking to <host name>:22
at ch.ethz.ssh2.Connection.connect(Connection.java:642)
at ch.ethz.ssh2.Connection.connect(Connection.java:460)
at Connect.RemoteServer.ConnectWindowsServer.runCommand(ConnectWindowsServer.java:55)
at Connect.RemoteServer.ConnectWindowsServer.main(ConnectWindowsServer.java:27)
Caused by: java.net.ConnectException: Connection refused: connect
[Code] ....
JAVA Code
import ch.ethz.ssh2.Connection;
import ch.ethz.ssh2.Session;
public void setAuthenticationInfo(String hostname, String username,String password) {
this.host = hostname;
this.userid = username;
this.password = password;
this.recentCommand = "";
System.out.println("setting authentication info completed for host=" + host );
[Code] .....
View Replies
View Related
Apr 19, 2015
Working on a project and am in need of some quick guidance to wrap things up. I have a functioning compression server that will create two files after the user gives it some input and a "magic string" to know when to stop reading input for that specific file.
I now need to connect a UDP web server to that compression server. the web server will read from the HTTP POST Request the data that was uploaded and send it to the compression server to create the two files... i have included both programs below
Web Server:
import java.io.*;
import java.net.*;
import java.util.*;
final class HttpRequest implements Runnable {
//Declare Constants and Variables
final static int BUF_SIZE = 1024000;
final static String CRLF = "
";
[Code]...
Compression Server:
import java.net.*; // for DatagramSocket, DatagramPacket, and InetAddress
import java.io.*; // for IOException
import java.util.zip.*;// for Zip
public class CompressionServer {
private static final int ECHOMAX = 65535; // Maximum size of echo datagram
private static final int BUFFER = 2048; // Buffer size for writing to Zip File
[Code]....
View Replies
View Related
Dec 20, 2014
I am new to Servlets and came across it in Head First Java 2nd Edition. I wrote the servlet code. I don't know how to run it. Do I need to set up a server?
View Replies
View Related
Jun 16, 2014
Im trying to connect to sql server but i get this error
2014 7:03:38 ΜΜ com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:1 ClientConnectionId: 8ee72721-9ec7-41e2-9f57-ebc16d958073 Prelogin error: host localhost port 3306 Unexpected response type:74
url = "jdbc:sqlserver://localhost:3306;user=root;password=root;database=test";
When i try to connect with mysql workbench i connect succesfully.
View Replies
View Related
May 10, 2013
I am new to FTP java api. I wanted to do a Ftp transfer from one server to another server using java. I have the connection details for both servers. I found a link with some code but when I try to execute it it throws an error "Couldn't initiate transfer. Check that filenames are valid."
This is the link--> [URL] ....
View Replies
View Related
Oct 22, 2014
I am attempting to test a TCP Client and Server for an assignment I am doing in class. The goal here is to "test your client and Server applications by transferring (i) a file having 10,000+ lines (see supplied big-file1.txt having 12000+ lines), (ii) a file having 20,000+ lines (you may create one of your own from big-file1.txt, or obtain a large size file from the Google website at [URL] ...). Then, compute and display the total transfer time of the files at both of the sides separately (your choice in millisecond/second)."
I have created the TCPClient and TCPServer java classes, ran the server first and then the client, and using mathematical formulas to calculate the transfer time. Trouble is, I'm having trouble testing the client and server in the file area and not the area where I had to input a line, let the server print it, and then have the client eliminate the articles from the line. I need testing the file. Here is my code so far:
TCPClient:
package tcpclient;
import java.io.*;
import java.net.*;
public class TCPClient {
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
String sentence;
[code] ....
How to fix the code so that the time in seconds does not output as 60 for both files and that the files go through the exchange?
View Replies
View Related
Mar 9, 2014
I have made a server/multi Clients where Clients send Double data but my problem is that the clients send this data to Server only wonce, and the server waits again the connection from client. (I have to run the clients manually each time)what i'm looking: the client should always send data to server. like an infinite loop.
View Replies
View Related
Nov 14, 2014
I'm installing sonarQube in Eclipse indigo, How to run SonarQube in Eclipse Projects and adding sonar plug in into Eclipse IDE.
View Replies
View Related
Apr 15, 2015
The goal is as follows: Write a UDP 'CompressionServer' that will take input from the user until it sees a "magic string" at which time it will create a compressed and uncompressed version of the file in the file system.
So, I need to integrate the following "Zip" code in to my UDP server code (which already creates the uncompressed file)... That is where I am stuck at now. My first few attempts had the Zip code after I write to "fout" but that failed to create a ZIP file.
I guess the main point here is what are the key pieces of the ZIP code that I should include and what would be the best spot to place them in my server code...
Zip Code:
import java.io.*;
import java.util.zip.*;
public class Zip {
static final int BUFFER = 2048;
public static void main (String argv[]) {
try {
String fileInput = argv[0];
String fileOutput = argv[1];
[Code] ....
View Replies
View Related
May 22, 2014
i want to use EJB 3 in my WAS8 application but it doesn't work.First of all i created an remote-interface:
import javax.ejb.Remote;
@Remote
public interface EjbTestRemote {
public void doSth();
}
Then i created a session bean class:
import javax.ejb.Stateless;
@Stateless
public class EjbTest implements EjbTestRemote {
[code]....
But now i want to call the session bean from a normal (no servlet, no ejb) java class but i doesn't work (NamingNotFoundException):
try {
Context ctx = new InitialContext();
EjbTestRemote ejbTestLocal = (EjbTestRemote) ctx.lookup("java:comp/env/EjbTest");
ejbTestLocal.doSth();
} catch (NamingException e) {
e.printStackTrace();
}
View Replies
View Related
Nov 26, 2014
How can I connect to an SSH server in Java? I don't need/want a shell. I just want to connect to the SSH server and get the content of, say, file.txt. How can I do that? Example : I get host, user,pass in txt and connect it with java code!
View Replies
View Related
Mar 26, 2014
I've the following requirement. A centralized server needs to be established using java code. The server's responsibility is receiving the status of the each client machine as a XML file and storing it in the server's disk space. The client machine also runs the java code to send the status to the server as an XML file in a daily basis. I've planned to create a SOAP webservice in server machine and client machine will invoke the soap webservice to send the status. Do I have to establish any FTP server for storing the XML files? Is there any other better solution for this requirement?
Do I have to establish any FTP server for storing the XML files?
View Replies
View Related
Jun 18, 2014
So, after my graphics card melted down, I decided to use a chat program because I can't play the game server which I am staff on. I've downloaded this:
CactusChat: MC 1.7.4 - 1.7.5 chat client for Windows, Mac and Linux Operating Systems | EcoCityCraft Economy | Minecraft Servers
After I knew it was a .jar file, it would basically fail, I would launch it, it turns into a cmd for 0.5 seconds, and closes without any progress. Typical, and expected.I downloaded the latest java update, removed 3 older versions, and now my Java SE Binary program went missing. I can't even launch it, and it tells me to look for another program to launch it with.
View Replies
View Related
May 29, 2014
The server was working normally but now I'm seeing these errors
Server Side:
java.lang.ClassNotFoundException : PacoteTradugo.Mensageiro
at java.net.URLClassLoader $ 1.run ( URLClassLoader.java : 372 )
at java.net.URLClassLoader $ 1.run ( URLClassLoader.java : 361 )
[Code].....
View Replies
View Related