applicationcontext

META-INF/persistence.xml cannot be opened because it does not exist

旧巷老猫 提交于 2019-12-22 17:23:09
问题 I'm creating a basic spring-maven project that should run as a java application (in process, not over a web server). My application context resides under the resources folder which is in my classpath: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www

Enabling UTF-8 character set in JSF2.0, Hibernate, MySQL

大憨熊 提交于 2019-12-22 05:48:29
问题 We are to enable UTF-8 character encoding to our web application designed using JSF2.0, Hibernate, MySQL. Following is the datasource defined in our application context file <bean id="DataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="com.mysql.jdbc.Driver" /> <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/dbname" /> <property name="maxPoolSize" value="10" /> <property name="maxStatements" value="0" />

Loading applicationcontext.xml when using SpringApplication

痞子三分冷 提交于 2019-12-22 04:34:19
问题 Could anyone provide an example of a SpringApplication that loads an applicationContext.xml file? I'm attempting to move my GWT RPC application to a RESTful web service by using a Spring's Example (Gradle based). I have an applicationContext.xml but I do not see how to get SpringApplication to load it. Loading manually via ApplicationContext context = new ClassPathXmlApplicationContext(args); results in an empty context. ...and even if that worked it would be separate from the one returned

JRuby PermGen out of space even use java objects in ruby code

心已入冬 提交于 2019-12-22 01:18:53
问题 Description: If we use java objects jruby get permgen too: System.out.println("Initialazing.."); //Spring applicaton context WebApplicationContext wac = (WebApplicationContext) AppContext.getApplicationContext(); // prepare path to internal ruby String scriptsPath = wac.getServletContext().getRealPath(RUBY_PATH); String jrubyHome = wac.getServletContext().getRealPath("WEB-INF" + File.separator + "jruby"); // Initializing Scripting container ScriptingContainer container = new

Spring ApplicationListener for ContextRefreshEvent. How to invoke only once per Hierarchy?

戏子无情 提交于 2019-12-21 20:48:14
问题 I need to execute a certain procedure once my spring web application starts all of its beans. For this I created a ApplicationListener<ContextRefreshedEvent>. However, when I run the application it gets called several times (as we have contexts for different namespaces e.g. mvc-servlets, etc.) but I need this particular listener to be called only once and when all the context where properly initialized. Is there a way to achieve what I'm trying to do? I'm using spring 3.1.0.RELEASE. 回答1: Yes,

Dispatcher-servlet cannot map to websocket requests

喜夏-厌秋 提交于 2019-12-21 05:15:11
问题 I'm developing a Java webapp with Spring as the main framework (Spring core, Spring mvc, Spring security, Spring data, Spring websocket are notably used). Declaring a message-broker in a Spring context like this provides a SimpMessagingTemplate bean to the context : <websocket:message-broker> <websocket:stomp-endpoint path="/stomp"> <websocket:sockjs/> </websocket:stomp-endpoint> <websocket:simple-broker prefix="/topic,/queue"/> </websocket:message-broker> I have to put this tag in my root

Parsing applicationContext.xml renders a `java.lang.NoSuchMethodError`. Could this be caused by dependency issues?

别说谁变了你拦得住时间么 提交于 2019-12-19 19:47:15
问题 I am invoking a test method (Junit) with an annotated application context ( @ContextConfiguration(locations={"classpath:applicationContext.xml"}) ). The test fails with the following stacktrace: 11:20:39.793 [main] ERROR o.s.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@28419cd] to prepare test instance [com.atrioom.TestDynamo@7fbdc7db] java.lang.IllegalStateException:

Read an environment variable from applicationContext.xml

血红的双手。 提交于 2019-12-18 15:54:05
问题 I need read an environment variable defined in my web.xml <env-entry> <description>Path Repositorio NFS</description> <env-entry-name>PATH_ENV</env-entry-name> <env-entry-type>java.lang.String</env-entry-type> <env-entry-value>C:/V3</env-entry-value> </env-entry> from my applicationContext.xml <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location" value="${PATH_ENV}/myprop.properties" /> </bean> How can I do this

PropertyPlaceholderConfigurer and environment variables in .properties files

半世苍凉 提交于 2019-12-18 11:10:02
问题 I have a Spring application-context.xml with PropertyPlaceholderConfigurer to get properties' values from .properties file. Main and test source folders have separate .properties file. The issue is that I need to use environment variables in .properties file. But when I do it in the following way: property.name=${env.SYSTEM_PROPERTY} I'm getting the following error: org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'beanName' defined in class

Spring ApplicationListener is not receiving events

戏子无情 提交于 2019-12-18 10:35:06
问题 I have the following ApplicationListener: package org.mycompany.listeners; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextStartedEvent; public class MyApplicationListener implements ApplicationListener<ContextStartedEvent> { public MyApplicationListener() { super(); System.out.println("Application context listener is created!"); } /** * {@inheritDoc} */ public void onApplicationEvent(final ContextStartedEvent event) { System.out.println