Search Results

Search found 15134 results on 606 pages for 'spring framework'.

Page 18/606 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • What is bootstrap listener in the context of Spring framework?

    - by jillionbug2fix
    I am studying Spring framework, in web.xml I added following which is a bootstrap listener. Can anyone give me a proper idea of what is a bootstrap listener? <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> You can see the doc here: ContextLoadListener Bootstrap listener to start up and shut down Spring's root WebApplicationContext. Simply delegates to ContextLoader as well as to ContextCleanupListener. This listener should be registered after Log4jConfigListener in web.xml, if the latter is used. As of Spring 3.1, ContextLoaderListener supports injecting the root web application context via the ContextLoaderListener(WebApplicationContext) constructor, allowing for programmatic configuration in Servlet 3.0+ environments. See WebApplicationInitializer for usage examples...

    Read the article

  • spring annotation configuration issue

    - by shrimpy
    I don't know why spring 2.5.6 keeps complaining, but I don't have any "orderBy" annotation. 2009-10-10 13:55:37.242::WARN: Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.annotation.internalPersiste nceAnnotationProcessor': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'order' of bean class [org.springfra mework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor]: Bean property 'order' is not writable or has an invalid setter method. Does the parameter type of the setter match the re turn type of the getter?: org.springframework.beans.NotWritablePropertyException: Invalid property 'order' of bean class [org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor]: Bean propert y 'order' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:801) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:651) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1276) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010) or even when I swap to use lower version spring 2.5.1, it's still complaining: 2009-10-10 13:57:56.062::WARN: failed ContextHandlerCollection@5da0b94d java.lang.NoClassDefFoundError: org/springframework/context/support/AbstractRefreshableConfigApplicationContext at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:366) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337) at org.springframework.util.ClassUtils.forName(ClassUtils.java:230) at org.springframework.util.ClassUtils.forName(ClassUtils.java:183) at org.springframework.web.context.ContextLoader.determineContextClass(ContextLoader.java:283) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:243) If I do not use annotation, it works fine. No problem at all, Everything happened after this <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd" default-autowire="byName"> <context:component-scan base-package="demo.dao"> <context:include-filter type="annotation" expression="org.springframework.stereotype.Repository"/> </context:component-scan> </beans> and I am sure my spring is configured properly. <?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:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd" default-autowire="byName"> <!-- For mail settings and future properties files --> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:jdbc.properties</value> </list> </property> </bean> <!-- Check all the beans managed by Spring for persistence-related annotations. e.g. PersistenceContext --> <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="${jdbc.driverClassName}"/> <property name="url" value="${jdbc.url}"/> <property name="username" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> </bean> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="dataSource"/> <!-- jpaVendorAdapter Hibernate, injected into emf --> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="showSql" value="${hibernate.show_sql}"/> <!-- Data Definition Language script is generated and executed for each run --> <property name="generateDdl" value="${jdbc.generateDdl}"/> </bean> </property> <!--<property name="hibernateProperties"> --> <property name="jpaProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect} </prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto} </prop> </props> </property> </bean> <tx:annotation-driven transaction-manager="transactionManager" /> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory"/> <property name="dataSource" ref="dataSource"/> </bean> </beans> Can anyone tell me what is wrong? How can I fix this?

    Read the article

  • Java/Spring: Why won't Spring use the validator object I have configured?

    - by GMK
    I'm writing a web app with Java & Spring 2.5.6 and using annotations for bean validation. I can get the basic annotation validation working fine, and Spring will even call a custom Validator declared with @Validator on the target bean. But it always instantiates a brand new Validator object to do it. This is bad because the new validator has none of the injected dependencies it needs to run, and so it throws a null pointer exception on validate. I need one of two things and I don't know how to do either. Convince Spring to use the validator I have already configured. Convince Spring to honor the @Autowired annotations when it creates the new validator. The validator has the @Component annotation, like this. @Component public class AccessCodeBeanValidator implements Validator { @Autowired private MessageSource messageSource; Spring finds the validator in the component scan, injects the autowired dependencies, but then ignores it and creates a new one at validation time. The only thing that I can do at the moment is add a validator reference into the controller for each validator object and use that ref directly, instead of relying on the bean validation framework to call the validator for me. It looks like this. // first validate via the annotations on the bean beanValidator.validate(accessCodeBean, result); // then validate using the specific validator class acbValidator.validate(accessCodeBean, result); if (result.hasErrors()) { If anyone knows how to convince spring to use the existing validator, instead of creating a new one, or how to make it do the autowiring when it creates a new one, I'd love to know.

    Read the article

  • How to configure RetryAdvice and ExceptionTranslation for Deadlocks using NHibernate and Spring

    - by zoidbeck
    Hi, i am using Spring.net 1.2 with NHibernate 2.0.1. Within my project i'am facing some Deadlock issues and besides the database tweaks to minimize the occurence i would like to implement Springs RetryAdvice to handle this. I can't find any working example how to configure a this. The reference seems to be clear about how to use it but somehow i can't get it working. <!--Used to translate NHibernate exception to Spring.DataAccessExceptions--> <object type="Spring.Dao.Attributes.PersistenceExceptionTranslationPostProcessor, Spring.Data"/> <!--ExceptionHandler performing Retry on Deadlocks--> <object name="ExceptionHandlingAdvice" type="Spring.Aspects.RetryAdvice, Spring.Aop"> <property name="retryExpression" value="on exception name DeadLockLoserException retry 3x rate (1*#n + 0.5)"/> </object> I have added the [Repository] attribute to my DAOs to get ExceptionTranslation enabled and tried to add the RetryAdvice to the TransactionProxyFactoryObject i am using but it won't work. I don't understand where to put this Advice. Do i have to declare a PointCut to add it or how could i get it to work as expected. Thx in advance - any help appreciated.

    Read the article

  • How do I fix a corrupted copy of .Net Framework on Windows 7?

    - by David
    I receive the following error when trying to run applications that require .net Framework 3.5: "Could not load file or assembly 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The module was expected to contain an assembly manifest." I've tried numerous fixes, such as reinstalling through ad/remove software, copying the .net folder over from a clean windows 7 install, and running the .net cleanup tool. Just wondering if anyone has run into this issue before, or has an idea on how to fix it.

    Read the article

  • impossible to install Framework 3.5

    - by yae
    Hi few days ago I formatted one of my computers (XP Home SP2 with prior updates installed). Now I am trying to install NET Framework 3.5, but display this error: [03/21/10,17:19:36] Microsoft .NET Framework 2.0a: [2] Error: Installation failed for component Microsoft .NET Framework 2.0a. MSI returned error code 1603 [03/21/10,17:20:17] WapUI: [2] DepCheck indicates Microsoft .NET Framework 2.0a is not installed. Already i have tried this to try solve this issue, but the problem persists. 1.- unistall all frameworks and reinstall from scratch 2.- clean all temps file and reinstall from scratch 3.- unistall and clean all frameworks with dotnetfx cleanup tool and reinstall from scratch 4.- install .NET Framework 3.5 full package But all these possibles solutions have failed. Any idea to solve this? Thanks in advance

    Read the article

  • Spring MVC: should service layer be returning operation specific DTO's ?

    - by arrages
    In my Spring MVC application I am using DTO in the presentation layer in order to encapsulate the domain model in the service layer. The DTO's are being used as the spring form backing objects. hence my services look something like this: userService.storeUser(NewUserRequestDTO req); The service layer will translate DTO - Domain object and do the rest of the work. Now my problem is that when I want to retrieve a DTO from the service to perform say an Update or Display I can't seem to find a better way to do it then to have multiple methods for the lookup that return different DTO's like... EditUserRequestDTO userService.loadUserForEdit(int id); DisplayUserDTO userService.loadUserForDisplay(int id); but something does not feel right about this approach. The reason do have separate DTO's is that DisplayUserDTO is strongly typed to be read only and also there are many properties of user that are entities from a lookup table in the db (like city and state) so the DisplayUserDTO would have the string description of the properties while the EditUserRequestDTO will have the id's that will back the select drop down lists in the forms. What do you think? thanks

    Read the article

  • Spring MVC: How to get the remaining path after the controller path?

    - by Willis Blackburn
    I've spent over an hour trying to find the answer to this question, which seems like it should reflect a common use case, but I can't figure it out! Basically I am writing a file-serving controller using Spring MVC. The URLs are of the format http://www.bighost.com/serve/the/path/to/the/file.jpg, in which the part after "/serve" is the path to the requested file, which may have an arbitrary number of path segments. I have a controller like this: @Controller class ServerController { @RequestMapping(value = "/serve/???") public void serve(???) { } } What I am trying to figure out is: What do I use in place of "???" to make this work? I have two theories about how this should work. The first theory is that I could replace the first "???" in the RequestMapping with a path variable placeholder that has some special syntax meaning "capture to the end of the path." If a regular placeholder looks like "{path}" then maybe I could use "{path:**}" or "{path:/}" or something like that. Then I could use a @PathVariable annotation to refer to the path variable in the second "???". The other theory is that I could replace the first "???" with "**" (match anything) and that Spring would give me an API to obtain the remainder of the path (the part matching the "**"). But I can't find such an API. Thanks for any help you can provide!

    Read the article

  • What is the best way to get a reference to a spring bean in the backend layers?

    - by java_pill
    I have two spring config files and I'm specifying them in my web.xml as in below. web.xml snippet .. <context-param> <param-name>contextConfigLocation</param-name> <param-value>WEB-INF/classes/domain-context.xml WEB-INF/classes/client-ws.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> .. From my domain object I have to invoke a Web Service Client and in order to get a reference to the Web Service client I do this: ApplicationContext context = new ClassPathXmlApplicationContext("client-ws.xml"); //b'cos I don't want to use WebApplicationContextUtils ProductServiceClient client = (ProductServiceClient) context.getBean("productClient"); .. client.find(prodID); //calls a Web Service .. However, I have concerns that looking up the client-ws.xml file and getting a reference to the ProductServiceClient bean is not efficient. I thought of getting it using WebApplicationContextUtils. However, I don't want my domain objects to have a dependency on the ServletContext (a web/control layer object) because WebApplicationContextUtils depends on ServletContext. What is the best way to get a reference to a spring bean in the backend layers? Thanks!

    Read the article

  • Inheritance Mapping Strategies with Entity Framework Code First CTP5: Part 2 – Table per Type (TPT)

    - by mortezam
    In the previous blog post you saw that there are three different approaches to representing an inheritance hierarchy and I explained Table per Hierarchy (TPH) as the default mapping strategy in EF Code First. We argued that the disadvantages of TPH may be too serious for our design since it results in denormalized schemas that can become a major burden in the long run. In today’s blog post we are going to learn about Table per Type (TPT) as another inheritance mapping strategy and we'll see that TPT doesn’t expose us to this problem. Table per Type (TPT)Table per Type is about representing inheritance relationships as relational foreign key associations. Every class/subclass that declares persistent properties—including abstract classes—has its own table. The table for subclasses contains columns only for each noninherited property (each property declared by the subclass itself) along with a primary key that is also a foreign key of the base class table. This approach is shown in the following figure: For example, if an instance of the CreditCard subclass is made persistent, the values of properties declared by the BillingDetail base class are persisted to a new row of the BillingDetails table. Only the values of properties declared by the subclass (i.e. CreditCard) are persisted to a new row of the CreditCards table. The two rows are linked together by their shared primary key value. Later, the subclass instance may be retrieved from the database by joining the subclass table with the base class table. TPT Advantages The primary advantage of this strategy is that the SQL schema is normalized. In addition, schema evolution is straightforward (modifying the base class or adding a new subclass is just a matter of modify/add one table). Integrity constraint definition are also straightforward (note how CardType in CreditCards table is now a non-nullable column). Another much more important advantage is the ability to handle polymorphic associations (a polymorphic association is an association to a base class, hence to all classes in the hierarchy with dynamic resolution of the concrete class at runtime). A polymorphic association to a particular subclass may be represented as a foreign key referencing the table of that particular subclass. Implement TPT in EF Code First We can create a TPT mapping simply by placing Table attribute on the subclasses to specify the mapped table name (Table attribute is a new data annotation and has been added to System.ComponentModel.DataAnnotations namespace in CTP5): public abstract class BillingDetail {     public int BillingDetailId { get; set; }     public string Owner { get; set; }     public string Number { get; set; } } [Table("BankAccounts")] public class BankAccount : BillingDetail {     public string BankName { get; set; }     public string Swift { get; set; } } [Table("CreditCards")] public class CreditCard : BillingDetail {     public int CardType { get; set; }     public string ExpiryMonth { get; set; }     public string ExpiryYear { get; set; } } public class InheritanceMappingContext : DbContext {     public DbSet<BillingDetail> BillingDetails { get; set; } } If you prefer fluent API, then you can create a TPT mapping by using ToTable() method: protected override void OnModelCreating(ModelBuilder modelBuilder) {     modelBuilder.Entity<BankAccount>().ToTable("BankAccounts");     modelBuilder.Entity<CreditCard>().ToTable("CreditCards"); } Generated SQL For QueriesLet’s take an example of a simple non-polymorphic query that returns a list of all the BankAccounts: var query = from b in context.BillingDetails.OfType<BankAccount>() select b; Executing this query (by invoking ToList() method) results in the following SQL statements being sent to the database (on the bottom, you can also see the result of executing the generated query in SQL Server Management Studio): Now, let’s take an example of a very simple polymorphic query that requests all the BillingDetails which includes both BankAccount and CreditCard types: projects some properties out of the base class BillingDetail, without querying for anything from any of the subclasses: var query = from b in context.BillingDetails             select new { b.BillingDetailId, b.Number, b.Owner }; -- var query = from b in context.BillingDetails select b; This LINQ query seems even more simple than the previous one but the resulting SQL query is not as simple as you might expect: -- As you can see, EF Code First relies on an INNER JOIN to detect the existence (or absence) of rows in the subclass tables CreditCards and BankAccounts so it can determine the concrete subclass for a particular row of the BillingDetails table. Also the SQL CASE statements that you see in the beginning of the query is just to ensure columns that are irrelevant for a particular row have NULL values in the returning flattened table. (e.g. BankName for a row that represents a CreditCard type) TPT ConsiderationsEven though this mapping strategy is deceptively simple, the experience shows that performance can be unacceptable for complex class hierarchies because queries always require a join across many tables. In addition, this mapping strategy is more difficult to implement by hand— even ad-hoc reporting is more complex. This is an important consideration if you plan to use handwritten SQL in your application (For ad hoc reporting, database views provide a way to offset the complexity of the TPT strategy. A view may be used to transform the table-per-type model into the much simpler table-per-hierarchy model.) SummaryIn this post we learned about Table per Type as the second inheritance mapping in our series. So far, the strategies we’ve discussed require extra consideration with regard to the SQL schema (e.g. in TPT, foreign keys are needed). This situation changes with the Table per Concrete Type (TPC) that we will discuss in the next post. References ADO.NET team blog Java Persistence with Hibernate book a { text-decoration: none; } a:visited { color: Blue; } .title { padding-bottom: 5px; font-family: Segoe UI; font-size: 11pt; font-weight: bold; padding-top: 15px; } .code, .typeName { font-family: consolas; } .typeName { color: #2b91af; } .padTop5 { padding-top: 5px; } .padTop10 { padding-top: 10px; } p.MsoNormal { margin-top: 0in; margin-right: 0in; margin-bottom: 10.0pt; margin-left: 0in; line-height: 115%; font-size: 11.0pt; font-family: "Calibri" , "sans-serif"; }

    Read the article

  • Web framework able to handle many concurrent users [closed]

    - by Jonas
    Social networking sites needs to handle many concurrent users e.g. for chat functionality. What web frameworks scales well and are able to handle more than 10.000 concurrent users connected with Comet or WebSockets. The server is a Linux VPS with limited memory, e.g. 1GB-8GB. I have been looking for some Java frameworks but they consume much memory per connection. So I'm looking for other alternatives too. Are there any good frameworks that are able to handle more than 10.000 concurrent users with limited memory resources?

    Read the article

  • Open source framework quality [closed]

    - by Jonas Byström
    It's not hard to find snippets, components or tools/toolkits in the open source world which holds the quality bar really high. Myself I use git, python, linux, gcc, bash and a whole range of others on a daily basis, and I love them. But when it comes to bigger frameworks, which are intended for facilitating larger tasks of an application without much interference, I'm not as enthusiastic. I've tried a few commercial frameworks (game engines), which were okay, but all big open source frameworks which I've used myself, or which I have seen used in applications were decidedly worse than the commercial equivalent. But I'm not sure if my experience was typical. Where have bigger open source frameworks for facilitating larger tasks of an application been able to equal or exceed commercial frameworks, and how were they better?

    Read the article

  • Loading Entities Dynamically with Entity Framework

    - by Ricardo Peres
    Sometimes we may be faced with the need to load entities dynamically, that is, knowing their Type and the value(s) for the property(ies) representing the primary key. One way to achieve this is by using the following extension methods for ObjectContext (which can be obtained from a DbContext, of course): 1: public static class ObjectContextExtensions 2: { 3: public static Object Load(this ObjectContext ctx, Type type, params Object [] ids) 4: { 5: Object p = null; 6:  7: EntityType ospaceType = ctx.MetadataWorkspace.GetItems<EntityType>(DataSpace.OSpace).SingleOrDefault(x => x.FullName == type.FullName); 8:  9: List<String> idProperties = ospaceType.KeyMembers.Select(k => k.Name).ToList(); 10:  11: List<EntityKeyMember> members = new List<EntityKeyMember>(); 12:  13: EntitySetBase collection = ctx.MetadataWorkspace.GetEntityContainer(ctx.DefaultContainerName, DataSpace.CSpace).BaseEntitySets.Where(x => x.ElementType.FullName == type.FullName).Single(); 14:  15: for (Int32 i = 0; i < ids.Length; ++i) 16: { 17: members.Add(new EntityKeyMember(idProperties[i], ids[i])); 18: } 19:  20: EntityKey key = new EntityKey(String.Concat(ctx.DefaultContainerName, ".", collection.Name), members); 21:  22: if (ctx.TryGetObjectByKey(key, out p) == true) 23: { 24: return (p); 25: } 26:  27: return (p); 28: } 29:  30: public static T Load<T>(this ObjectContext ctx, params Object[] ids) 31: { 32: return ((T)Load(ctx, typeof(T), ids)); 33: } 34: } This will work with both single-property primary keys or with multiple, but you will have to supply each of the corresponding values in the appropriate order. Hope you find this useful!

    Read the article

  • TLS/SSL and .NET Framework 4.0

    The Secure Socket Layer is now essential for the secure exchange of digital data, and is most generally used within the HTTPS protocol. .NET now provides the Windows Communication Foundation (WCF) to implement secure communications directly. Matteo explains the TLS/SSL protocol, and takes a hands-on approach to investigate the SslStream class to show how to implement a secure communication channel

    Read the article

  • Quartz + Spring double execution on startup

    - by Osy
    I have Quartz 2.2.1 and Spring 3.2.2. app on Eclipse Juno This is my bean configuration: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <!-- Spring Quartz --> <bean id="checkAndRouteDocumentsTask" class="net.tce.task.support.CheckAndRouteDocumentsTask" /> <bean name="checkAndRouteDocumentsJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean"> <property name="jobClass" value="net.tce.task.support.CheckAndRouteDocumentsJob" /> <property name="jobDataAsMap"> <map> <entry key="checkAndRouteDocumentsTask" value-ref="checkAndRouteDocumentsTask" /> </map> </property> <property name="durability" value="true" /> </bean> <!-- Simple Trigger, run every 30 seconds --> <bean id="checkAndRouteDocumentsTaskTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean"> <property name="jobDetail" ref="checkAndRouteDocumentsJob" /> <property name="repeatInterval" value="30000" /> <property name="startDelay" value="15000" /> </bean> <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="jobDetails"> <list> <ref bean="checkAndRouteDocumentsJob" /> </list> </property> <property name="triggers"> <list> <ref bean="checkAndRouteDocumentsTaskTrigger" /> </list> </property> </bean> My mvc spring servlet config: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> </bean> <mvc:annotation-driven /> <context:annotation-config /> <context:component-scan base-package="net.tce" /> <import resource="spring-quartz.xml"/> </beans> My problem is that always when startup my application, Quartz creates two jobs at the same time. My job must be execute every 30 seconds: INFO: Starting TASK on Mon Nov 04 15:36:46 CST 2013... INFO: Starting TASK on Mon Nov 04 15:36:46 CST 2013... INFO: Starting TASK on Mon Nov 04 15:37:16 CST 2013... INFO: Starting TASK on Mon Nov 04 15:37:16 CST 2013... INFO: Starting TASK on Mon Nov 04 15:37:46 CST 2013... INFO: Starting TASK on Mon Nov 04 15:37:46 CST 2013... Thanks for your help.

    Read the article

  • Spring.Data.NHibernate12:::Application not closing database connection(Getting max connection pool

    - by anupam3m
    Even after successful transaction.Application connection with the database persist.in Nhibernate log it shows Nhibernate Log 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.SessionImpl [(null)] <(null) - executing flush 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.ConnectionManager [(null)] < (null) - registering flush begin 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.ConnectionManager [(null)] < (null) - registering flush end 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.SessionImpl [(null)] <(null) - post flush 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.SessionImpl [(null)] <(null) - before transaction completion 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.ConnectionManager [(null)] < (null) - aggressively releasing database connection 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Connection.ConnectionProvider [(null)] <(null) - Closing connection 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.SessionImpl [(null)] <(null) - transaction completion 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Transaction.AdoTransaction [(null)] < (null) - running AdoTransaction.Dispose() 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.SessionImpl [(null)] <(null) - closing session 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.BatcherImpl [(null)] <(null) - running BatcherImpl.Dispose(true) Underneath given is my dataconfiguration file < ?xml version="1.0" encoding="utf-8" ? < objects xmlns="http://www.springframework.net" xmlns:db="http://www.springframework.net/database" xmlns:tx="http://www.springframework.net/tx"> <property name="CacheSettings" ref="CacheSettings"/> type="Risco.Rsp.Ac.AMAC.CacheMgmt.Utilities.UpdateEntityCacheHelper, Risco.Rsp.Ac.AMAC.CacheMgmt.Utilities" singleton="false"/ < object type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core" < property name="ConfigSections" value="databaseSettings"/ < db:provider id="AMACDbProvider" provider="OracleClient-2.0" connectionString="Data Source=RISCODEVDB;User ID=amacdevuser; Password=amacuser1234;"/> < object id="NHibernateSessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject,Spring.Data.NHibernate12" < property name="DbProvider" ref="AMACDbProvider"/ <value> Risco.Rsp.Ac.AMAC.CacheMappings</value> </property> <dictionary> < entry key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" /> <entry key="hibernate.dialect" value="NHibernate.Dialect.Oracle9Dialect"/ value="NHibernate.Driver.OracleClientDriver"/ singleton="false" <property name="SessionFactory" ref="NHibernateSessionFactory" /> <property name="TemplateFlushMode" value="Auto" /> <property name="CacheQueries" value="true" /> <property name="EntityInterceptor" ref="AuditLogger"/> type="Spring.Data.NHibernate.HibernateTransactionManager, >Spring.Data.NHibernate12"> <property name="DbProvider" ref="AMACDbProvider"/> <property name="SessionFactory" ref="NHibernateSessionFactory"/> <property name="EntityInterceptor" ref="AuditLogger"/> type="Spring.Transaction.Interceptor.TransactionProxyFactoryObject,Spring.Data" <property name="PlatformTransactionManager" ref="transactionManager"/> <property name="Target" ref="EventPubSubDAO"/> <property name="TransactionAttributes"> <name-values> <add key="Save*" value="PROPAGATION_REQUIRES_NEW"/> <add key="Delete*" value="PROPAGATION_REQUIRED"/> </name-values> </property> type="Risco.Rsp.Ac.AMAC.DAO.EventPubSubMgmt.EventPubSubDAO, Risco.Rsp.Ac.AMAC.DAO.EventPubSubMgmt" < /object < tx:attribute-driven/ < /objects Please help me out with this issue.Thanks

    Read the article

  • springTestContextBeforeTestMethod failed in Maven spring-test

    - by joejax
    I try to setup a project with spring-test using TestNg in Maven. The code is like: @ContextConfiguration(locations={"test-context.xml"}) public class AppTest extends AbstractTestNGSpringContextTests { @Test public void testApp() { assert true; } } A test-context.xml simply defined a bean: <bean id="app" class="org.sonatype.mavenbook.simple.App"/> I got error for Failed to load ApplicationContext when running mvn test from command line, seems it cannot find the test-context.xml file; however, I can get it run correctly inside Eclipse (with TestNg plugin). So, test-context.xml is under src/test/resources/, how do I indicate this in the pom.xml so that 'mvn test' command will work? Thanks, UPDATE: Thanks for the reply. Cannot load context file error was caused by I moved the file arround in different location since I though the classpath was the problem. Now I found the context file seems loaded from the Maven output, but the test is failed: Running TestSuite May 25, 2010 9:55:13 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [test-context.xml] May 25, 2010 9:55:13 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.support.GenericApplicationContext@171bbc9: display name [org.springframework.context.support.GenericApplicationContext@171bbc9]; startup date [Tue May 25 09:55:13 PDT 2010]; root of context hierarchy May 25, 2010 9:55:13 AM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory INFO: Bean factory for application context [org.springframework.context.support.GenericApplicationContext@171bbc9]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1df8b99 May 25, 2010 9:55:13 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1df8b99: defining beans [app,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor]; root of factory hierarchy Tests run: 3, Failures: 2, Errors: 0, Skipped: 1, Time elapsed: 0.63 sec <<< FAILURE! Results : Failed tests: springTestContextBeforeTestMethod(org.sonatype.mavenbook.simple.AppTest) springTestContextAfterTestMethod(org.sonatype.mavenbook.simple.AppTest) Tests run: 3, Failures: 2, Errors: 0, Skipped: 1 If I use spring-test version 3.0.2.RELEASE, the error becomes: org.springframework.test.context.testng.AbstractTestNGSpringContextTests.springTestContextPrepareTestInstance() is depending on nonexistent method null Here is the structure of the project: simple |-- pom.xml `-- src |-- main | `-- java `-- test |-- java `-- resources |-- test-context.xml `-- testng.xml testng.xml: <suite name="Suite" parallel="false"> <test name="Test"> <classes> <class name="org.sonatype.mavenbook.simple.AppTest"/> </classes> </test> </suite> test-context.xml: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd" default-lazy-init="true"> <bean id="app" class="org.sonatype.mavenbook.simple.App"/> </beans> In the pom.xml, I add testng, spring, and spring-test artifacts, and plugin: <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>5.1</version> <classifier>jdk15</classifier> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring</artifactId> <version>2.5.6</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>2.5.6</version> <scope>test</scope> </dependency> <build> <finalName>simple</finalName> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <suiteXmlFiles> <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile> </suiteXmlFiles> </configuration> </plugin> </plugins> Basically, I replaced 'A Simple Maven Project' Junit with TestNg, hope it works. UPDATE: I think I got the problem (still don't know why) - Whenever I extends AbstractTestNGSpringContextTests or AbstractTransactionalTestNGSpringContextTests, the test will failed with this error: Failed tests: springTestContextBeforeTestMethod(org.sonatype.mavenbook.simple.AppTest) springTestContextAfterTestMethod(org.sonatype.mavenbook.simple.AppTest) So, eventually the error went away when I override the two methods. I don't think this is the right way, didn't find much info from spring-test doc. If you know spring test framework, please shred some light on this.

    Read the article

  • Just getting started in Spring and my preference is XML config over annotations. Correct or not?

    - by John Munsch
    After having read through some of the Spring docs my inclination is towards using a XML config file rather than annotations on the classes themselves. My reasoning is that by doing so you avoid tying your POJOs to a particular framework. Based on your experience with Spring, are there any advantages that XML configuration have over an annotation based configuration, and if not what are the disadvantages?

    Read the article

  • Spring to Java EE, Part Three - new tech article on otn/java

    - by Janice J. Heiss
    In a new article up on otn/java, Java EE expert David Heffelfinger continues his series exploring the relative strengths and weaknesses of Java EE and Spring. Here, he demonstrates how easy it is to develop the data layer of an application using Java EE, JPA, and the NetBeans IDE instead of the Spring Framework.In the first two parts of the series, he generated a complete Java EE application by using JavaServer Faces (JSF) 2.0, Enterprise JavaBeans (EJB) 3.1, and Java Persistence API (JPA) 2.0 from Spring’s Pet Clinic MySQL schema, thus showing how easy it is to develop an application whose functionality equaled that of the Spring sample application.In his new article, Heffelfinger tweaks the application to make it more user friendly.From the article:“The generated application displays primary keys on some of the pages, and these keys are surrogate primary keys—meaning that they have no business value and are used strictly as a unique identifier—so there is no reason why they should be visible to the user. In addition, we will modify some of the generated labels to make them more user-friendly.”He concludes the article with a summary:“The Java EE version of the application is not a straight port of the Spring version. For example, the Java EE version enables us to create, update, and delete veterinarians as well as veterinary specialties, whereas the Spring version of the application enables us only to view veterinarians and specialties. Additionally, the Spring version has a single page for managing/viewing owners, pets, and visits, whereas the Java EE version of the application has separate pages for each of these entities.The other thing we should keep in mind is that we didn’t actually write a lot of the code and markup for the Java EE version of the application, because the bulk of it was generated by the NetBeans wizard.” Have a look at the complete article here.

    Read the article

  • Confused as to how to validate spring mvc form, what are my options?

    - by Blankman
    Latest spring mvc, using freemarker. Hoping someone could tell me what my options are in terms of validating a form with spring mvc, and what the recommend way would be to do this. I have a form that doesn't map directly to a model, it has input fields that when posted, will be used to initialze 2 model objects which I will then need to validate, and if they pass I will save them. If they fail, I want to return back to the form, pre-fill the values with what the user entered and display the error messages. I have read here and there about 2 methods, once of which I have done and understand how it works: @RequestMapping(...., method = RequestMethod.POST) public ModelAndView myMethod(@Valid MyModel, BindingResult bindingResult) { ModelAndView mav = new ModelAndView("some/view"); mav.addObject("mymodel", myModel); if(bindingResult.hasErrors()) { return mav; } } Now this worked if my form mapped directly to the form, but in my situation I have: form fields that don't map to any specific model, they have a few properties from 2 models. before validation occurrs, I need to create the 2 models manually, set the values from the values from the form, and manually set some properties also: Call validate on both models (model1, model2), and append these error messages to the errors collection which I need to pass back to the same view page if things don't work. when the form posts, I have to do some database calls, and based on those results may need to add additional messages to the errors collection Can someone tell me how to do this sort of validation? Pseudo code below: Model1 model1 = new Model1(); Model2 model2 = new Model2(); // manually or somehow automatically set the posted form values to model1 and model2. // set some fields manually, not from posted form model1.setProperty10(GlobalSettings.getDefaultProperty10()); model2.setProperty11(GlobalSettings.getDefaultProperty11()); // db calls, if they fail, add to errors collection if(bindingResult.hasErrors()) { return mav; } // validation passed, save Model1Service.save(model1); Model2Service.save(model2); redirect to another view Update I have using the JSR 303 annotations on my models right now, and it would great if I can use those still. Update II Please read the bounty description below for a summary of what I am looking for.

    Read the article

  • Cocoa framework development: sharing between projects

    - by e.James
    I am currently developing a handful of similar Cocoa desktop apps. In an effort to share code between them, I have identified a set of core classes and functions that can be common across all of these applications. I would like to bundle this common code into a framework which all of my current applications (and any future ones) can link against. Now, here's the hard part: I'm going to be developing this framework as I go, so I need each of my desktop apps to have a reference to it, but I want to be able to edit the framework source code from within each of the app projects and have the framework automatically rebuilt as required. For example, let's say I have the Xcode project for DesktopAppNumberOne open, and I decide that one of my framework classes needs to be changed. I would like to: Open and edit the source file for that framework class without having to open the framework project in Xcode. Hit "build" on DesktopAppNumberOne, and see the framework rebuilt first (because one of its sources has changed), then see parts of DesktopAppNumberOne rebuilt (because one of the frameworks it links against has changed). I can see how to do this with only one app and one framework, but I'm having trouble figuring out how to do it with multiple apps that share a single framework. Has anyone had success with this approach? Am I perhaps going about this the wrong way? Any help would be appreciated.

    Read the article

  • .NET Framework installation requirements

    - by Paja
    What are the requirements for all .NET frameworks and their service packs? This is what I need to know for all available frameworks: .NET Framework prerequisites What other .NET Frameworks does it require? For example: .NET Framework 2.0 does not require anything, .NET Framework 2.0 SP1 requires .NET Framework 2.0 installed, but .NET Framework 3.5 SP1 does not require .NET Framework 3.5 installed (or maybe does? dunno) Reboot requirements Does the installation package require reboot after installation? Clean install requirements Does the installation package require clean install? (No pending delete/rename operations) Administrator privileges Does the installation package require administrator privileges to install? (I guess this is "yes" for all of them...) And I need to know all of this for the following packages: .NET Framework 1.1 .NET Framework 1.1 Language Pack .NET Framework 1.1 SP 1 .NET Framework 2.0 .NET Framework 2.0 Language Pack .NET Framework 2.0 SP 1 .NET Framework 2.0 SP 1 Language Pack .NET Framework 2.0 SP 2 .NET Framework 2.0 SP 2 Language Pack .NET Framework 3.5 .NET Framework 3.5 Language Pack .NET Framework 3.5 SP 1 .NET Framework 3.5 SP 1 Language Pack .NET Framework 4.0 Full .NET Framework 4.0 Client Could you please either tell me all of these requirements, or direct me to the appropriate source? Or maybe both? :-)

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >