This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Learn Java with Math: Using Fun Projects and Games and have Ron Dai on-line!
See this thread for details.
Win a copy of Learn Java with Math: Using Fun Projects and Games this week in the Beginning Java forum!

ishan dave

Ranch Hand
+ Follow
since Apr 16, 2007
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 ishan dave

Hi Maneesh,

Thank you very much for your reply.

With best regards,
Ishan
8 years ago
Hi All,

Currently I am developing an application where I have a menubar with menuitems.

For example
Customer
Create New
Edit
View

Vehicle
Add New
Update

now for this application I have a jFrame(This is the main container of my application) and have 5 jPanel corresponding to every menuitem i.e. CreateNewCustomerPanel, EditCustomerPanel, ViewCustomerPanel etc

and what try to achieve is on click of the menuitem want to show the corresponding panel. so for that following is my code



Now when I run my application and click on "Create New" menuitem nothing is being shown but if I minimize the application and maximize it again it'll show me the new jPanel i.e. createCustomer. It should load at the time of menuitem click.

Can any one please help to solve this that how can I manage to open createNewCustomerPanel on the first time click on the button only.

Thank you very much in advance.

Thank you,
Ishan
8 years ago

Peter Johnson wrote:Sorry, but I don't know Jersey, you are on your own there.

You might try taking a thread dump when there are two requests in process - you should see two threads processing the requests. Look at the code shown in the thread call stacks, that should give you a clue. (Depending on how quickly your code processes the requests you might have to take multiple thread dumps before you catch the culprit.)



Thank you Peter for your reply.

In fact yesterday I downloaded jMeter and after generating concurrent requests from it everything seems right. Than checked my client code and the problem is there. In one thread I forgot to raise the exception in stead I catch it and this is the place where my application hangs.

Finally solved the issue.

In fact your reply opens a door for me to think on the lines other than jBoss and able to solve the issue.

Thank you very much for your valuable inputs.

With best regards,
Ishan
8 years ago

Peter Johnson wrote:You have not limited the number of http connections, and 75 connections for the database is more than enough. So the problem has to be either in your code (locking, overuse of synchronized) or with Jersey.



Hey Peter Johnson,

Thank you very much for your valuable reply. I check with my code there is no synchronizing stuffs so will you please tell what should I check or look with Jersey ?

Thank you,

With best regards,
Ishan
8 years ago
Hi All,

I am facing a wired problem in jBoss AS. We deployed a RESTfull web service application developed using Java and Jersey and deployed the war in jBoss AS Version 6.0

I call this web service from different J2ME clients. But my jBoss serves one client at a time

for example if I call the same web service from 3 different mobiles then the jBoss serves one after another. We are writting the logs where we write the name of device and it shows that jBoss is not handling the requests concurrently instead it serves one after another.

I am very new to jBoss so I am sure that its my mistake and I am missing some configuration or something to achieve concurrency. Please help me to solve this.

My server.xml is as follows.


and datasource.xml is



Please guide me to solve this issue.

Thank you very much in advance.

With best regards,
Ishan
8 years ago

Aditi agarwal wrote:hi
my problem is bit typical to understand sopls feel free to ask if any doubts in that

actually i have 3 files one.jsp, two.jsp, three.jsp
i want to call

three.jsp after clicking one submit button of one.jsp but in between the action of two.jsp should also be called

please reply about this query

thank you



Hi,

I am not sure but action chaining might help you.

http://struts.apache.org/2.2.1.1/docs/action-chaining.html

regards,
Ishan
8 years ago
Hi All,

I am facing a problem for combining <jsp:include> and struts 2.2.1. At the time of calling the action of included jsp, we don't want to call the redirect according to included jsp's action.

include_login.jsp
<%@ taglib prefix="s" uri="/struts-tags" %>
<table>
<tr>
<td >
<div>
<s:text name="global.hi.message" /> <s:property value="%{#session.userName}"/> 
<s:a action="loginAction" method="doLogout" id="logout"><s:text name="global.logout.name" /></s:a> 
</div>
<div id="login">
<div>
<s:actionerror id="login_err_div" cssStyle="vertical-align: text-bottom;" />
</div>
<div>
<s:textfield name="userName" value="Login"/>
<s:password name="password"/>
<s:submit key="global.loginbutton.name" action="loginAction" method="doLogin"/>
</div>
</div>
</td>
</tr>
</table>


some portion of struts.xml
<action name="loginAction" class="somepackage.LoginAction">
<result name="input">index.jsp</result>
<result name="success">index.jsp</result>
</action>

<action name="searchAction" class="somepackage.SearchAction">
<result name="input">/view/search/searchBox.jsp</result>
<result name="success">/view/search/searchResult.jsp</result>
<result name="detail">/view/search/vehicleDetail.jsp</result>
<result name="loginpopup">/view/user/login.jsp</result>
<result name="error">/view/common/error.jsp</result>
</action>

Now I include this page in other pages like register.jsp, search.jsp, favorites.jsp etc

search.jsp
<html class="cufon-active cufon-ready" xmlns="http://www.w3.org/1999/xhtml">
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>
<body >
<table>
<tr>
<td>
<jsp:include page="/view/common/include_login.jsp"/>
</td>
</tr>
<tr>
<td>
<s:text name="global.searchpage.until.label1"></s:text>  
<select class="w120" name="fromYear" id="fromYear">
<option value="2005" selected="selected">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010">2010</option>
<option value="2011">2011</option>
</select>
</td>
</tr>
<tr>
<td>
<s:text name="global.searchpage.until.label2"></s:text>  
<select class="w120" name="toYear" id="toYear">
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010">2010</option>
<option value="2011" selected="selected">2011</option>
</select>
</td>
</tr>
<tr>
<td>
<s:submit action="searchAction" method="search" value="Submit"/>
</td>
</tr>
</table>

So the question is when ever we click the Login button from any page it will redirect "input" of loginAction but we don't want to do that, If login is success we want the control of the page should not go out side the page. I mean on successfull login it should call input of searchAction in called from search.jsp, input of registerAction if called from reagister.jsp etc.

for example if a user in search.jsp page and search some data, now he wants to log-in so he provide username and password and when hi clicks the Login button, after login he should able to see the same search.jsp page (with login successfull message). But at present if we click on Login button it will redirect the control to input of loginAction.

In short we want to call the methods and do stuff from the loginAction but don't want to redirect to any other page. So the name of action should be provided dynamically according to the parent page from which login button is clicked.

If any further information is required than please feel free to ask.

Thank you very much for your time and help in advance.

Thank you,
Ishan
8 years ago
i am not able to see the images of your tables
hi,
may know your DDL of both the tables.

Do you have Address_id column in your Student tale ?
if not then please put that.

and please make sure that you checked the auto-increment on in both your tables in mysql.


thank you,
ishaan
hi,

@ManyToOne(cascade = CascadeType.ALL)
public Address getStudentAddress() {
return this.studentAddress;
}

please put the join column name like

@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name="ADDRESS_ID")
public Address getStudentAddress() {
return this.studentAddress;
}

thank you,
ishaan
Hi Nick,

you need to take an object array and fetch these three object.

now iterate to your array and caste them.

This is the most simplest way I think for your requirement.

thank you,
ishaan
Hi Ashok,

java.lang.ClassNotFoundException: oracle.jdbc.diver.OracleDriver

the problem is with the spelling of driver
it should be

oracle.jdbc.driver.OracleDriver

in addition
please make sure that the jar you added is not corrupted and you placed it in proper way. I mean for galileo
right click on project -> build path -> configure build path -> select libraries tab -> Add External Jars

if still problem is there please provide your configuration file as well.

thank you,
ishaan
hi Samanthi,

the problem is at
# SEVERE: Duplicate entry '5' for key 1
# Jan 30, 2010 10:09:16 AM org.hibernate.event.def.AbstractFlushingEventListener performExecutions
# SEVERE: Could not synchronize database state with session
# org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update

for resolving this you need to change the id of you entity as you said. for that you need to use
@GeneratedValue annotation for generating your id every time you persist them.

it should be like this
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
Integer id;

this way your ids will be generated automatically, there some other strategies also available for Id generation like
Identity, Sequence and Table
here what I think is some are database dependent so Table strategy is the best one and most suitable to my requirement.

if you want know more about other attributes then please try some googling like Id generation in JPA or refer the docs or post reply and I will get back with more details

thank you,
ishaan


Marco Ehrentreich wrote:Well, since you are really experiencing incompatibility issues during the migration process it may make sense to use two Tomcat versions meanwhile.

Basically you have to take care that each Tomcat uses a few ports (depending on the configuration). So you have to deal with conflicting ports, i.e. choose different one for each Tomcat instance, if you plan to run Tomcat on the same machine.

If you have a look at the Tomcat startup script in $TOMCAT_HOME/bin/catalina.sh you will quickly see that Tomcat recognizes quite some environment variables. So usually it should be enough to point JAVA_HOME and JRE_HOME to right JDK location in your init script or before you startup Tomcat. Depending on your OS and/or Linux distribution the startup and initialization process might work slightly different but the basics should be as described.

I hope this helps to solve your problem!

Additional note: According to the Tomcat documentation Tomcat 6 should be able to run with Java 5 and 6! So at least you don't have to deal with different Tomcat versions to use Java 5 and Java 6.

Marco



Dear Marco,

Thank you very very much.

You really provide me the solution which I am looking for.

Thank you again,
Ishaan
9 years ago
Dear Marco,

Thank you for your inputs, Well definitely we are the process to upgrade our application but mean while we don't want it to stop so for the temporary solution I go for the two instances of Tomcat.

so will you please help me out that how can I configure to instance, I mean how can I ask Server1 to point to Java5 and server2 to point to java6.

Thank you in advance.

Dear Ulf,

Actually I faced some problems with sql.Date and some request handling stuffs, again I am testing my application for both the versions.

And in fact the solution provided by Marco sounds good to fulfil my present requirements.

Thank you,
Ishaan
9 years ago