This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!

Erik Lindholm

Greenhorn
+ Follow
since Feb 26, 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 Erik Lindholm

I use this in one of my JSPs:
<jsp:useBean id="MyBean" class="mypackage.MyBean" scope="application" />
My question is:
What would this code be if I should code the same in a Servlet ?
17 years ago
JSP
I found out this myself (with some help).
I post the answer here and hope that nobody have used to much time on this.
a)
It was the IBM WS Adminserver that used port 900.
b)
It is possible to use other ports than 900.
I was so hang up in problem a), that I simple forgot to start up the EJB Server configuration.
Sorry again to have bothered you with these amateur-problems.
17 years ago
Hello.
I get the exception "com.ibm.ivj.control.node. ServerPortNumInUseException" and error message: "Specified port is already in use" when I try to start the Persistent Names Server. I use the default bootstrap-port: 900.
I can start the Persistent Names Server with another port, but then my lookup in JNDI doesn't find my entry. I have i.e tried out these entries
in the EJB lookup-panel:
Provider URL: "IIOP://localhost:1500/"
Context factory "com.ibm.ejs.ns.jndi. CNInitialContextFactory"
JNDI name "erikpackage/HelloErik"

It is just my own computer involved (localhost).
My questions are:
a)
How can I find out what other process on my machine is holding up port 900 ?
b)
Is it possible to use another port than 900 on localhost as Persistent Names Server and still get the JNDI-lookup to find my entry ?
17 years ago
At last I have solved these two problems.
Problem 1 in VAJ (4.0):
I made the statement:
System.out.println("java.library.path: " + System.getProperty("java.library.path"));
Then I knew what library-path I actually was using. I then solved the problem by copying the actual file to one of these existing directories in the library-path.
Problem 2 in WAS (4.0):
I was using the "MODULE" option of the "Module visibility". I changed this to "APPLICATION" option. Then it worked ok when I stopped and restarted my application. The "Module visibility" is set in the WebSphere Advanced Administrative Console in the folder:
Nodes
oemcomputer (in my case)
Application Server
Default Server (in my case)
17 years ago
Hello.
I am using IBM WebSphere Mqseries and the MQ base-classes in windows2000.
That means I am not using JMS-classes for MQ.
I am just using MQ on my own machine so my query-manager is "QM_oemcomputer".
My queue is "SYSTEM.DEFAULT.LOCAL.QUEUE".
My application (JSP/servlets/javabeans) worked ok some weeks, but one day I discovered 2 problems:
problem 1:
This regard just VAJ (VisualAge for Java).
The error is: java.lang.UnsatisfiedLinkError no mqjbnd02 in java.library.path
I get the error in the following statement:qMgr = new MQQueueManager("QM_oemcomputer");
I have checked that the folder for mqjbnd02.dll is in the CLASSPATH environmentvariabel.
I am testing with WebSphere Test Environment in VAJ and I have also put this folder (with mqjbnd02.dll)
in the Class Path for WTE. I have imported the neccessary MQ-classes into VAJ and is therefore not
running with jar-files.
When I try the function (from my browser as a client) for the second time I dont get the same error, but I get:
java.lang.NoClassDefFoundError on class: MQSESSION
This also happens the third time, the fourth time .....aso
I feel that everything is like it was when it was working ok, but I guess I have done something in between
that has caused the problem.
problem 2:
This regards just WAS (WebSphere Application Server).
The first time I start up my application it works ok. I then stop the application in the
WebSphere Advanced Administrative Console and then start the application again.
The application starts up ok, but when I try to run it on a browser as a client I get the error:
java.lang.UnsatisfiedLinkError ..... Native Library C:\Programfiler\IBM\MQSeries Integrator 2.0\bin\mqjbnd02.dll already loaded in another classloader
I have to boot the machine again to make my MQ-application work again.

I wonder if these two problems is caused by the same problem. I guess I somehow have messed up my classloaders.
I have found several similar problems in discussions forums on Internett, but I have not found good answers.
Can anyone in JavaRanch help me ?
17 years ago
Hello.
I am supposed to implement MQ in my application
(Windows 2000).
Is there any good publications on this topic to help me try out the software and get to know the topic ?
I have looked at IBM red-books, but could not find this kind of books there.
17 years ago
1)
I know that I have to type the URL of the protected page and not the URL of the login-page.
I have checked WAS in the "Session Manager Service"-panel for my Default-Server in node OEMCOMPUTER. The panel says that I have checked the box for "Enabling Cookies", and I have not checked the box for "Enable URL rewriting".
In the browser (Explorer) in the folder for Security I have activated Cookies for all 4 types of connections.
==> I would be thankful for more input on this problem.
2)
Looks like your answer can solve my problem here. I guess I can't try it out before 1) is solved.
Thanks.
I appriciate your answers so far, and if you or anybody else have more suggestions I would be thankful.
17 years ago
Hello.
I am using WebSphere AE and AAT. I have set up my application to show my own login-screen when the user ask for a protected URL. This login-form shows up ok.
1)
The problem is that when I push "submit" I get a blank screen on my browser with the following URL:
"http://oemcomputer:9080/j_security_check?j_username=Admin&j_password=*******&action=Login"
(The password is of course another value .....)
It seems like I don't get in touch with the Websphere servlet FormLoginServlet.
==> Should I do any kind of definition on this servlet ? I guess that this servlet is a standard websphere servlet and not a servlet I am supposed to make myself ?
2)
When I solve 1) above I suppose that websphere gives me the URL-page that I asked for (and is protected). I would need to retrieve the userid I put into my login-form. If the FormLoginServlet is a standard websphere servlet, then I can not manipulate it to add the userid to i.ex the request or an session-variable.
==> How can I bring this userid to my application ?
Some additional informastion:
a)
The login-form is supposed to be verified againt the Local OS.
b)
My login-form (method: Form based login) looks like this:
&It;HTML>
&It;head>
&It;LINK rel="stylesheet" href="/termin/brukerhandbok/termin.css">
&It;/head>
&It;BODY BGCOLOR=#C0C0C0 class=FieldBox>
&It;FieldSet>
&It;td width="100%">
&It;tr bgcolor="#cccccc">
&It;FORM
&It;METHOD="post" ACTION="j_security_check">
&It;FONT class=Heading> P´┐Żlogging &It;/FONT>
&It;BR>
&It;table align=justify>
&It;tr class=FieldBox>
&It;td class=FieldLabel>Brukerident &It;/td>
&It;td class=FieldInput>
&It;INPUT TYPE="text" NAME="j_username" Value="" SIZE="10" MAXLENGTH="25" >
&It;/td>
&It;/tr>
&It;tr class=FieldBox>
&It;td class=FieldLabel>Passord &It;/td>
&It;td class=FieldInput>
&It;INPUT TYPE="password" NAME="j_password" Value="" SIZE="10" MAXLENGTH="25" >
&It;/td>
&It;/tr>
&It;tr class=FieldBox>
&It;/table>
&It;BR>
  &It;INPUT TYPE="submit" class=Button NAME="action" VALUE="Login">
&It;/FORM>
&It;/BODY>
&It;/HTML>
17 years ago
I think that is just what I need to do.
I am quite new to this.
Could you please give me some small code-examples on how to add a Bean to a session, and then retrieve it ?
I guess I need JSP-code to add a Bean to a session, and java-kode in the servlet to retrieve it from the session.
I would appriciate some small examples ......
17 years ago
JSP
I have one quite big CommandBean that I use in the
JSPs to fill out values on the screen with USEBEAN and "<jsp:getProperty....." - tags.
The user change values in the fields and the new values are supposed to be shipped to the servlet
(Servlet-A) for being processed. The servlet will then redirect to another JSP that consist of a lot of the same fields + some new fields. This JSP will then call another servlet (Servlet-B). In some cases this scenario will continue in another 2 levels. Since I have a lot of the same fields in the JSPs, I find it best to use one big CommandBean.
I know that I can store all the variables in input-fields in the JSP of type="hidden", but this makes my JSPs very big. I would like to avoid that.
I have all together 4 JSPs and 4 servlets. I want all of these modules to be able to read this big CommandBean (with the same request values).
I learned from you that when a JSP calls a servlet there is made a new request and therefore my CommandBean is initialized.
Is there any techniques to achive what I want ?
17 years ago
JSP
Hello.
I have a JSP with this USEBEAN-tag:
<jsp:useBean id="MyCommandBean" class="mypackage.MyCommandBean" scope="session" />
The called servlet have this:
private javax.servlet.ServletContext cx;
mypackage.MyCommandBean MyCommandBean=null;
MyCommandBean = (mypackage.MyCommandBean)

cx.getAttribute("MyCommandBean");
if (MyCommandBean == null)
{
MyCommandBean=(mypackage.MyCommandBean)
java.beans.Beans.instantiate(
getClass().getClassLoader(),"mypackage.MyCommandBean");
}

request.setAttribute("MyCommandBean", MyCommandBean);
My question is this:
Why is MyCommandBean always null when the servlet is invoked from the JSP ?
I thought that the scope "session" made the Bean mentioned in the USEBEAN-tag stay in the servlet context.
Is there a way I can do a request.setAttribute - command in the JSP ?
My problem is that all the information in the CommandBean is lost when the JSP calls the servlet.
Can anyone help me ?
17 years ago
JSP
I found out of this myself.
In the servlet I initiated my FTP-bean by using the class-loader like this:
FtpBean=(mypackage.FtpBean)
java.beans.Beans.instantiate(getClass
().getClassLoader
(),"mypackage.FtpBean");
When I made the initiation like this it worked:
FtpBean = new mypackage.FtpBean();
Hello.
I have made a class for sending a file (FTP) in IBM Visual Age for Java. This works just fine when I run this as a batch application from VAJ ("Run batch ..").
When I call the same class from a Servlet I get the java.net. NoRouteToHostException. I run this from the Websphere Test Environment (WTE).
I am just FTP'ing within my own computer with the nodename "oemcomputer" and port=21. No firewalls.
This is the statements that gives the exeception:
private Socket csock = null;
private static final int CNTRL_PORT = 21;
private String server = "oemcomputer";
csock = new Socket(server, CNTRL_PORT);//<======
Should I do this different when I am starting this from a servlet or does this have to do with the WTE ?
Hello.
I have made a system with JSP/Servlets and JavaBeans. My next challenge is to implement MQ-communication. My IBM-products so far is VAJ Prof. V4.0 and WAS Single Server Ed.
1:
I guess I have to upgrade VAJ and WAS to some Enterprise editions. Correct ?
What is the name of the prerequisite products ?
2:
Do I have to learn the full complexity of EJB's in order to program MQ into my application ?
(hopefully not ....)
3:
Does anyone have some good educational material of some written material on how to learn about this topic ?
Hopefully with as much program-examples as possible....

thanks.
17 years ago
Hello.
I want to transfer a file with ftp from my java-program. This is a server-side java-program that will ftp to another server using IP-adress + userid+pw.
I would like an example of java-kode to perform this function. I need to be able to test on return-codes of the file transfer.
I want it as simple as possible with just ordinary classes in the import-statement. I use the IBM WebSphere-products.
Any suggestions ?
17 years ago