In T1.cpp, I have :

void _component_Factory::doConfigure(const tnt::TntConfig& config)
{
  // <%config>
  config.config.getMember("dburl", _component_::dburl);
  // </%config>
}

It's correct for my tntnet.xml.

jm@amande:~/T1$ ecppc -v
tntnet 2.3

ecppc-compiler

usage: ecppc [options] ecpp-source

  -o filename      outputfile
  -n name          componentname
  -I dir           include-directory
  -m type          Mimetype
  --mimetypes file read mimetypes from file (default /etc/mime.types)
  -b               binary
  -bb              generate multibinary component
-i filename read filenames for multibinary component from specified file
  -z               compress constant data
  -v               verbose
  -M               generate dependency for Makefile
  -p               keep path when generating component name from filename
  -l log-category  set log category (default: component.compname)
  -L               disable generation of #line-directives

jm@amande:~/T1$

I join my files


Jean-Michel


Le 03/02/2014 18:52, Tommi Mäkitalo a écrit :
Hi,

Strange. It works for me. Either the ecppc or tntnet itself it wrong. Lets check ecppc first. Can you look at the generated T1.cpp. You should find a method:

    void _component_::configure(const tnt::TntConfig& config)
    {
      // <%config>
      config.config.getMember("dburl", _component_::dburl);
      // </%config>
    }

The Method was in the previous version:

    void _componentFactory_::doConfigure(const tnt::TntConfig& config)

This was wrong. Can you check that?

Tommi

Am 03.02.2014 18:34, schrieb Jean-Marc Choulet:
Yes and I modified T1.ecpp (add some spaces).

jm@amande:~/T1$ ls -l
total 224
-rw-rw-r-- 1 jm jm    814 févr.  3 11:05 Makefile
-rw-rw-r-- 1 jm jm    468 févr.  3 17:41 T1.ecpp
-rw-rw-r-- 1 jm jm   2661 févr.  3 11:18 tntnet.xml
jm@amande:~/T1$

jm@amande:~/T1$ make
/opt/publiweb/bin/ecppc   -o T1.cpp T1.ecpp
g++ -I/opt/publiweb/include -fPIC -O2   -c -o T1.o T1.cpp
g++ -o T1.so T1.o -shared -L/opt/publiweb/lib -ltntnet -lcxxtools
rm T1.cpp
jm@amande:~/T1$

jm@amande:~/T1$ make test
/opt/publiweb/bin/tntnet tntnet.xml
2014-02-03 18:34:20.73341 [8376.46975739840704] INFO tntnet.listener -
listen ip= port=8000
2014-02-03 18:34:20.73355 [8376.46975739840704] INFO tntnet.tntnet -
create 5 worker threads
2014-02-03 18:34:36.91391 [8376.46975741957888] INFO tntnet.worker -
request GET / from client 172.20.212.238 user-Agent "Mozilla/5.0 (X11;
Ubuntu; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0" user ""
2014-02-03 18:34:36.91427 [8376.46975741957888] INFO tntnet.comploader -
load library "T1"
2014-02-03 18:34:36.91460 [8376.46975741957888] INFO tntnet.comploader -
library "./T1.so"
2014-02-03 18:34:36.91469 [8376.46975741957888] ERROR component.T1 -
DBURL :
2014-02-03 18:34:36.91471 [8376.46975741957888] INFO tntnet.worker -
request GET / ready, returncode 200 OK - ContentSize: 138

Jean-Michel

Le 03/02/2014 18:28, Tommi Mäkitalo a écrit :
Am 03.02.2014 17:54, schrieb Jean-Michel Caricand:
Tommi,

You were right. I deleted all the old libraries and now it works.

But I still have the same problem for configuration variables.
...
Hi,

did you delete the generated source? I mean the .cpp files generated
from .ecpp by ecppc. The bug was in ecppc and hence you have to rerun ecppc.

Tommi

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general



------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk


_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

////////////////////////////////////////////////////////////////////////
// T1.cpp
// generated with ecppc
//

#include <tnt/ecpp.h>
#include <tnt/httprequest.h>
#include <tnt/httpreply.h>
#include <tnt/httpheader.h>
#include <tnt/http.h>
#include <tnt/data.h>
#include <tnt/componentfactory.h>
#include <tnt/comploader.h>
#include <tnt/tntconfig.h>
#include <cxxtools/log.h>
#include <stdexcept>

log_define("component.T1")

// <%pre>
#line 1 "T1.ecpp"

// put your includes here
// #include "foo.h"

// </%pre>

namespace
{
class _component_ : public tnt::EcppComponent
{
    _component_& main()  { return *this; }

  protected:
    ~_component_();

  public:
    _component_(const tnt::Compident& ci, const tnt::Urlmapper& um, tnt::Comploader& cl);

    unsigned operator() (tnt::HttpRequest& request, tnt::HttpReply& reply, tnt::QueryParams& qparam);
    // <%config>
    static std::string dburl;
    // </%config>

};

class _component_Factory : public tnt::EcppComponentFactoryImpl<_component_>
{
  public:
    _component_Factory()
      : tnt::EcppComponentFactoryImpl<_component_>("T1")
      { }
    tnt::Component* doCreate(const tnt::Compident& ci,
      const tnt::Urlmapper& um, tnt::Comploader& cl);
    virtual void doConfigure(const tnt::TntConfig& config);
};

tnt::Component* _component_Factory::doCreate(const tnt::Compident& ci,
  const tnt::Urlmapper& um, tnt::Comploader& cl)
{
  return new _component_(ci, um, cl);
}

void _component_Factory::doConfigure(const tnt::TntConfig& config)
{
  // <%config>
  config.config.getMember("dburl", _component_::dburl);
  // </%config>
}

static _component_Factory factory;

static const char* rawData = "\014\000\000\000\205\000\000\000\226\000\000\000<!DOCTYPE html>\n<html>\n <head>\n  <titl"
  "e>ecpp application T1</title>\n </head>\n <body>\n  <h1>T1</h1>\n  <p>Hello world!</p>\n </body>\n</html>\n";

// <%shared>
// </%shared>

// <%config>
std::string _component_::dburl;
// </%config>

#define SET_LANG(lang) \
     do \
     { \
       request.setLang(lang); \
       reply.setLocale(request.getLocale()); \
     } while (false)

_component_::_component_(const tnt::Compident& ci, const tnt::Urlmapper& um, tnt::Comploader& cl)
  : EcppComponent(ci, um, cl)
{
  // <%init>
  // </%init>
}

_component_::~_component_()
{
  // <%cleanup>
  // </%cleanup>
}

unsigned _component_::operator() (tnt::HttpRequest& request, tnt::HttpReply& reply, tnt::QueryParams& qparam)
{
  log_trace("T1 " << qparam.getUrl());

  tnt::DataChunks data(rawData);

  // <%cpp>
#line 13 "T1.ecpp"

// put your C++ code here

  reply.out() << data[0]; // <!DOCTYPE html>\n<html>\n <head>\n  <title>ecpp application T1</title>\n </head>\n <body>\n  <h1>T1</h1>\n  <p>Hello world!</p>\n
#line 27 "T1.ecpp"
 log_error("DBURL : " << dburl);

  reply.out() << data[1]; //  </body>\n</html>\n
  // <%/cpp>
  return HTTP_OK;
}

} // namespace
<?xml version="1.0" encoding="UTF-8"?>
<!--
  This is the main configuration file for tntnet.

  You can find documentation about the parameters in the man page tntnet.xml(7)
  -->
<tntnet>
  <dburl>my dburl</dburl>
  <mappings>
    <!-- map / to T1@T1 -->
    <mapping>
      <target>T1@T1</target>
      <url>^/$</url>
    </mapping>
    <!-- map /comp.* or /comp to comp@T1 -->
    <mapping>
      <target>$1@T1</target>
      <url>^/([^.]+)(\..+)?</url>
    </mapping>
  </mappings>

  <!-- listen to a port (empty string means any local interface) -->
  <listeners>
    <listener>
      <port>8000</port>
    </listener>
  <!-- a certificate enables ssl -->
  <!--
    <listener>
      <port>8443</port>
      <certificate>tntnet.pem</certificate>
    </listener>
    -->
  </listeners>

  <logging>
    <rootlogger>INFO</rootlogger>

    <loggers>
      <logger>
        <category>tntnet</category>
        <level>INFO</level>
      </logger>
      <logger>
        <category>component.T1</category>
        <level>INFO</level>
      </logger>
    </loggers>

    <!--
    <file>tntnet.log</file>
    <maxfilesize>10M</maxfilesize>
    <maxbackupindex>2</maxbackupindex>
    -->

  </logging>

  <!-- <maxRequestSize>65536</maxRequestSize> -->
  <!-- <maxRequestTime>600</maxRequestTime> -->
  <!-- <user>tntnet</user> -->
  <!-- <group>tntnet</group> -->
  <!-- <dir>/</dir> -->
  <!-- <chrootdir>/var/safedir</chrootdir> -->
  <!-- <pidfile>/var/run/tntnet.pid</pidfile> -->
  <!-- <daemon>0</daemon> -->
  <!-- <minThreads>5</minThreads> -->
  <!-- <maxThreads>100</maxThreads> -->
  <!-- <threadStartDelay>10</threadStartDelay> -->
  <!-- <queueSize>1000</queueSize> -->
  <!--
  <compPath>
    <entry>path1</entry>
    <entry>path2</entry>
  </compPath>
   -->
  <!-- <socketBufferSize>16384</socketBufferSize> -->
  <!-- <socketReadTimeout>10</socketReadTimeout> -->
  <!-- <socketWriteTimeout>10000</socketWriteTimeout> -->
  <!-- <keepAliveTimeout>15000</keepAliveTimeout> -->
  <!-- <keepAliveMax>1000</keepAliveMax> -->
  <!-- <sessionTimeout>300</sessionTimeout> -->
  <!-- <listenBacklog>64</listenBacklog> -->
  <!-- <listenRetry>5</listenRetry> -->
  <!-- <enableCompression>no</enableCompression> -->
  <!-- <mimeDb>/etc/mime.types</mimeDb> -->
  <!-- <minCompressSize>1024</minCompressSize> -->
  <!-- <maxUrlMapCache>8192</maxUrlMapCache> -->
  <!-- <defaultContentType>text/html; charset=UTF-8</defaultContentType> -->
  <!-- <accessLog>/var/log/tntnet/access.log</accessLog> -->
  <!-- <errorLog>/var/log/tntnet/error.log</errorLog> -->
  <!-- <maxBackgroundTasks>5</maxBackgroundTasks> -->
  <!-- <server>Tntnet</server> -->
</tntnet>
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to