leo jacob

Greenhorn
+ Follow
since May 02, 2011
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
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by leo jacob

My web application is running properly if i start the tomcat server 7 from Tomcat\bin -  Tomcat7.exe .

But it is not working properly if I start the tomcat from windows services .

Not able to get any clue from net.  
4 years ago
Hi,

Let me put full details of my problem:

I am not able to connect with my database by using jndi in tomcat 7 and I am not able to get where am I wrong in my configuration. The applications with these details are working fine in tomcat 4 but it is giving problem in tomcat 7 for database connection. I have placed the web application at webapps folder and the context file at -- application/WebContent/META-INF/context.xml

Details:
Java class:



web.xml




Context.xml




Error Details :



Any help is highly appreciated.

Thanks in Advance



8 years ago

Thanks Tim for your reply.

Please let me know the meaning of RTFM.

I have configured this mapping in web.xml file and it is working fine in tomcat 4. I am facing problem in Tomcat 7.

Code in web.xml is like this :




my application is not able to read the context file thats why I am not able to connect to the database as I am getting the message : "Database connection was refused". That I have printed from my java class mentioned in my first mail.

I feel it is the issue of the location and naming convention of context file .

Thanks






8 years ago
Hi,

I am working on a web application. I have placed it in webapps folder and the context file (application.xml) at Tomcat 7.0\conf\Catalina\localhost. I have configured the database connection in context file (application.xml). My Context file is as follows

<Context path="/application" docBase="application" debug="0" privileged="true">
<ResourceParams name="jdbc/APPLICATIONDataSource">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@120.120.40.90:1521:SERF</value>
</parameter>
<parameter>
<name>username</name>
<value>User1</value>
</parameter>
<parameter>
<name>password</name>
<value>Password1</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>10</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>-1</value>
</parameter>
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
<parameter>
<name>logAbandoned</name>
<value>true</value>
</parameter>
</ResourceParams>
<Logger className="org.apache.catalina.logger.FileLogger" prefix="APPLICATION." suffix=".log" timestamp="true"/>
</Context>


I am using jndi for database connectivity

package com.company.util;

import java.sql.*;
import javax.sql.*;
import javax.naming.*;


public class DBUtil
{

public static Connection getConnection() throws NamingException {
Connection objConnection=null;
try{
Context objInitCtx = new InitialContext();
Context objEnvCtx = (Context) objInitCtx.lookup("java:comp/env");
DataSource objDS =
(DataSource) objEnvCtx.lookup((String) objEnvCtx.lookup("DataSourceName"));
objConnection = objDS.getConnection();
//System.out.println("Got Connection");

}catch(SQLException e){
System.out.println("Database connection was refused");

}
return objConnection;

}
}


The application is working fine in tomcat 4 but it is not getting database reference in Tomcat 7.


Any idea to resolve this issue will be highly appreciated.

Thanks



8 years ago
Hi,

I am working on a web application. Application is having role based access. If some one logged into this application and then copy the url and paste it to another or same browser , application is opening from there without asking for authentication. I want to restrict the same as it is a security threat for the application.
I am using struts2 framework with glassfish server.

Please let me know any way to implement restriction. Thanks in advance.
9 years ago
Hi,

I want to debug my j2ee application. Any idea regarding the same will be highly appreciated.

My Environment is

J2ee , Struts2.x , Eclipse Indigo , Glassfish Server


Thanks in Advance.
9 years ago
Hi,

I have deployed a web application in glassfish server in Linux environment. It is working fine in windows environment but in Linux it is showing some issues regarding Sessions. It is not capturing data in session. For example in my application user name is displaying as welcome User and here I am using session to store user name. It is appearing correct in windows OS but not showing in linux environment. I am not able to get the reason. Any help is highly appreciated.

My code related to session is as follows:

JSP:

import javax.servlet.http.HttpSession;

public class LoginAction extends ActionSupport implements SessionAware,
ServletRequestAware,ModelDriven {

private Map session;

public void setSession(Map session) {
this.session = session;

}

@SuppressWarnings("unchecked")
public Map<String, List<String>> getSession() {

return session;

}
session.get("userId");


}




10 years ago
Hi,


I want to test my web application (Struts2.3) with Junit. I am using Eclipse indigo for application development.

I am very new to Unit testing. Any help regarding the basic installation, testing environment creation and execution is highly appreciable.

Thanks in advance.
10 years ago

Mohana Rao wrote:Add these lines in struts.xml

<global-results>
<result name="exception">jsp/common/error.jsp</result>
</global-results>

<global-exception-mappings>
<exception-mapping exception="java.lang.Exception"
result="exception" />
</global-exception-mappings>




Thanks Mahana!

I have done the same but still i am facing the same issue.
10 years ago
Hi,

I am working on struts2 app. I have configured few global exceptions (500, 404, java.io.FileNotFoundException,java.io.IOException) in web.xml file.
It is working fine in Mozilla browser but in other browsers it is not working i.e. chrome,Internet Explorer 8,9 etc. Here it is showing "The website cannot display the page" for 500 error.

Also i will appreciate if any one can provide any link to explore global exception in struts 2.
Any help is highly appreciable

Thanks in Advance
10 years ago
Hi Gani,

Check whether your application is able to read web.xml. Make sure your web.xml is in Web-Inf folder. If both the things are ok then paste the error and web.xml with your issue.
11 years ago
Hi,

I am new to Struts. I am working on a small example of struts2. I am getting following warning.


WARNING: No configuration found for the specified action: 'login.action' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
Jun 2, 2011 1:31:09 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: No configuration found for the specified action: 'login.action' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
Jun 2, 2011 1:32:11 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: No configuration found for the specified action: 'login.action' in namespace: '/'. Form action defaulting to 'action' attribute's literal value.
Jun 2, 2011 1:32:11 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: No configuration found for the specified action: 'login.action' in namespace: '/'. Form action defaulting to 'action' attribute's literal value.


Entry in Struts.xml is like this;

Struts.xml

<package name="default" extends="struts-default" namespace="/">



Any help is highly appreciated.

11 years ago
Hi Robin,

thanks for your reply.

I want to read the txt file word by word so that i can store the content of my file in particular columns of my database table. For example name in name column of table, Some figures in number column of my table.

Please find the program that I am using for file reading and writing as a whole.

Also I am attaching my txt file that needs to be captured in database

------------------------------------------------------------------------------------------------------



=====================================================================

File that needs to be read:




31/03/10 222.07


CANCARD NO.
Parminder kaur 4862930100539003
A-22, Frazer Town
GandhiNagar ###
Gujrat 130001
ABC :12345:12:1111:11111













Parminder kaur
1234567893 690000.00 200007.94



01/01/10 to 01/02/10 01/01/10 01/02/10 120000



01/01/10 1234561 ABC Pvt Ltd. , Bangalore , AS 2234.00
01/02/10 12348 PAYMENT RECEIVED, THANK YOU 1780.00CR




Rupees 123.05 will be debited to your a/c 12345665 with Our
Gandhi Nagar(ABC) branch on 01/01/10



12341.76 345671.06 40.00 1234.77 123



1234 123 0 1234 123.66


Additional Points redemption revised! Min Bonus Points 49.

Additional Points got revised. Points are 333.











31/03/10 123.55


Another Record
11 years ago
hi,

I want to read a file and capture its content into the database in particular columns. Please suggest me how to read and capture particular data from text file for particular fields in database. Thanks in Advance. My text file is like this and it is having multiple records like this

10/03/11 562.06


PAN NO.
Ravi Khanna 123430678003
A-11, Mekhri Circle
Bangalore
Karnataka ###
Bangalore 130001
ABC :1234567890













Ravi Khanna
123456782345 600000.00 200437.94



11 years ago
Thanks Mohan and Subramani for the reply. The problem got resolved. It was an issue with web.xml.
11 years ago