1

I have a web application jsp, servlet is a content manager for aiml in which users can register questions and answers. Then the system, in theory, should with a single button compile the bd to aiml and create the bot.

The problem is that even when compiling the bot, it does not respond to the new questions.

I am using google AB for AIML in Java.

The bot folder is inside WEB-INF

If I compile out of tomcat as if it were a normal java app, it correctly generates the files and responds based on the new questions.

If I launch the compilation of the bot from a servlet, it does the compilation but the bot does not use the new questions and answers.

The question is that it does not give any apparent error.

You are totally right. I'm going to try to explain it better.

I am using AB Google to compile and use an AIML bot in a web application with jsp and servlet.

TOMCAT 8 and JAVA 8 as environment

<dependency>
    <artifactId> com.google </ artifactId>
    <groupId> Ab </ groupId>
    <version> 0.0.4.3 </ version>
</ dependency>

directory of bot files: WEB-INF / bots          When I compile and execute in java the aiml file

public class AddAiml {

    / **
     * @param args the command line arguments
     * /
    private static final boolean TRACE_MODE = true;
    static String botName = "super";
 
    public static void main (String [] args) {
        try {
 
            String resourcesPath = getResourcesPath ();
            System.out.println (resourcesPath);
            MagicBooleans.trace_mode = TRACE_MODE;
            
            Bot bot = new Bot (botName, resourcesPath);
             
            bot.writeAIMLFiles ();
 
        } catch (Exception e) {
            e.printStackTrace ();
        }
    }
 
    private static String getResourcesPath () {
        File currDir = new File (".");
        String path = currDir.getAbsolutePath ();
        path = path.substring (0, path.length () - 2);
        System.out.println (path);
        String resourcesPath = path + File.separator + "src" + File.separator + "main" + File.separator + "webapp" + File.separator + "WEB-INF";
        return resourcesPath;
    }
    
    
    
}

This generates a correct bot and I can call it later in my servlet

 

protected void processRequest (HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        HttpSession session = request.getSession (false);
        if (session! = null) {
            String action = request.getParameter ("url");
            if (accion.equals ("chatbot")) {
                ServletContext sc = session.getServletContext ();
                BotUpo botUpo = new BotUpo (sc.getResource ("WEB-INF"). GetPath ());

                session.setAttribute ("upobot", botUpo);

                RequestDispatcher rd = sc.getRequestDispatcher ("/ admin / chatbot.jsp");
                rd.forward (request, response);
            }
        }

    }

Well up here all right. I have created a small content manager where users enter questions and answers. And in a section of the administration, I added a button to recompile the bot aiml.

 ServletContext sc = getServletContext ();
String resourcesPath = sc.getResource ("WEB-INF"). GetPath ();
                MagicBooleans.trace_mode = TRACE_MODE;
                Bot bot = new Bot (botName, StringUtils.removeEnd (resourcesPath, "/"));

                bot.writeAIMLFiles ();

After recompiling the bot it is not able to answer any question.

The only conclusion that arrived is that it should be a problem that compiles in the web tomcat application does not allow loading those files.

aruetre
  • 46
  • 5
  • 1
    "The question is that it does not give any apparent error." is not a question, it's a vague description of your problem. You need to provide more and relevant information if you hope to get help. – Kayaman May 28 '18 at 11:53
  • I have tried to explain myself better – aruetre May 28 '18 at 14:29

0 Answers0