Can anybody help me with the following problem:

 

I am trying to use Intake and I have made sure that all the necessary
steps have been taken. When I compile the project, start tomcat and get
to the 

TestIntake.vm file in the browser, I get $intake.declareGroups() as
text, it is not resolved. However, when I copy the same project on some
other machine running the same version of TDK-2.2,
$intake.declareGroups() is resolved (project is NOT recompiled on that
machine.just copied).  

 

What is missing? 

 

Here are the necessary files:

 

**************************************

Error message in turbine.log

*************************************

 

[Mon Sep 22 14:58:35 GMT-06:00 2003] -- ERROR -- Could not instantiate
tool org.apache.turbine.services.intake.IntakeTool to add to the context

      Exception:  org.apache.turbine.util.TurbineException:
Instantiation failed for org.apache.turbine.services.intake.IntakeTool

      Stack Trace follows:

      java.lang.NullPointerException

      at
org.apache.turbine.services.intake.IntakeTool.<init>(IntakeTool.java:90)

      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)

      at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
ccessorImpl.java:39)

      at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
tructorAccessorImpl.java:27)

      at java.lang.reflect.Constructor.newInstance(Constructor.java:274)

      at java.lang.Class.newInstance0(Class.java:308)

      at java.lang.Class.newInstance(Class.java:261)

      at
org.apache.turbine.services.factory.TurbineFactoryService.getInstance(Tu
rbineFactoryService.java:396)

rethrown as org.apache.turbine.util.TurbineException: Instantiation
failed for org.apache.turbine.services.intake.IntakeTool

      at
org.apache.turbine.services.factory.TurbineFactoryService.getInstance(Tu
rbineFactoryService.java:400)

      at
org.apache.turbine.services.pool.TurbinePoolService.getInstance(TurbineP
oolService.java:484)

      at
org.apache.turbine.services.pull.TurbinePullService.populateWithRequestT
ools(TurbinePullService.java:474)

      at
org.apache.turbine.services.pull.TurbinePullService.populateContext(Turb
inePullService.java:406)

      at
org.apache.turbine.services.pull.TurbinePull.populateContext(TurbinePull
.java:145)

      at
org.apache.turbine.services.velocity.TurbineVelocityService.getContext(T
urbineVelocityService.java:249)

      at
org.apache.turbine.services.velocity.TurbineVelocity.getContext(TurbineV
elocity.java:156)

      at
org.apache.turbine.modules.pages.VelocityPage.doBuildBeforeAction(Veloci
tyPage.java:84)

      at
org.apache.turbine.modules.pages.DefaultPage.doBuild(DefaultPage.java:13
7)

      at org.apache.turbine.modules.Page.build(Page.java:90)

      at org.apache.turbine.modules.PageLoader.exec(PageLoader.java:123)

      at org.apache.turbine.Turbine.doGet(Turbine.java:563)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

      at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:247)

      at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:193)

      at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:243)

      at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:566)

      at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
72)

      at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

      at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:190)

      at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:566)

      at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:475)

      at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:564)

      at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.ja
va:246)

      at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:564)

      at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
72)

      at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

      at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:234
7)

      at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:180)

      at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:566)

      at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
lve.java:170)

      at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:564)

      at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:170)

      at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:564)

      at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468
)

      at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:564)

      at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
72)

      at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

      at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:174)

      at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
va:566)

      at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
72)

      at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

      at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.j
ava:1027)

      at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:
1125)

      at java.lang.Thread.run(Thread.java:534)

 

 

 

**************************************

Intake.xml (in webapps/Mohana/web-inf/conf folder)

**************************************

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE input-data SYSTEM
"http://jakarta.apache.org/turbine/dtd/intake.dtd";>

<input-data basePackage="org.mycompany.mohana.">

      <group key="participant" name="participant">

            <field key="map" name="map">

                  <rule name="maxValue" value="100"> At most 100
allowed</rule>

            </field>

      </group>

</input-data>

 

************************

TestIntake.vm (in templates/app/screens folder)

************************

 

$page.setTitle("Test Intake")

 

#set ($pargr=$intake.participant.Default)

 

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

 

 

 

</head>

 

<body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0"
marginheight="0">

 

<form name="TestIntake" method="post"
action="$link.setAction("TestIntakeAction")"> 

 

  <div align="left">

 

   <b><u><font face="$ui.sansSerifFonts" size="4">

      New archive subject

      </u></b>

 

      <br><br>

 

      <table>

            <tr>

                  #formLabel("Map number")

                  #formTextField("map" "")

            </tr>

 

      </table>

 

       <input type="submit" name="eventSubmit_doSubmit" value="Submit"
/>

  </div>

      $intake.declareGroups() 

</form>

 

 

***********************

TestIntakeAction.java (in modules/actions folder)

***********************

 

package org.mycompany.mohana.modules.actions;

 

import java.util.List;

import java.util.Date;

import java.util.GregorianCalendar;

import java.util.Enumeration;

import javax.servlet.*;

import javax.servlet.http.*;

 

import org.apache.velocity.context.Context;

 

import org.apache.turbine.services.intake.IntakeTool;

import org.apache.turbine.services.intake.model.*;

import org.apache.turbine.services.intake.TurbineIntake;

 

import org.apache.turbine.util.RunData;

import org.apache.turbine.modules.actions.VelocityAction;

import org.apache.torque.util.Criteria;

 

 

 

/**

 * This class provides a simple set of methods to

 * insert/update/delete records in a database.

 */

 

public class TestIntakeAction extends SecureAction

{

 

 

   public void doSubmit(RunData data, Context context)

        throws Exception

    {

      //Get the instance of the Intake tool being used for this request

      

      IntakeTool intake = (IntakeTool)context.get("intake");

      Group g =intake.get("participant",

data.getParameters().getString(TurbineIntake.getGroupKey("participant"))
);

 

      if (g.isAllValid() ){

        data.setMessage("All is well");

            

      } 

      else {

            data.setMessage("There were errors in your form
submission.");

      }

 

      data.setScreenTemplate("Mohana.vm");

 

    }

 

 

    /**

     * This is used in the event that the doInsert

     * above fails.

     */

    public void doPerform(RunData data, Context context)

        throws Exception

    {

        data.setMessage("Can't find the button!");

    }

}

 

**********************************************

The following lines from TurbineResources.properties are uncommented:

**********************************************

 

services.IntakeService.classname=org.apache.turbine.services.intake.Turb
ineIntakeService

# These are intake tools.

tool.request.om=org.apache.turbine.om.OMTool

tool.request.intake=org.apache.turbine.services.intake.IntakeTool

 

 

# The location of the xml file specifying valid inputs

#

# Example: org.foo.bar.MyClassLoader, org.ack.joe.YourClassLoader

#

services.IntakeService.xml.path=WEB-INF/conf/intake.xml

 

 

 

*************************************

Environment:

*************************************

 

JDK 1.4.2

TDK-2.2

Ant 1.5

Windows XP

 

 

#########################

thanking in advance

 

Mohana Ramaratnam

 

 

 

 

 

Reply via email to