Quantcast

PHP and Grails integration throws error when Building WAR

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

PHP and Grails integration throws error when Building WAR

owen Rubel
Hi all,

Still continuing my mad science experiment and need a little help.

Building my class for quercus in grails runs fine when I do a 'run-app' but when I do a 'run-war', I continually get an error like so:

class com.caucho.quercus.env.ConstStringValue overrides final method generate.(Ljava/io/PrintWriter;)V

Can anyone see if I'm doing something wrong?

####################################################
class Php {
def dataSource
QuercusContext context
Env env = null
def Php(){
context = new QuercusContext()
context.init()
context.start()
context.setCompile(true);
context.setDatabase(dataSource)
}
def setIni(String name, String value){ context.setIni(name, value) }
def execute(File file,Map model){
        try{
HttpServletRequest req = RCH.currentRequestAttributes().getRequest()
Path path = context.getPwd().lookup(file.getAbsolutePath())
QuercusPage page = context.parse(path)
            // Create the string writer
            StringWriter writer = new StringWriter(new CharBuffer(1024));
            writer.openWrite();
            // Execute the page
            WriteStream ws = new WriteStream(writer);
            env = new Env(context, page, ws, null, null);   
            env.start();
//println(env.getRequest())
//env.getRequest()
setValues(model)
try {
page.executeTop(env);
} catch (QuercusDieException e) {
// ok
} catch (QuercusExitException e) {
// ok
} catch (QuercusException e) {
logger.error("PHP Exception: {}", e);
throw e;
}
            
            // Make sure we flush because otherwise the result does not get written
            ws.flush();
           
            // Write to output
            String result = ((StringWriter)ws.getSource()).getString(); 
                        
            // Return the result
            return result
        }catch (Exception exception){
            throw new ScriptException("Error executing script.", exception);
        }
}
def setValues(Map model){
model.each() { k, v ->
String className = v.getClass().name
JavaClassDef classDef = env.getJavaClassDefinition(className);
env.setGlobalValue(k, new JavaValue(env, v, classDef));
}
}
}

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

Owen Rubel
[hidden email]


Loading...