SEVERE: Error listenerStart

Occurs when an exception is thrown in the contextInitialized method of a ServletContextListener

SEVERE: Error filterStart

Occurs when an exception is thrown in the init method of a Filter

Unfortunately by default, tomcat won't provide you with any details about the cause of the error. Infact it wont even tell you which filter or listener is failing. This can be big problem in applications of significant size that have many filters and listeners configured. Fortunately there is a solution. In your webapplication's WEB-INF/classes folder you can create a logging.properties file with the following contents

org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandler

Now you will be presented with the stacktrace

'개발 > java' 카테고리의 다른 글

[JAVA] Spring Framework Annotation-based Controller Interceptor Configuration  (0) 2011.09.07
[JAVA] DWR  (0) 2010.11.23
[JAVA] 이클립스 설정  (0) 2010.11.02
Posted by 나랑살자
,

In order to use interceptors with Annotation-based controllers, you need to configure the DefaultAnnotationHandlerMapping used by the Spring container.

<bean id="annotationMapper" class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
	<property name="interceptors">
		<list>
			<ref bean="myInterceptor1"/>
			<ref bean="myInterceptor2"/>
			<ref bean="myInterceptor3"/>
		</list>
	</property>
</bean> 

URL Specific Interceptors for Annotation-based controllers

Unfortunately, using the DefaultAnnotationHandlerMapping for interceptors configures the interceptors for all defined annotation based controllers.
In some cases, you might want to have interceptors apply only to specific controllers. 

I have created two HandlerMappings that will accomplish this task:

The SelectedAnnotationHandlerMapping and theIgnoreSelectedAnnotationHandlerMapping.java classes which can both be downloaded from www.springplugins.org

SelectedAnnotationHandlerMapping

The SelectedAnnotationHandlerMapping allows you to specify which urls will be interecepted. It is configured as follows:

<bean id="publicMapper" class="org.springplugins.web.SelectedAnnotationHandlerMapping">
	<property name="urls">
		<list>
			<value>/interceptOnly.do</value>
		</list>
	</property>
	<property name="interceptors">
		<list>
			<ref bean="myInterceptor"/>
		</list>
	</property>
</bean>

The above configuration causes all requests to /interceptOnly.do to be intercepted by myInterceptor.

IgnoreSelectedAnnotationHandlerMapping.java

The IgnoreSelectedAnnotationHandlerMapping allows you to specify which urls will not be interecepted. This is similar to Spring'sDefaultAnnotationHandlerMapping in that it will map all Annotation based controllers except it will not map the defined urls. It is configured as follows:

<bean id="publicMapper" class="org.springplugins.web.IgnoreSelectedAnnotationHandlerMapping">
	<property name="order">
		<value>0</value>
	</property>
	<property name="urls">
		<list>
			<value>/doNotIntercept.do</value>
		</list>
	</property>
	<property name="interceptors">
		<list>
			<ref bean="myInterceptor"/>
		</list>
	</property>
</bean>

Here all annotation-based controllers will be intercepted with myInterceptor except the one usign /doNotIntercept.do url.
Notice that this interceptor specifies the order attribute. This is necessary because if you are using this controller, you are most likely using another mapper for the specified urls. The order was set to 0 here because it is assumed that the mapping to /doNotIntercept.do will be defined with an order > 0.



출처 : http://www.scottmurphy.info/spring_framework_annotation_based_controller_interceptors
Posted by 나랑살자
,

[JAVA] DWR

개발/java 2010. 11. 23. 23:18
<!-- DWR Setting -->
<servlet>
   <servlet-name>dwr</servlet-name>
   <!-- display-name>DWR Servlet</display-name -->
   <!-- description>Direct Web Remoter Servlet</description -->
   <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
   <!-- This should NEVER be present in live -->
   <init-param>
     <param-name>debug</param-name>
     <param-value>true</param-value>
   </init-param>
   <!-- By default DWR creates application scope objects when they are first
   used. This creates them when the app-server is started -->
   <init-param>
     <param-name>initApplicationScopeCreatorsAtStartup</param-name>
     <param-value>true</param-value>
   </init-param>
   <!-- WARNING: allowing JSON-RPC connections bypasses much of the security
   protection that DWR gives you. Take this out if security is important -->
   <init-param>
     <param-name>jsonRpcEnabled</param-name>
     <param-value>true</param-value>
   </init-param>
   <!-- WARNING: allowing JSONP connections bypasses much of the security
   protection that DWR gives you. Take this out if security is important -->
   <init-param>
     <param-name>jsonpEnabled</param-name>
     <param-value>true</param-value>
   </init-param>
   <!-- data: URLs are good for small images, but are slower, and could OOM for
   larger images. Leave this out (or keep 'false') for anything but small images -->
   <init-param>
     <param-name>preferDataUrlSchema</param-name>
     <param-value>false</param-value>
   </init-param>
   <!-- This enables full streaming mode. It's probably better to leave this
   out if you are running across the Internet -->
   <init-param>
     <param-name>maxWaitAfterWrite</param-name>
     <param-value>-1</param-value>
   </init-param>
   <!--
   For more information on these parameters, see:
   - http://getahead.org/dwr/server/servlet
   - http://getahead.org/dwr/reverse-ajax/configuration
   -->
   <load-on-startup>1</load-on-startup>
  </servlet>
 
<servlet-mapping>
<servlet-name>dwr</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
Posted by 나랑살자
,

vi /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini

showsplash org.eclipse.platform
--launcher.XXMaxPermSize 512m
-vmargs
-Xms40m
-Xmx512m
-XX:MaxPermSize=512m
-Xms40m
-Xmx512m

Posted by 나랑살자
,