-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: Struts Hibernate Problem
PostPosted: Wed Oct 15, 2003 9:28 pm 
Newbie

Joined: Wed Oct 15, 2003 9:16 pm
Posts: 2
I'm a complete newb so bear w/ me!

I'm unable to include hibernate w/ my web app(currently using struts). The error I get is :

HTTP Status 404 - Servlet action is not available

type Status report

message Servlet action is not available

description The requested resource (Servlet action is not available) is not available.

Apache Tomcat/5.0.12

I get this error when I fire up the web app. When I remove the "plugin" from my struts-config.xml, the web app works fine. Here is my hibernate-cfg.xml:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory name="hibernate/sessionFactory">
<property name="connection.url">jdbc:mysql://172.16.0.5:3306/dlonline</property>
<property name="connection.username">testuser</property>
<property name="connection.password">password</property>
<property name="connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="show_sql">false</property>
<property name="use_outer_join">true</property>

<!-- properties for this SessionFactory only -->
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>

<!-- mapping files -->
</session-factory>
</hibernate-configuration>


I added this to the plugin section of struts-config.xml

<plug-in className="edu.arbor.util.plugin.HibernatePlugIn">
<set-property property="configFilePath" value="/WEB-INF/hibernate.cfg.xml" />
<set-property property="storeInServletContext" value="true" />
</plug-in>

and I added the class HibernatePlugIn to my project and compiled per instructions at the website http://www.hibernate.org/105.html

What am I missing? I just added a new empty class file in my WEB-INF/classes directory and called it HibernatePlugIn. Is this the wrong place. Should I have done something else. Does anyone have any examples I can look at the DON'T use JNDI. If anyone would post any code or e-mail me some at meadmaker1977@yahoo.com.

TIA

Mike B


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2003 10:23 pm 
Regular
Regular

Joined: Fri Sep 05, 2003 12:01 am
Posts: 80
Location: Bogot
Quote:
<!-- mapping files -->
???

Is that your actual hibernate.cfg.xml ?

If so, you don't seem to be really using hibernate at all cause youre not telling hibernate which classes you want to map to a db:

maybe you overlooked this part:
http://www.hibernate.org/hib_docs/refer ... uration-s6

And take a little more time to read this one to:

http://www.hibernate.org/hib_docs/refer ... lasses.htm

_________________
Mauricio Hern


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2003 10:39 pm 
Newbie

Joined: Wed Oct 15, 2003 9:16 pm
Posts: 2
micho2001 wrote:
Quote:
<!-- mapping files -->
???

Is that your actual hibernate.cfg.xml ?

If so, you don't seem to be really using hibernate at all cause youre not telling hibernate which classes you want to map to a db:

maybe you overlooked this part:
http://www.hibernate.org/hib_docs/refer ... uration-s6

And take a little more time to read this one to:

http://www.hibernate.org/hib_docs/refer ... lasses.htm


I understand that there needs to be mappings to actually use hibernate, but I can't even get started. Do you need mappings to insert hibernate as a plugin to struts? I would think that you wouldn't. I read the documents that you posted and I seem to be folowing them( as much as they relate to my web app). If you would like to send me working examples, I would appreciate it.
meadmaker1977@yahoo.com

Mike B


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 16, 2003 8:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Read the Quickstart tutorial in the official examples sections of the wiki. It should at least get you started. http://www.hibernate.org/hib_docs/examples/.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 16, 2003 1:50 pm 
Regular
Regular

Joined: Tue Sep 02, 2003 5:09 pm
Posts: 81
Location: Whitefish Montana
meadmaker wrote:
micho2001 wrote:
Quote:
<!-- mapping files -->
???

Do you need mappings to insert hibernate as a plugin to struts? I would think that you wouldn't.

Mike B


The parse will fail when creating the session factory. You can add a mapping programmatically so I think the DTD is wrong. You can use an internal DTD that removes the mapping requirement to get around that but you still need a mapping to do anything useful.

I created a Struts/Hibernate application for some presentations. You can get to it on Sourceforge. It is a complete CRUD application. The example is part of the iseries-toolkit (www.iseries-toolkit.org). In CVS download the span module. There is also a release on the releases page but CVS is a little more current.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 16, 2003 1:52 pm 
Regular
Regular

Joined: Tue Sep 02, 2003 5:09 pm
Posts: 81
Location: Whitefish Montana
I should have given a link to the presentation that explains that code:

http://www.orlandojug.org/Struts-JUG.pdf


Top
 Profile  
 
 Post subject: Re: Struts Hibernate Problem
PostPosted: Thu Oct 16, 2003 4:37 pm 
Regular
Regular

Joined: Tue Sep 16, 2003 11:35 am
Posts: 93
Location: San Francisco, CA
meadmaker wrote:
HTTP Status 404 - Servlet action is not available


Looks like you don't have Struts configured correctly since "action" is usually the name of the Struts servlet that handles all *.do URLs. You may be getting an error on startup that is preventing the servlet from starting, you should check catalina.out, the host log (in $CATALINA_HOME/logs) and any other log you might be writing to and post the exception trace here.

- Jesse


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.