Dominik Ratajski

Greenhorn
+ Follow
since Feb 09, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Dominik Ratajski

Thanks.

It does look that way - incidentally this is on Sun ONE Application Server 7.0

I'll output to log a message along with the throw.

DSR
Sun ONE Application Server (AS) is Sun implementation of J2EE server.

The same as Tomcat is another implementation of J2EE server.

There are different versions of AS and the free version to download is a cut down version.

DSR
20 years ago


i'm trying to throw a message with a meaningful message in the above code.

it appears like it's nesting my exception in a InvocationTargetException in a CreateException in a EJBException:

output from e.getMessage() = nested exception is: javax.ejb.EJBException: nested exception is: javax.ejb.CreateException: Could not create stateless EJB: java.lang.reflect.InvocationTargetException

output from e.getCausedByException().getMessage() = nested exception is: javax.ejb.CreateException: Could not create stateless EJB: java.lang.reflect.InvocationTargetException

why doesn't this print out "my message" to console? i get a stack trace and message that doesn't mention "my message" at all.

Cheers.

DSR
it sounds like the two servers do not have a common public key installed.

when i connect from a j2ee application on application server to ldap using ssl i have to specify the public key store in my jvm (-Djavax.net.ssl.trustStore=<keystore_filepath> .

i also have to have the same public key installed on the ldap server in order to ssl handshake.
20 years ago
the sun-web.xml is used for deployment time mapping on sun application server (AS).

it's to ensure that if the jdbc pool changes on the server that the application can be modified at deployment time. it should be in your WEB-INF directory.

jdbc/logical_ds is the name call you make using the jndi name in your code:
ie DataSource ds = Context.lookup("java:comp/env/jdbc/logical_ds");

the physical_ds is the name of the connection pool that you defined on the server (in your case this is jdbc/jdbc-oracle).

i've mentioned the sun-web.xml as this is the Sun AS forum. i'm not sure by what you mean by a web based client - if it's a server based connection pool a client based bean will not have access to it. if it's a server based bean it should be the same although i haven't tried it.

you should be able to access the pool directly by calling:
DataSource ds = Context.lookup("jdbc/physical_ds");
or specific to your jndi name:
DataSource ds = Context.lookup("jdbc/jdbc-oracle");
however you will notice some error messages about cannot locate object or something similar althought it will still work. doing the lookup ("java:comp/env...") with the mapping is the correct way to do it.

DSR
20 years ago
have you set up the sun-web.xml with the mapping of the object type and the logical datasource?

web.xml
<resource-ref>
<res-ref-name>jdbc/logical_ds</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>


sun-web.xml
<resource-ref>
<res-ref-name>jdbc/logical_ds</res-ref-name>
<jndi-name>jdbc/physical_ds</jndi-name>
</resource-ref>

to use the full java:comp... etc you need to set up the sun-web.xml deployment mapping, otherwise if you use just "jdbc/jdbc-oracle" (assuming this is your jndi connection pool name) to connect directly to the connection pool.

DSR
20 years ago
I'm coming across a problem where an exception is raised after server based connection pool connection has the setAutoCommit(false) method run:




03/Jul/2004:10:15:56] SEVERE ( 8864): RAR5040:Cannot get local connection
com.sun.enterprise.resource.PoolingException: I/O Error: Got minus one from a read call.
at com.sun.enterprise.resource.JdbcUrlAllocator.createResource(JdbcUrlAllocator.java:100)
at com.sun.enterprise.resource.IASNonSharedResourcePool.internalGetResource(IASNonSharedResourcePool.java:742)
at com.sun.enterprise.resource.IASNonSharedResourcePool.getResource(IASNonSharedResourcePool.java:520)
at com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:263)
at com.sun.enterprise.resource.JdbcXAConnection$JdbcConnection.getCurrentConnection(JdbcXAConnection.java:637)
at com.sun.enterprise.resource.JdbcXAConnection$JdbcConnection.setAutoCommit(JdbcXAConnection.java:402)
at com.aramco.gps.dao.ConnectionManager.getConnection(ConnectionManager.java:46)

is there anyway a connection can be passed back to the pool in a dirty state? for instance prior to a commit/rollback.

any ideas what a "minus one from read call" means?

also - does the setAutoCommit() method communicate in anyway with the backend database? so for instance, could this error be as a result of a connection that is "valid" to the server connection pool, but say a network error causes the exception when the setAutoCommit() communication occurs.

i can't reproduce this error. it's on Sun ONE AS 7.0.

any ideas appreciated. cheers.
20 years ago
I'm coming across a problem where an exception is raised after server based connection pool connection has the setAutoCommit(false) method run:



03/Jul/2004:10:15:56] SEVERE ( 8864): RAR5040:Cannot get local connection
com.sun.enterprise.resource.PoolingException: I/O Error: Got minus one from a read call.
at com.sun.enterprise.resource.JdbcUrlAllocator.createResource(JdbcUrlAllocator.java:100)
at com.sun.enterprise.resource.IASNonSharedResourcePool.internalGetResource(IASNonSharedResourcePool.java:742)
at com.sun.enterprise.resource.IASNonSharedResourcePool.getResource(IASNonSharedResourcePool.java:520)
at com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:263)
at com.sun.enterprise.resource.JdbcXAConnection$JdbcConnection.getCurrentConnection(JdbcXAConnection.java:637)
at com.sun.enterprise.resource.JdbcXAConnection$JdbcConnection.setAutoCommit(JdbcXAConnection.java:402)
at com.aramco.gps.dao.ConnectionManager.getConnection(ConnectionManager.java:46)

is there anyway a connection can be passed back to the pool in a dirty state? for instance prior to a commit/rollback.

any ideas what a "minus one from read call" means?

also - does the setAutoCommit() method communicate in anyway with the backend database? so for instance, could this error be as a result of a connection that is "valid" to the server connection pool, but say a network error causes the exception when the setAutoCommit() communication occurs.

i can't reproduce this error. it's on Sun ONE AS 7.0 and i'll post this in that forum also.

any ideas appreciated. cheers.
i think you're getting into a level of complexity that really may not be required. if you're using two servers you should consider a high availability hardware switch to handle the load.
consider the implications that utilising a "redirection swtich" would have on session objects (ie server1 responds initially to the client, then the client gets redirected to server2 for the next response).
to obtain the server response time you'd need to have a seperate threaded servlet running as the controller to constantly poll and measure the other two server response times. this controller would then *forward* requests to whichever server is the quickest.
keep in mind that you now need three servers (one as the controller to the other two) and also that if your controller server or servlet goes down, your application is toast.
from a browser you cannot redirect to the best server without an intemediary (controller) unless you run an applet in the browser. the applet would then send of a request to both servers, and which ever responds first, the applet would then initiate communication with.
DSR
20 years ago
the error relates to you already sending some kind of response (eg response.getWriter().println(...)) back to the browser and then asking it to redirect/forward.
check your code to see whether you're sending any response information prior to the forward. you can only do either, ie one forward or (multiple)write but not combinations of the two or multiples of forwards/redirects
DSR
20 years ago
no.
strictly speaking a servlet cannot disable browser buttons.
you'd have to do something through javascript using the history:
if (currentpage is in history) {
window.history.forward(1);
}
in general, you cannot control a users browser - ie font preferences, disabling buttons etc.
the other way would be to use a session based pages which expires so that if they go back they would get page cannot be found etc.
DSR
20 years ago
try:
String[] cmdString = { scriptname, parm0, parm1...};
Process process = Runtime.getRuntime().exec(cmdString);
try {
process.waitFor()...
} catch (InterruptedException)
if you're returning a value from the script the process.waitFor() can be used as a condition statement ie:
if (process.waitFor() == 0) {
DSR
20 years ago
Thanks for your replies. Much obliged.
My only concern about using a hidden field is that it is possible to modify the fields contents through Javascript - ie, through JavaScript debugger console you would have access to setting the hidden fields value.
This would then corrupt the information sent back and cause a security breach.
However it does make sense to have it as a non session value given that it's not session information.
20 years ago
Hello,
I am using a JSP with a <FORM ACTION=Servlet METHOD="POST"> and the Servlet as the controller.
I am also setting a session variable in the JSP as an identifier for the Servlet to identify what action to perform.
ie:
JSP1:
<%session.setAttribute("webAction","someAction")%>
JSP2:
<%session.setAttribute("webAction","someOtherAction")%>
Servlet:
String webAction = (String)session.getAttribute("webAction");
if (webAction.equalsIgnoreCase("someAction")) {
request.getParameter("someParm");
...
} else if (webAction.equalsIgnoreCase("someOtherAction")) {
request.getParameter("someOtherParm");
...
This works great however, if the user hits the back button, I get an nullpointer exception.
I suspect this is because the session attribute has been set by the new JSP they're on and going back results in the servlet processing being called again however this time with the new session attribute where none of the request parameters being set.
What would be the best way to handle this?
Should I test the first paramter obtained for a null value or catch the whole exception?
Or should I be looking at this differently all together?
Any direction appreciated.
20 years ago