Initializing application data source org.apache.struts.action.DATA_SOURCE

2003-12-26 Thread Ricky Purnomo
Hello,

I am new to Struts, and am trying to deploy to Tomcat an application that
uses mySQL as database. However I am encountering the following errors:

2003-12-24 14:28:33 StandardWrapper[/necdcstruts1:action]: Marking servlet
action as unavailable
2003-12-24 14:28:33 StandardContext[/necdcstruts1]: Servlet /necdcstruts1
threw load() exception
javax.servlet.UnavailableException: Initializing application data source
org.apache.struts.action.DATA_SOURCE
 at
org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.j
ava:1091)
 at org.apache.struts.action.ActionServlet.init(ActionServlet.java:472)
 at javax.servlet.GenericServlet.init(GenericServlet.java:256)
 at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:93
5)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823)
 at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3422)
 at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3623)
 at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8
21)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
 at
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.j
ava:307)
 at org.apache.catalina.core.StandardHost.install(StandardHost.java:788)
 at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:559
)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:401)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:718)
 at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:358)
 at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:166)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363)
 at org.apache.catalina.core.StandardService.start(StandardService.java:497)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
 at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
 at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
 at java.lang.reflect.Method.invoke(Native Method)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)

In addition to the standard jars I have put the following .jar's in
WEB-INF/lib :

commons-pool-1.1.jar
commons-dbcp-1.1.jar
mysql-connector-java-3.0.9-stable-bin.jar

but it doesn't seem to solve the problem. Please advise what else I can try
to identify and resolve the problem.

Thanks in advance,
Ricky Purnomo

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Initializing application

2002-12-10 Thread Jordan Thomas
Thanks guys,

I've got it all working.

cheers

Jordan

>:O)

-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 10 December 2002 4:40 PM
To: Struts Users Mailing List
Subject: RE: Initializing application


Oh yeh. Almost forgot.
Plugins are called when your webapp is initialised (before anyone can access
it) and are executed serially in the order you listed them in your
struts-config.

-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 10, 2002 23:36
To: Struts Users Mailing List
Subject: RE: Initializing application


Another idea would be to make use of a struts plugin. These are actually
very simple to write!

Just implement PlugIn and its init() method and add to struts-config and
bobs yer uncle.

btw: the signature of the init method changed between 1.1b1 and 1.1b2. If
you do the following trick your Plugin should work in both environments (I
havent tested it though!):



  public void init(ApplicationConfig config) throws ServletException
  {
try
{
  ActionServlet servlet =
(ActionServlet)PropertyUtils.getProperty(config,"servlet");
  init(servlet,config);
}
catch(Throwable t)
{
  throw new ServletException("Error in init(config) method",t);
}
  }

  public void init(ActionServlet servlet, ApplicationConfig config) throws
ServletException
  {
// your code here
  }

(Why I dont just use getServlet() escapes my memory. Maybe the later version
doesnt have a getServlet() in the config object?)

To add to your struts config (right down near the end of it):


  

the set-property tags are optional, but you can use them to pass parameters
to your plugin (in which you would define a setBob() method)




-Original Message-
From: David Graham [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 10, 2002 23:16
To: [EMAIL PROTECTED]
Subject: Re: Initializing application


You can define context-params in your web.xml file that will be application
init variables.  You could also setup a servlet to be loaded when the
container starts and put the code in the init() method.  See the javadocs on
the servlet.init() method it's pretty easy to get ahold of the
ServletContext.

David






>From: "Jordan Thomas" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "Struts-User" <[EMAIL PROTECTED]>
>Subject: Initializing application
>Date: Tue, 10 Dec 2002 12:54:27 +0100
>
>Hi,
>
>I want to initialize my application with some application variables. What
>is
>the best way to do this? My approach so far has been to call the init()
>method in an unmapped servlet. So everytime the server statrs up they are
>loaded into memory. The only thing is that I am not sure how to set an
>application or session variable in the init method of a servlet. How can I
>do this? Is there a better way to do this?
>
>Thanks
>
>Jordan
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>


_
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: Initializing application

2002-12-10 Thread Andrew Hill
Oh yeh. Almost forgot.
Plugins are called when your webapp is initialised (before anyone can access
it) and are executed serially in the order you listed them in your
struts-config.

-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 10, 2002 23:36
To: Struts Users Mailing List
Subject: RE: Initializing application


Another idea would be to make use of a struts plugin. These are actually
very simple to write!

Just implement PlugIn and its init() method and add to struts-config and
bobs yer uncle.

btw: the signature of the init method changed between 1.1b1 and 1.1b2. If
you do the following trick your Plugin should work in both environments (I
havent tested it though!):



  public void init(ApplicationConfig config) throws ServletException
  {
try
{
  ActionServlet servlet =
(ActionServlet)PropertyUtils.getProperty(config,"servlet");
  init(servlet,config);
}
catch(Throwable t)
{
  throw new ServletException("Error in init(config) method",t);
}
  }

  public void init(ActionServlet servlet, ApplicationConfig config) throws
ServletException
  {
// your code here
  }

(Why I dont just use getServlet() escapes my memory. Maybe the later version
doesnt have a getServlet() in the config object?)

To add to your struts config (right down near the end of it):


  

the set-property tags are optional, but you can use them to pass parameters
to your plugin (in which you would define a setBob() method)




-Original Message-
From: David Graham [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 10, 2002 23:16
To: [EMAIL PROTECTED]
Subject: Re: Initializing application


You can define context-params in your web.xml file that will be application
init variables.  You could also setup a servlet to be loaded when the
container starts and put the code in the init() method.  See the javadocs on
the servlet.init() method it's pretty easy to get ahold of the
ServletContext.

David






>From: "Jordan Thomas" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "Struts-User" <[EMAIL PROTECTED]>
>Subject: Initializing application
>Date: Tue, 10 Dec 2002 12:54:27 +0100
>
>Hi,
>
>I want to initialize my application with some application variables. What
>is
>the best way to do this? My approach so far has been to call the init()
>method in an unmapped servlet. So everytime the server statrs up they are
>loaded into memory. The only thing is that I am not sure how to set an
>application or session variable in the init method of a servlet. How can I
>do this? Is there a better way to do this?
>
>Thanks
>
>Jordan
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>


_
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: Initializing application

2002-12-10 Thread Andrew Hill
Another idea would be to make use of a struts plugin. These are actually
very simple to write!

Just implement PlugIn and its init() method and add to struts-config and
bobs yer uncle.

btw: the signature of the init method changed between 1.1b1 and 1.1b2. If
you do the following trick your Plugin should work in both environments (I
havent tested it though!):



  public void init(ApplicationConfig config) throws ServletException
  {
try
{
  ActionServlet servlet =
(ActionServlet)PropertyUtils.getProperty(config,"servlet");
  init(servlet,config);
}
catch(Throwable t)
{
  throw new ServletException("Error in init(config) method",t);
}
  }

  public void init(ActionServlet servlet, ApplicationConfig config) throws
ServletException
  {
// your code here
  }

(Why I dont just use getServlet() escapes my memory. Maybe the later version
doesnt have a getServlet() in the config object?)

To add to your struts config (right down near the end of it):


  

the set-property tags are optional, but you can use them to pass parameters
to your plugin (in which you would define a setBob() method)




-Original Message-
From: David Graham [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 10, 2002 23:16
To: [EMAIL PROTECTED]
Subject: Re: Initializing application


You can define context-params in your web.xml file that will be application
init variables.  You could also setup a servlet to be loaded when the
container starts and put the code in the init() method.  See the javadocs on
the servlet.init() method it's pretty easy to get ahold of the
ServletContext.

David






>From: "Jordan Thomas" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "Struts-User" <[EMAIL PROTECTED]>
>Subject: Initializing application
>Date: Tue, 10 Dec 2002 12:54:27 +0100
>
>Hi,
>
>I want to initialize my application with some application variables. What
>is
>the best way to do this? My approach so far has been to call the init()
>method in an unmapped servlet. So everytime the server statrs up they are
>loaded into memory. The only thing is that I am not sure how to set an
>application or session variable in the init method of a servlet. How can I
>do this? Is there a better way to do this?
>
>Thanks
>
>Jordan
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>


_
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: Initializing application

2002-12-10 Thread David Graham
You can define context-params in your web.xml file that will be application 
init variables.  You could also setup a servlet to be loaded when the 
container starts and put the code in the init() method.  See the javadocs on 
the servlet.init() method it's pretty easy to get ahold of the 
ServletContext.

David






From: "Jordan Thomas" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "Struts-User" <[EMAIL PROTECTED]>
Subject: Initializing application
Date: Tue, 10 Dec 2002 12:54:27 +0100

Hi,

I want to initialize my application with some application variables. What 
is
the best way to do this? My approach so far has been to call the init()
method in an unmapped servlet. So everytime the server statrs up they are
loaded into memory. The only thing is that I am not sure how to set an
application or session variable in the init method of a servlet. How can I
do this? Is there a better way to do this?

Thanks

Jordan


--
To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: 
<mailto:[EMAIL PROTECTED]>


_
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



Initializing application

2002-12-10 Thread Jordan Thomas
Hi,

I want to initialize my application with some application variables. What is
the best way to do this? My approach so far has been to call the init()
method in an unmapped servlet. So everytime the server statrs up they are
loaded into memory. The only thing is that I am not sure how to set an
application or session variable in the init method of a servlet. How can I
do this? Is there a better way to do this?

Thanks

Jordan


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




javax.servlet.UnavailableException: Initializing application data source org.apache.struts.action.DATA_SOURCE

2002-05-13 Thread Anthony Martin

I'm attempting to use the new Firebird SQL Driver to access my Interbase
database.  I've been using InterClient, which is a Type III driver.
Firebird SQL Driver is Type IV, which is more desirable.

Here's information about the Firebird SQL Driver:
<http://www.xlprueba.com.ar/marce/setup_fb_java.htm>

I was hoping for a drop-in replacement for InterClient, but no such luck.
Here is my struts-config.xml DataSource node:






















I can use TEST1 just fine.  But the startup phase yields the following stack
trace:

javax.servlet.UnavailableException: Initializing application data source
DataSource.TEST0
at
org.apache.struts.action.ActionServlet.initApplicationDataSources(ActionServ
let.java:850)
at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:419)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
.
.
.

I've already tested the Firebird SQL Driver outside Struts.  They have a
demonstration on their web site, and it does indeed work by itself.  I just
can't embed it here.


Anthony

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Initializing Application Scope Attributes & *.do in

2001-07-24 Thread Gregor Rayman

Hi, perhaps these are FAQ:

1) 

My application has menu structure configurable in the database. I want 
to read the structure from the database when the app starts and store
it in an application scoped bean.

To be able to read the data, I need a DataSource so I need access to
actionServlet. What is the best way to do this? I know, I can use my own
servlet inherited form ActionServlet - but is there any ohter, perhaps
more configurable way?


2) 

When I need initiazed data in my application, I usually put the
initialization into setServlet of the action which needs the data
and I thought never to need to access such data from a JSP directly.

But now I've found this problem when creating menus. 

I've created a MenuForm which holds the information about the
current location "id" and a collection of menu's children. 
MenuAction reads the id and fills the children collection, checking
whether the current user should see the menu items.
menu.jsp then displays the menu structure from MenuForm.

It works perfectly, till I try to put this menu into another JSP
via  or 

The problem is that my MenuAction does not produce the HTML, it 
*forwards* it to the menu.jsp. And forwardning seems to be forbidden
inside an include.
(Err: Cannot forward as OutputStream or Writer has already been obtained)


Is there a way, how to include a *.do generated page which internally
uses forward?

(Actually, this could be probable solved with the workflows. The action
actually does not have to forward to the jsp. I just need to let it perform
and include the jsp then)

--
gR