Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

Hrvoje Canzek

Greenhorn
+ Follow
since Sep 18, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Hrvoje Canzek

here is the bible:
Core Servlerts and JavaServer Pages
(with example code)
Regards
Hrvoje Canzek
16 years ago
JSP
Hi there,
i use the BusinessDelegate and ServiceLocator pattern for the client to invoke stateless session beans. In the ServiceLocator i cache the EJBHome objects. Furthermore i use the following methods from the Core J2EE Patterns
// Converts the serialized string into EJBHandle
// then to EJBObject
public EJBObject getService(String id) throws RemoteException
{
Handle handle = null;
if (id == null)
{
System.out.println("id not available!!!");
}
try
{
byte[] bytes = new String(id).getBytes();
InputStream io = new ByteArrayInputStream(bytes);
ObjectInputStream os = new ObjectInputStream(io);
handle = (Handle)os.readObject();
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
return handle.getEJBObject();
}
}
// Returns the String that represents the given
// EJBObject's handle in serialized format.
protected String getId(EJBObject session) throws RemoteException
{
Handle handle = null;
ByteArrayOutputStream fo = null;
try
{
handle = session.getHandle();
fo = new ByteArrayOutputStream();
ObjectOutputStream so = new ObjectOutputStream(fo);
so.writeObject(handle);
so.flush();
so.close();
}
catch(RemoteException ex)
{
e.printStackTrace();
}
catch(IOException ex)
{
e.printStackTrace();
}
finally
{
return new String(fo.toByteArray());
}
}
The getID works fine, but when i call getService the following error
occured
java.lang.ClassNotFoundException:
business_layer.enterprise_beans.session_facade._Cart_Stub
at java.net.URLClassLoader.findClass(URLClassLoader.java(Inlined Compiled
Code))
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java(Compiled Code))
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java(Compiled Code))
at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:690)
at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:963)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:402)
......
The application runs on WebSphere App. Server V5
Can someone tell me what is wrong, and how to fix it???
Thank you
Regards
Hrvoje Canzek
Hi together :-)
i have a J2EE Application running on WebSphere App.Server V5. I use a FrontController (a servlet)wich handles the login procedure and session management. For example there are three jsp pages....
login.jsp
start.jsp
denied.jsp
Every request goes through the FrontController!!!
Now my problem...
when i enter username and password into the form on login.jsp and press enter the data goes to FrontController wich takes the username and password and checks it. when everything is allright a new session is created (in the FrontController) and the requested site is displayed (start.jsp).
Some smoked cigarettes later, the session is timed out...when i refresh start.jsp a new session is created, because the username and password are cached. I DON'T WANT THAT. How can i solve this???
Infos:
I added the following headers in every *.jsp file
<%response.reset();
response.addHeader("Expires:","Mon, 01 Jan 2001 00:00:00 GMT");
response.addHeader("Pragma","no-cache");
response.addHeader("Cache-Control","no-cache, must-revalidate");
response.addHeader("Cache-Control","post-check=0, pre-check=0");
response.addHeader("Cache-Control","private");
%>
also i tried this
<%
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
%>
but the username and password fields still holds the informations....how can i reset this fields to default, is it possible!!!
I use IE Version 6.0.2800.1106
THANK YOU
Best regards
howmad23 :-)
16 years ago
JSP
Hi together,
i have implemented a J2EE application.
there are three packages
-package Front_Controller
-package Business_Delegate
and
-package Session_Facade
i want to run this application on two machines
'A' and 'B'
On machine 'A' is the "PresentationTier" with
-package Front_Controller
and
-package Business_Delegate
On machine 'B' is the "BusinessTier" with
-package Session_Facade
My QUESTION::::
-------------------------------------------------
when i use a DTO to send data between the two machines (tiers),
-where is my dto-interface (in wich package)
-where is my dto-class (in wich package)
-must i import a package
-when i must import, how can java find the
import package
i would be deeply grateful, if someone could tell me this :-)
Hrvoje Canzek
Hi together,
my problem is as follows
i have a login.jsp (username,password) when i entered this information and click on submit the form sends that data to my FrontServlet(part of my FrontController).This FrontServlet forward this information to my LoginHandler (normal class)wich checks the username and password. When it is ok, my LoginHandler creates a new session and sets (setAttribute()) a loginOK into the session.
then the Loginhandler starts my ServiceDispatcher who display the requested site to the user.
EVERYTHING WORKS FINE.
BUT, when the session is timed out, and i click on the refresh button the browser sends the login information (username,password) again to my FrontServlet wich repeats the login-procedure and displays the site again, with a new created session. That is not what i want. I want that when the session is timed out a relog-page(simple html page) should be displayed("Session is timed out, please relog!!").
Does anybody know what my problem is??
thank you in advance
Hrvoje Canzek (HOWY)
17 years ago
every JSP is part of one application and every JSP makes a lookup to find the bean.
Code example of every JSP:
---------------
<%! private Cart mybean = null;
public void jspInit()
{
try
{
InitialContext ic = new InitialContext();
Object objRef = ic.lookup("TheCart");
CartHome home = (CartHome)
PortableRemoteObject.narrow(objRef,
CartHome.class);
mybean = home.create();
}
catch (Exception ex)
{
System.out.println(ex);
}
}
%>
---------------
Step example: The first JSP makes a DB-Connection
and the second JSP(click in menu) should display the Table XY, the 3rd JSP makes an Insert into the table, and so on.
How can i implement this,so that this application uses one Stateful Session Bean. IS IT POSSIBLE???
Hi together,
i have different JSP Sites and all should use "the same" stateful session bean, how can i realize that?
thank you
Hi together,
i have different JSP Sites and all should use "the same" stateful session bean, how can i realize that?
thank you
17 years ago
JSP
Hi together, this error was thrown after i tried to connect to DB2 database with a SessionBean:
---
java.lang.ClassNotFoundException:COM.ibm.db2.jdbc.app.DB2Driver
---
Does anyone know how to load the Driver
Additional Information:
i copied my driver-file(db2java.zip) into the
<j2ee home>\lib\system directory,that didn't work
then I renamed the file into db2java.jar, that also didn't work.
In both cases i set my j2ee_classpath to that file
WHAT'S WRONG !!!
Thank you
HowyC
i got it by typing
java -Djdbc.drivers=DriverClass ApplikationName
example:
java -Djdbc.drivers=
COM.ibm.db2.jdbc.app.DB2Driver DBtest
juhu ;-)
Hrvoje Canzek
My jdbc driver is loaded :
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
System.out.println("Driver loaded");
this system.out is displayed,problem is the getConnection part !!!
???
i use the following code in my application:
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
con = DriverManager.getConnection("jdbc b2 bName","user","passwd");
my classpath :
set classpath=.;c:\SQLLIB\java\db2java.zip;
c:\SQLLIB\lib;c:\SQLLIB\java\runtime.zip;
c:\SQLLIB\java\sqlj.zip
Please help me i do not know what to do
is this username better ??
i wrote this
con = DriverManager.getConnection("jdbc b2 bname","user","passwd");
but the problem is the same
I tried this :
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
con = DriverManager.getConnection("jdbc:Db2:DbName","user","passwd");
but then this error came:
java.sql.SQLException: No suitable driver

what's wrong ???
[ Edited by Dave to remove smilies ]
[ September 18, 2002: Message edited by: David O'Meara ]