resin
A future facing CSS preprocessor made with rework
Topcoat
I've looked at JBoss' Weld Reference Implementation of JSR-299 Contexts and Dependency Injection, and I wanted to know how others CDI implementations compare to each other.
Specifically, I know about Weld, Resin CanDI (by Caucho), and Apache OpenWebBeans.
Source: (StackOverflow)
I have started a new job from a couple months, I work as front developer in a company where up until now everyone was using classic development patterns, but the goal is to move to a new ajax/rest services approach and that's what I do.
In our local development environment our apps run on Resin which runs inside Eclipse and get deployed as war files to C:\Resin\resin-pro-4.0.27\webapps
My problem is that I work mostly on css html and js files, static resources so I shouldn't need to restart Resin and wait 15 seconds (when it doesn't crash) to see the effect of every little piece of code I change.
Other problem is that I need to edit some files in external editors (sublime text for js, Crunch for LESS); I managed to make Eclipse open the external editor but even with the "Refresh using native hooks or polling" build option it takes a while to realize files have changed and restart Resin.
I also tried just working on the unpacked war in C:\Resin\resin-pro-4.0.27\webapps\appname but even there it takes like one minute before you can see the changes on the browser (is there some caching going on the server? can I disable it?)
I welcome any suggestion as all this is really hurting my productivity
Source: (StackOverflow)
i am using Resin 3.1.6 and Struts 2.1.8.1. When a page not found error (404) is returned, I am getting NullPointerException
. Here is a stack trace.
java.lang.NullPointerException
at com.caucho.server.connection.RequestWrapper.isSecure(RequestWrapper.java:296)
at com.caucho.server.connection.RequestAdapter.getCookieName(RequestAdapter.java:463)
at com.caucho.server.connection.RequestAdapter.getSession(RequestAdapter.java:387)
at com.caucho.server.webapp.DispatchRequest.getSession(DispatchRequest.java:448)
at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:236)
at org.springframework.web.context.request.ServletRequestAttributes.updateAccessedSessionAttributes(ServletRequestAttributes.java:222)
at org.springframework.web.context.request.AbstractRequestAttributes.requestCompleted(AbstractRequestAttributes.java:48)
at org.springframework.web.context.request.RequestContextListener.requestDestroyed(RequestContextListener.java:78)
Source: (StackOverflow)
Forgive me if I make any mistakes as this is my first time posting a question.
I'm working on a web app that uses the Resin Embedded Libraries -- It depends heavily on the PHP Engine (Quercus) that is included with Resin. After 3 days of coding I decided it was time to make my first runnable jar for testing on my web server when I came across a strange problem with Quercus -- I assume. Basic PHP Functions such as date, count and var_dump were returning as unknown functions when they were called from the PHP File I requested from the server.
But from within my IDE (Eclipse 3.8) I had no problems what so ever. So going back to the first doc I used, I made a small test app using the bare minimum code and libraries. I followed the instructions for the first tutorial at http://www.caucho.com/resin-3.1/doc/resin-embedding.xtp and I seem too get the exact problem as before.
The main code from the test app
public class Main
{
public static void main( String[] args )
{
ResinEmbed resin = new ResinEmbed();
HttpEmbed http = new HttpEmbed( 8080 );
resin.addPort( http );
WebAppEmbed webapp = new WebAppEmbed( "/", "/var/www" );
resin.addWebApp( webapp );
resin.start();
resin.join();
}
}
The PHP file I used for testing
<?php var_dump( "Hello World" ); echo date("Y"); ?>
The Exception
com.caucho.quercus.QuercusErrorException: 'date' is an unknown function.
at com.caucho.quercus.env.Env.error(Env.java:6885)
at com.caucho.quercus.env.Env.error(Env.java:6408)
at com.caucho.quercus.expr.CallExpr.evalImpl(CallExpr.java:188)
at com.caucho.quercus.expr.CallExpr.eval(CallExpr.java:141)
at com.caucho.quercus.statement.EchoStatement.execute(EchoStatement.java:55)
at com.caucho.quercus.statement.BlockStatement.execute(BlockStatement.java:105)
at com.caucho.quercus.program.QuercusProgram.execute(QuercusProgram.java:414)
at com.caucho.quercus.env.Env.evalCode(Env.java:4201)
So I know my issue is not something in my code and I tried playing with project properties and different library versions with no luck. Right now, I'm using the latest version of 4.0.36 with Java version 1.7_25. I've even tried it on multiple computers (All running Linux, since thats all I use now a days). I've been up and down the internet looking for help but no existing threads seemed to even come close to my problem. Would anyone know what would cause this? I hope my question was detailed enough without being too long or too detailed.
If interested, I can also post the repository for my app but the code above gets the same problem as my app even though my app and the example above executes the code in slightly different manners.
UPDATE:
After extensively searching and testing the source for Quercus, I discovered that the problem seems related to not all the modules loading -- ie. Modules add the missing functions -- So I discovered that if I export my project with the option "Copy required libraries into a sub-folder next to the generated JAR" it works just as it does in the IDE. Now, As this is at least a temporary solution to get my project running, I would still like to know how to compile as normal without getting the problem. (58 modules loaded inside the IDE, Only 2 loaded when compiled.)
Source: (StackOverflow)
I am getting url pattern matching to work in Railo on Tomcat by using this in web.xml:
<servlet-mapping>
<servlet-name>CFMLServlet</servlet-name>
<url-pattern>/babeswithbraces/posts/*</url-pattern>
<url-pattern>/babeswithbraces/pages/*</url-pattern>
</servlet-mapping>
So if I call the page http://localhost:8888/babeswithbraces/posts
OR http://localhost:8888/babeswithbraces/pages
then the request is correctly handled.
But, my production Railo server is running on Resin. So I am not sure how to do this there?
I have tried adding the same lines to the app-default.xml
file in "C:\Railo\conf"
but that does not seem to have made any difference and when the website loads (example: http://babeswithbraces.com/posts
) it gives a standard 404 page not found error. So obviously something is wrong.
I have tried:
<servlet-mapping>
<servlet-name>CFMLServlet</servlet-name>
<url-pattern>/babeswithbraces.com/posts/*</url-pattern>
<url-pattern>/babeswithbraces.com/pages/*</url-pattern>
</servlet-mapping>
I have also tried:
<servlet-mapping>
<servlet-name>CFMLServlet</servlet-name>
<url-pattern>/posts/*</url-pattern>
<url-pattern>/pages/*</url-pattern>
</servlet-mapping>
How / where do I get the URL patterns set up correctly for resin?
Thanks
Source: (StackOverflow)
I'm trying to cancel timer but after that I still have it returning by getTimers(). Is it ok or just a caucho resin bug? How to cancel programmatic timer correctly?
@Singleton
@LocalBean
@Startup
public class TimerTest
{
@Resource
TimerService ts;
static TimerTest inst;
@PostConstruct
void init()
{ inst=this;
}
public synchronized static TimerTest getInstance()
{ return(inst);
}
public Collection<Timer> getTimers()
{ Collection <Timer> res=ts.getTimers();
return(res);
}
public void cancelAll()
{ for(Timer ot: ts.getTimers())
{ try
{ System.out.println("Found old timer "+ot.getInfo()+", cancelling it.");
ot.cancel();
}
catch(Exception e) {}
}
}
And then (from jsp):
TimerTest tt=TimerTest.getInstance();
Collection <Timer> timers=tt.getTimers();
out.println("<br>Got "+timers.size()+" timer(s)<br>");
for(Timer t: timers)
{
try
{
out.println("<br>Got timer: "+t.getInfo());
}
catch(Exception e)
{
out.println("Error while cancelling timers "+e);
}
}
Error while cancelling timers javax.ejb.NoSuchObjectLocalException: This timer has been cancelled.
Thank you! )
Source: (StackOverflow)
All,
I'm working on a java webapp that we deploy in the Resin web app server. I have been doing some XML parsing for a new part of the application, and realized that our app was using Resin classes to do the parsing. I wanted to get away from that and use something more standard for a number of reasons, so I set these system properties in my resin config file (and added the xerces jar to my classpath):
<system-property javax.xml.parsers.DocumentBuilderFactory="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
<system-property javax.xml.parsers.SAXParserFactory="org.apache.xerces.jaxp.SAXParserFactoryImpl"/>
And, now I'm getting JSP compilation errors on several pages (I guess Resin's built in parser was more lenient). The error reads:
org.xml.sax.SAXParseException: The value of attribute "title" associated with an element type "display:column" must not contain the '<' character.
And, the 'display:column' tag on some pages does indeed contain markup in the 'title' attribute. Here's an example:
<display:column scope='col' class=" appealColorBG selectAllWidth"
title="<span class='centerThis'><label for='selectAll'>Select All</label><br />
<input type='checkbox' name='selectAll'
id='selectAll'
onClick='selectAllCheckboxes();'/></span> " >
That's some ugly JSP code, I know, but it's also code that's already in production, so I'm hesitant to change it.
Does anyone know of a way that I can set xerces so that it will allow the JSP to compile as is?
Source: (StackOverflow)
We've been using JETTY's suspended servlet implementation to roll our own COMET web applications using JSON messages and XStream.
Does anyone have experience with Resin's implementation of COMET and how they compare?
Also more generically than COMET does anyone have suggestions on the best Java Suspended servlet 3.0 implementation.
Here are some resources:
Source: (StackOverflow)
I am getting following exception when trying to load a XML Schema file in Resin 3.0.25
container. The schema file does not refer anything external besides XML Schema namespace (http://www.w3.org/2001/XMLSchema).
The XML Schema file is valid and exact same code works when using a Jetty
container.
The machine that runs Resin is has no access to internet, and machine running Jetty has internet access.
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'xsdSchema' threw exception; nested exception is org.springframework.xml.validation.XmlValidationException: C
ould not create Schema: s4s-att-invalid-value: Invalid attribute value for 'base' in element 'restriction'. Recorded reason: UndeclaredPrefix: Cannot resolve 'xsd:string' as a QName: the prefix 'xsd
' is not declared.; nested exception is org.xml.sax.SAXParseException: s4s-att-invalid-value: Invalid attribute value for 'base' in element 'restriction'. Recorded reason: UndeclaredPrefix: Cannot r
esolve 'xsd:string' as a QName: the prefix 'xsd' is not declared.
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:104)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1198)
... 48 more
I have tried different XML parsers like this but it does not seem to have any effect.
-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
What could be the reason for this behaviour?
Edit: With a bit different spring configuration I am getting this stacktrace
org.xml.sax.SAXParseException: s4s-att-invalid-value: Invalid attribute
value for 'base' in element 'restriction'. Recorded reason: UndeclaredPrefix:
Cannot resolve 'xsd:string' as a QName: the prefix 'xsd' is not declared.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:2525)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSAttributeChecker.reportSchemaError(XSAttributeChecker.java:1608)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSAttributeChecker.checkAttributes(XSAttributeChecker.java:1175)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSAttributeChecker.checkAttributes(XSAttributeChecker.java:996)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDSimpleTypeTraverser.getSimpleType(XSDSimpleTypeTraverser.java:221)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDSimpleTypeTraverser.traverseSimpleTypeDecl(XSDSimpleTypeTraverser.java:142)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDSimpleTypeTraverser.traverseGlobal(XSDSimpleTypeTraverser.java:102)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.traverseSchemas(XSDHandler.java:1267)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:579)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:552)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:519)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:485)
at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:206)
at org.springframework.xml.validation.SchemaLoaderUtils.loadSchema(SchemaLoaderUtils.java:77)
Source: (StackOverflow)
I would like to see if I can use GWT in my already existing Servlet-site using the Resin web-server, however I am having problems locating any decent guides that can help me out
Does anyone have a hands-on tutorial/guide on how to use GWT outside an "GWT project" or without using Google App Engine (GAE)?
I am still using Eclipse and have GWT plugins enabled and added the GWT support for the project, but I am unsure how to connect all the components together without using GAE.
Source: (StackOverflow)
I can not get the resin-maven-plugin working. Actually I want to test my web app on different App Servers (jetty, tomcat, jboss, glassfish all work great) by executing resin:run.
I tried the snapshots and final versions, but all have problems. The latest versions report:
Cannot find setter, adder nor field in com.caucho.maven.MavenRun for 'contextRoot'
There is a bug report about this issue, but Caucho is not supporting this plugin anymore.
So here my questions:
- Is there a working version available?
- If not, where can I find the source code (and then fix it myself)
Source: (StackOverflow)
How do I configure Apache to forward a URLa of a certain extension, say *.htm to my Servlet container, in this case, Resin, without first checking for the file's existence.
Currently, if Apache can not find the requested file in the directory structure, it serves a 404, even though my web.xml Servlet mapping would handle the request if forwarded.
I've temporarily resorted to placing an empty file matching the requested file within my web structure (i.e. c:/dir/dir/index.htm) so that Apache forwards the request.
Resin's Apache configuration is a bit different than Tomcat's (below), however the problem seems to exist entirely within Apache since the request never makes it to Resin.
Help would be greatly appreciated.
LoadModule caucho_module c:/resin-pro/win32/apache-2.0/mod_caucho.dll
NameVirtualHost *
<VirtualHost *>
ServerName sub.domain.com
DocumentRoot c:/web
ResinConfigServer sub.domain.com 6802
</VirtualHost>
Source: (StackOverflow)
I have a little problem: I'm writing to response content of the file and return it to the client as an ajax response.
But there occurs html substitution: of >
to >
etc...
What i have to do to make this substitution off ?
res.setHeader( "Cache-Control", "must-revalidate, post-check=0, pre-check=0" );
res.setHeader( "Pragma", "public" );
res.setContentType( "text/html" );
TIA
update
// import com.ibm.useful.http.PostData;
PostData pd = new PostData( req );
final FileData data;
try {
data = pd.getFileData( "sqlFile" );
ByteArrayOutputStream buf = new ByteArrayOutputStream();
for ( byte b : data.getByteData() ) {
buf.write( b );
}
res.getWriter().print( buf.toString() );
}
i watched buf.toString()
through debugger. it's ok there. substitution goes further. but where...
Source: (StackOverflow)
I am trying to use java config in spring 4 webmvc application. After surfing some examples in the Internet I have the following WebAppApplicationInitializer.
public class AppInit implements WebApplicationInitializer {
private static final String CONFIG_LOCATION = "spring.examples.config";
private static final String MAPPING_URL = "/rest/*";
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
WebApplicationContext context = getContext();
servletContext.addListener(new ContextLoaderListener(context));
ServletRegistration.Dynamic dispatcher = servletContext.addServlet("DispatcherServlet", new DispatcherServlet(context));
dispatcher.setLoadOnStartup(1);
dispatcher.addMapping(MAPPING_URL);
}
private AnnotationConfigWebApplicationContext getContext() {
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
context.setConfigLocation(CONFIG_LOCATION);
return context;
}
It works fine in jetty, tomcat, but when I am using resin 4.0.40. web server show the following error:
java.lang.IllegalStateException: Cannot initialize context because there
is already a root application context present - check whether you have
multiple ContextLoader* definitions in your web.xml!
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:277)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at com.caucho.server.webapp.WebApp.fireContextInitializedEvent(WebApp.java:3777)
at com.caucho.server.webapp.WebApp.startImpl(WebApp.java:3687)
at com.caucho.server.webapp.WebApp.access$400(WebApp.java:207)
at com.caucho.server.webapp.WebApp$StartupTask.run(WebApp.java:5234)
at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)
at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)
When I comment this line
servletContext.addListener(new ContextLoaderListener(context));
all works fine.
Question is what is the purpose of adding listener to servlet context? Is it wrong not to add listener to servlet context?
Source: (StackOverflow)
I'm trying to upload image files. When uploading files of sizes of about 40 to 200kb everything is fine. But when I try to upload a file of size 459kb sometimes it gets uploaded and sometimes OutOfMemoryError is shown. I don't think that file size is very large for this error to be thrown. I'm using resin. Is it possible there's a resin setting that prevents uploading of large sized files? Because in the code there is nowhere I'm setting any maximum size for file uploading.
Any one have any ideas how to avoid this. I want users to upload images of any size of up to about 10 MB.
Source: (StackOverflow)