Vince Lee

Greenhorn
+ Follow
since Oct 15, 2006
Merit badge: grant badges
For More
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 Vince Lee

hi,

I have recently finished writing a web application locally, and have deployed the application on a remote host. However, I am having trouble making a connection to the mysql database using hibernate. The situation is this:

1. my application runs on tomcat on server A
2. the mysql database is on a server "mysql5" that is accessible from server A using the name "mysql5". ie. i could access it in a ssh session using mysql -p -u owasclub -h mysql5 owasclub
3. in my hibernate.cfg.xml (under web-inf and root dir), I have:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<!-- mysql db settings -->
<property name="connection.url">jdbc:mysql://mysql5/owasclub</property>
<property name="connection.username">owasclub</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.password">xxxx</property>
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>

<!-- thread is the short name for org.hibernate.context.ThreadLocalSessionContext and let Hibernate bind the session automatically to the thread -->
<property name="current_session_context_class">thread</property>

<!-- this will show us all sql statements -->
<property name="hibernate.show_sql">true</property>

...
</session-factory>
</hibernate-configuration>

4. I am using the newest mysql driver (5.x)

The error that I am getting is a TransactionException, Transaction not successfully started. I currently don't have the stack trace because i don't know how to get it saved remotely.

The application used to work when the database was on localhost, so I'm wondering if there's something that has to be done extra for connecting remotely. Any information would be appreciated. Thanks.
hi, I'm new to Hibernate, and I'm running into a bit of problem when specifying my mappings.

Currently I have a UserBean class:

and my UserBean mapping file looks like:


my RankingBean class looks like:

and RankingBean's mapping file is:


so, the error i'm getting says :

INFO - Reading mappings from resource: com/uwa/beans/UserBean.hbm.xml
INFO - Mapping class: com.uwa.beans.UserBean -> tblUser
INFO - Mapping collection: com.uwa.beans.UserBean.events -> tblParticipate
INFO - Configured SessionFactory: null
INFO - Mapping collection: com.uwa.beans.UserBean.loans -> tblLoan
INFO - Mapping collection: com.uwa.beans.UserBean.rankings -> tblRanking
org.hibernate.MappingException: Repeated column in mapping for entity: com.uwa.beans.RankingBean column: userID (should be mapped with insert="false" update="false")
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:605)
...


I'm wondering if someone could tell me what the error is, because I seem to already have duplicated column="userID" in the events and loans collection mapping and it didn't complain there? thanks

[ October 30, 2006: Message edited by: Vince Lee ]

[Edited to include code tags - Paul Sturrock]
[ October 30, 2006: Message edited by: Paul Sturrock ]
ah, found out what the problem is. my dopost in the servlet was trying to redirect to another jsp, and the jsp wasn't at that location

when i first saw /app/jsp/null i thought it was trying to resolve the form attribute to one of my url patterns because it couldn't find an exact match, and wasn't able to successfully do it.

Thank you everyone for the great help and information. you've all been very patient and the information was very helpful.
17 years ago
I went and tried something, and i used a url pattern of

<servlet-mapping>
<servlet-name>ABCGenericServlet</servlet-name>
<url-pattern>/test/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ABCGenericServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

and a form action of "<%=request.getContextPath()%>/aaa.do", which resolves to "/test/aaa.do". when i submitted the form, it tells me that "The requested resource (/test/jsp/null) is not available".

Does this mean my servlets are somehow not getting translated to jsps while i've actually mapped it correctly?
17 years ago
hmm...still no luck with the modifications. this time i also tried url patterns of /appname/* and form action of "appname/aaa", "/appname/aaa", and "aaa". I am wondering if it's some kind of settings issue, like whether i need any system variables other than JAVA_HOME?

also, would anyone happen to know the class that does servlet mapping? I installed a tomcat plugin for eclipse and hopefully I would be able to debug into why it doesn't get the right page and give me a 404 response. Thanks
17 years ago
I tried changing the url-pattern (eg. taking out /servlet) and have been getting the same results. I've also tried using another version of Tomcat (5.0.28) and jvm (1.5 -> 1.4.2) and it doesn't seem to help.

my web.xml currently looks like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<display-name>test app</display-name>
<description>
This is the test application
</description>
<servlet>
<servlet-name>ABCGenericServlet</servlet-name>
<servlet-class>com.uwa.servlet.ABCGenericServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ABCGenericServlet</servlet-name>
<url-pattern>/ABCGenericServlet</url-pattern>
</servlet-mapping>
</web-app>

and the form action currently is <form action="/ABCGenericServlet" method="post">

any suggestions would be greatly appreciated. thanks
17 years ago
hi, I'm new to the forum and I'm wondering if anyone would be able to help me.

I am trying to deploy an application in tomcat 5.5.20.
As part of the deployment descriptor, I have the following:

<?xml...
...
<servlet>
<servlet-name>ABCGenericServlet</servlet-name>
<servlet-class>com.abc.servlet.ABCGenericServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ABCGenericServlet</servlet-name>
<url-pattern>/servlet/ABCGenericServlet</url-pattern>
</servlet-mapping>
...
</web-app>

and under the classes directory, I have com/abc/servlet/ABCGenericServlet.class

when i submit a form with <form action="/servlet/ABCGenericServlet" method="post">, I get the following error:

type Status report

message /servlet/ABCGenericServlet

description The requested resource (/servlet/ABCGenericServlet) is not available.

I've also tried several other uri for form action and url-pattern but can't seem to solve the problem. Any help would be greatly appreciated. Thanks
[ October 15, 2006: Message edited by: Vince Lee ]
17 years ago