A Wolfe

Greenhorn
+ Follow
since Sep 08, 2003
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 A Wolfe

Oops... I'm sorry I posted in the wrong forum by mistake. I meant to post it in Tomcat forum.
16 years ago
I liked the way when a dos console window would start when starting Tomcat 4.x. But with Tomcat 5.0, it basically calls the tomcatw.exe application and an icon appears in the system tray (I'm using Windows XP home edition). Evertime I want to see system messages I have to look at the tomcat log file which is not as much convenient as having a console window showing the messages right away.
One of the menu options in the system tray icon (if you left click on it) is console monitor but every time I click on that option I get the typical win xp error dialogue box that sends the error report to microsoft. Do I need to change some configuration option etc to be able to see the console monitor window? What's causing this error? Thanks.
16 years ago
Ok, I finally got that working. For the benefit of those who may come accross samiliar problem, the issue was in Action class. It's kinda weird since I've used the same sort of code beofore and it worked fine. Here is the change I made:
I changed my getQuote method in Action class from


public String getQuote(String symbol) {
if(symbol == "sun" ) {
String s = new String("25");
return s;
}
return null;
}


to

public String getQuote(String symbol) {
if(symbol.equals("sun")) {
String s = new String("25");
return s;
}
return null;
}


So it was basically using symbol.equals("sun") instead of symbol == "sun".
I still don't get why it doesn't work either way.
[ November 17, 2003: Message edited by: A Wolfe ]
16 years ago
Santosh, I didn't understand. Please elaborate. Thanks.
16 years ago
I'm following a small test application example listed in Profressional Jakarta Struts book (ch 3). It basically involves entering a stock symbol in one jsp and getting it's current price in another jsp. So basically it comprises of two JSPs, one Action, and one ActionForm. But the problem I'm having is that after I enter the value in the text field of input.jsp and click on submit button, the quote.jsp which is supposed to show the price (being set in the Action class) does not retrieves the price. It seems to me that the ActionForm bean is not being populated and carried over to Action processing after I click submit. Here are the code snippets and my config file settings:
-- Struts-config.xml --


<struts-config>
<data-sources/>
<form-beans>
<form-bean name="lookupForm" type="myapp.LookupForm"/>
</form-beans>
<global-exceptions/>
<global-forwards>
<forward contextRelative="true" name="input" path="/input.jsp" redirect="true"/>
</global-forwards>
<action-mappings>
<action input="/input.jsp" name="lookupForm" path="/lookup"
scope="request" type="myapp.LookupAction" validate="no">
<forward name="success" path="/quote.jsp"/>
<forward name="failure" path="/input.jsp"/>
</action>
</action-mappings>
<controller/>
</struts-config>


--- input.jsp --


<html:form action="/lookup">
<html:text property="symbol" />
<html:submit value="Submit your quote"/>
</html:form>


-- ActionForm class --

package myapp;
import java.io.Serializable;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
public class LookupForm extends ActionForm implements Serializable {
private String symbol = null;
public void LookupForm(){}
public String getSymbol() {
return this.symbol;
}
public void reset(ActionMapping mapping, HttpServletRequest request) {
this.symbol = "";
}

public void setSymbol(String symbol) {
this.symbol = symbol;
}
}


-- web.xml --


<web-app>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>


-- Action class --


public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
// TODO: Write method body
String price = null;
String symbol = null;
String target = "success";
request.setAttribute("msg", "");
request.setAttribute("msg", "getting quote...");
LookupForm lookupform = new LookupForm();
lookupform = (LookupForm)form;
//lookupform.setSymbol("sun");
symbol = lookupform.getSymbol();
price = getQuote(symbol);
request.setAttribute("PRICE", price);
if(price != null) {
request.setAttribute("msg", new String("Here is the price:"));
target = "success";
}
else {
request.setAttribute("msg", new String("Invalid stock!"));
target = "failure";
}

return mapping.findForward(target);
}
}


Any idea why my ActionForm (lookupForm) is being null in execute method of Action class? Any help would be greatly appreciated. Thanks.
16 years ago
Misnad, thanks for reply. I did see the documents but it doesn't apply to my test case. I'm not using any sort of web components (JSP, servlets) to test my deployed EJBs. I'm simply testing it using a simple java class running on dos prompt. The only thing I can see relevant to my test case scenario is Replication group. I'll give that a try. Thanks again.
16 years ago

Originally posted by Nadeem Ahmad:
THANk you WOLF
Now its Clear
Lot of thanks again
Actually I met lot of peoples in interview
They thought if they are asking for a J2EE guy then it means he shud know EJB.


That is wrong. You can have a J2EE application built without even using EJBs. You see within a J2EE application, you can choose among various components depending on your need and EJBs are just one type of components choice of which optional on your part.
Nadeem, think in terms of Web server and Application server. Any application that makes use of web server and/or app server is a "J2EE application" because every web server and application server at the very least have to abide by J2EE specification. So if you are not using any web server or application server then it's not a J2EE application. But if you're using at least one of them then it qualifies to be a J2EE application.
Web server renders the presentation layer (JSP, Servlets) and some business logic. Application handles the persistence layer (database) and some business logic. You can have just a web server with JSPs and Servlets that access the database directly and it would still be a J2EE application. Or you can have just the application server to interact with database and have some console or AWT/Swing application as the front end and it would still be a J2EE application. But if you don't have any of web server or application server handling your application components then it is NOT a J2EE application.
Nizan, thanks. But not much of any help. I did change my weblogic-ejb-jar.xml to include cluster related configuration information (although the default values for related elements are already "True" so not much difference there). But I still can't test failover.
Here is the situation now: I run a java class in console to test running both managed servers. I notice that even if I'm using 7005 port to test (managed server 1 listening port), after the first test run, the second run test shows the test messages in managed server 2 (port 7010) console window instead of server 1. This means that both servers are synchronized and multicast port configuration is working and probably due to load balancing algorithm server 2 is handling the request instead of server 1. But when I shut down server 1 (mimicing as system failure) then I expect the server 2 to still handle the request but at that point I get the "CommunicationException" "Destination unreachable" error. So failover is failing.
Any ideas?
16 years ago
Folks,
I've been trying to configure a cluster with two managed servers and an admin server for a domain name clmydomain. I've successfully created the cluster and can run and stop both managed servers. Below is my configuration information:
admin server address: localhost
port: 7001
cluster name: my_cluster_1
cluster address: localhost
multicast port : 7020
multicast address: 237.0.0.1
my_managed_server_1 (first managed server) port: 7005
address: localhost
my_managed_server_2 (second managed server) port: 7010
address: localhost
I've app.jar file that includes EJBs with a session bean acting as session facade. I then use a servicelocator class to get a handle to sessiona facade object using following code:
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "weblogic");
env.put(Context.SECURITY_CREDENTIALS, "weblogic");
env.put(Context.PROVIDER_URL, "t3://localhost:7001");
I'm successfully able to deploy and test the JNDI names for the underlying datasource and all the EJBs plus session facade on managed servers.
If I deploy app.jar only to cluster (both managed servers) then I cannot succussfully get a handle to session facade and get the NameNotFoundException. If I changed the port number to 7005 in the above code (t3://localhost:7005) and my managed server 1 is running (on port 7005 obviously) then I'm able to get the session object and the data fetched from datasource successfully. If shut down managed server 1 and start managed server 2 then again I get the NameNotFoundException.
In order to get the t3://localhost:7001 part of the code to work, I have to deploy app.jar on admin server as well as the cluster but my understanding is that I don't have to deploy the app.jar to admin server itself.
I can start a managed server successfully using the startManagedServer.bat using the http://localhost:7001 url (while the admin server is running).
What am I doing wrong? Am I missing some sort of configuration somewhere that I cannot specify 7001 port in the url without deploying app.jar on admin server? I'd greatly appreciate any help. Thanks.
16 years ago
Folks, are there any good online bookshelf/libraries??? I use informit/safari books site but I have noticed that their editions of books are usually pretty old and they also don't have many popular books on J2EE/Java. I was wondering if there are any other such online bookshelves that you can subscribe to. Thanks.
17 years ago
There are many tag libraries that you can use in your JSPs. Struts, JSTL, Oracle, Weblogic so on and so forth. My question is, which one do you prefer or recommend? What are the pros and cons of using one particular tag library? Somehow I find JSTL very limited. Other tag libraries like Oracle allows you to instantiate an entity bean in your JSP while JSTL doesn't.
Thanks in advance.
17 years ago
JSP
Mark, they don't give you any gaurantees. Their market pitch is that they send your resume to the key executive people of the companies who are the decision makers in the process. And this in turn puts the candidates up above in the line even before the job is advertized or handed over to other third party recruiters.
Matt, thanks. That makes sense.
17 years ago
Anyone has every hired any such firms to aide in job search? I know there is this one firm Allen and Associates that offer such services. According to them, they advertize you as the job candidates to executives of various companies that fit your profile of desired company by sending them your resume and broadcast "marketing" sort of letter. They also offer resume coaching, interview, salary related services. According to them, most of the jobs that are advertized have too much competition so they go after job opportunities that are not advertized, and those make up 80% of the jobs.
But they charge you for their services (usually a grand or so). I'm wondering if it's worth it. What do you guys think?
17 years ago
I'm a little confused about CMP ejb create methods. I've few questions:
1- Assume that you have a CMP ejb named Product. It has four columns. Prod_id (primary key), price, desc, status. You call home.create(String prod_id) method to get hold of the product EJB object. At this point, is the data stored in the database table product? If not, exactly at what point data is stored back in the database?
2- Do you have to specifically call a particular method to store the data back to database? If so, which method do you need to call?
3- Do you need to call ejbCreate method of product ejb object too? My understanding is that all you need to call is home.create(String) method in the above and container takes care of calling the ejbCreate method in the corresponding product object. Am I right?
Thanks.