Friday, April 11, 2014

Re: (null) value only in DEV mode

Yes, now Iam trying but there is something wrong with NetBeans -> Tomcat
in log I received:
javax.naming.NamingException: /usr/share/tomcat6/conf/tomcat-users.xml (Permision denied)
a lot of them... fixing rights, looking after user-run definition... all looks ok but still isnt working
I have no problem with that in diff Java projects using the same method...

Dne čtvrtek, 10. dubna 2014 15:06:29 UTC+2 Zbyněk Kočí napsal(a):
Hello,

Iam using RPC communication, JDBC driver (included in Tomcat libraries) & DB from previous project (Java & JSP only)
Debian, NetBeans 7.4, Apache Tomcat 6
On server side Iam connection into the DB, retreiving data, trying to catch them immediately and next print them out in alert message (with RPC example)

When I clean&build project, copy WAR file into the TomCat6 server it works fine in production mode and data are retreived properly, even System.out in Catalina logs works, but when Iam trying to do the same in DEV mode, it returns (null) as string text value instead. But no error message or log

I guess its some kind problem with accesing JDBC or diff address location while in DEV mode at address: http://127.0.0.1:8888/?gwt.codesvr=127.0.0.1:9997

Iam unable to find this issue while happen only in DEV mode.
Can anyone hint me whats wrong?

Contect.xml (tried only / as path, maybe issue here)
<Context antiJARLocking="true" path="/RPC">
  <Resource auth="Container" driverClassName="org.postgresql.Driver" maxActive="20" maxIdle="10" name="jdbc/postgres" password="pass" type="javax.sql.DataSource" url="jdbc:postgresql://127.0.0.1:5432/firstdb" username="user" validationQuery="select 1"/>
</Context>
Connection method (I found another one, but it doesnt seem working properly)
private Connection getConnection() throws NamingException, SQLException {
        Context ctx = null;
        try {
            ctx = new InitialContext();
        } catch (NamingException exp) {
        }
        DataSource ds = (DataSource) ctx.lookup("java:/comp/env/jdbc/postgres");
        return (ds.getConnection());
    }

Still in server Impl file as the only one JAVA server-side code
try {
            String query = "SELECT * FROM users WHERE id = ?";
            connection = getConnection();
            stmt = connection.prepareStatement(query);
            stmt.setInt(1, 1);
            rs = stmt.executeQuery();

            while (rs.next()) {
                id = rs.getInt("id");
                nam = rs.getString("nam");
                srn = rs.getString("srn");
                System.out.println(nam + " " + srn);
            }

and then after catch exceptions 
String messageString = "Hello " + nam + " " + srn + "!" +
                "message:" + input;
 
Feel free to ask me for more info/code

Thanks

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment