You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Michael Griffith <mi...@yahoo.com> on 2002/07/01 21:15:02 UTC

unknown service PoolBrokerService...(Config problem?)

Hello, 

I am new to Turbine, and I seem to have a configuration problem. I
searched the FAQ's but could not find a message that might help me solve
this problem.

I have a JSP that is trying to get a DB connection... It looks like
this:

<%
try{
    %>
    <p>Creating the connection
    <%
    System.out.println("Creating the connection");
    DBConnection conn= TurbineDB.getConnection();
    System.out.println("Creating the statement");
    PreparedStatement stmt= conn.prepareStatement("select * from
LociData");
    System.out.println("Executing the query.");
    ResultSet rs= stmt.executeQuery();

    if( rs.next() ){
      out.println("Result Set Found!");
    }else{
      out.println("Result not found.");
    }

    rs.close();
    stmt.close();
    TurbineDB.releaseConnection(conn);

  }catch( Exception e ){
    e.printStackTrace();
  }
%>

When trying to access the Connection pool from this JSP page I get the
following stack trace error:
org.apache.turbine.services.InstantiationException: ServiceBroker:
unknown service PoolBrokerService requested at
org.apache.turbine.services.BaseServiceBroker.getServiceInstance(Base
ServiceBroker.java:356)
        at
org.apache.turbine.services.BaseServiceBroker.getService(BaseServiceBrok
er.java:298) at
org.apache.turbine.services.db.TurbineDB.getPoolBroker(TurbineDB.java:30
9) at
org.apache.turbine.services.db.TurbineDB.getConnection(TurbineDB.java:16
9)   at org.apache.jsp.SmokeTest$jsp._jspService(SmokeTest$jsp.java:86)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)...

I have a servlet that loads on the startup of Tomcat, that is supposed
to initialize the connection pool -- it looks like this:

public class TurbineInit extends HttpServlet implements
SingleThreadModel {
  private static final String CONTENT_TYPE = "text/html";
  /**Initialize global variables*/
  public void init() throws ServletException {

    String prefix= getServletContext().getRealPath("/");
    String dir= getInitParameter("turbine-resource-directory");
    TurbineConfig tc= new TurbineConfig( dir,
"TurbineResources.properties");
    System.out.print("Initializing Turbine with Config:"+ tc);
    Enumeration enum= tc.getAttributeNames();
    System.out.println("Attributes: " + enum);
    while( enum.hasMoreElements() ){
      String attr= (String) enum.nextElement();
      if( attr != null ){
	System.out.println("Atribute: " + attr + tc.getAttribute(attr)
);
      }
    }
    tc.init();

  }

I am trying to connect to a MS-SQL7 DB using the SQL-Server JDBC driver
downloaded from the MS web site. The properties file looks like this:

database.default.driver=com.microsoft.jdbc.sqlserver.SQLServerDriver
database.default.url=jdbc:microsoft:sqlserver://local:1433;DatabaseName=
Loci;User=LociUser;Password=master
database.default.username=LociUser
database.default.password=master


I included the MS-jars in my war file and the init method seems to be
initializing turbine, however, When I try to look at the attributes in
the above code, I see nothing in the console...

Can anyone point me in the right direction? I copied the turbine and
velocity jar files to the /JAR file under my TomCat4.04 install
directory -- I think I need to do something else to initialize turbine,
but I am not sure.

Cheers!

Michael Griffith




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>