Spring AOP pointcut is not well formed - spring

Exception in thread "main"
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0':
Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Could not
instantiate bean class
[org.springframework.aop.aspectj.AspectJPointcutAdvisor]: Constructor
threw exception; nested exception is
java.lang.IllegalArgumentException: Pointcut is not well-formed:
expecting 'name pattern' at character position 49
execution(*com.idol.performers.Performer.perform(..)
What is wrong with my pointcut? In book it says that
(..) // means taking any arguments
my xml:
...
<aop:before pointcut="execution(*com.idol.performers.Performer.perform(..))" method="takeSeats"/>
...

Try this:
<aop:before pointcut="execution(* com.idol.performers.Performer.perform(..))" method="takeSeats"/>
The issue is that you have no space between * and com.idol.performers.Performer.perform(..)

There should be space between * and com.idol.performers.Performer.perform(..)

Related

Spring Data: Mongo Repository can not be initialized

I'm getting this strange error message when I start my spring boot service:
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property storeMpi found for type Patient!
Service can't be started since this exception is raised.
My code is very straight:
public interface PatientRepository
extends MongoRepository<Patient, String>,
QuerydslPredicateExecutor<Patient>,
MPIPatientRepository
{
}
public interface MPIPatientRepository {
Patient storeMpi(Patient patient);
}
You can see, that storeMpi is a method, not an expected field of my Patient entity.
Implementation is straight as well:
#Repository
#RequiredArgsConstructor
public class MPIPatientRepository implements cat.gencat.catsalut.hes.mpi.repository.MPIPatientRepository {
private final MongoTemplate mongoTemplate;
/**
* {#inheritDoc}
*/
#Override
public Patient storeMpi(Patient patient) {
return this.mongoTemplate.save(patient);
}
I don't quite figure out what's wrong.
Formatted root CausedBy is:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ca.uhn.fhir.spring.boot.autoconfigure.FhirAutoConfiguration$FhirRestfulServerConfiguration': Bean instantiation via constructor failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [ca.uhn.fhir.spring.boot.autoconfigure.FhirAutoConfiguration$FhirRestfulServerConfiguration$$EnhancerBySpringCGLIB$$5fe4b535]: Constructor threw exception;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'patientResourceProvider' defined in file [/home/jeusdi/projects/salut/mpi/hes-mpi-fhir-mongodb/target/classes/cat/gencat/catsalut/hes/mpi/providers/PatientResourceProvider.class]: Unsatisfied dependency expressed through constructor parameter 0;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'patientService' defined in file [/home/jeusdi/projects/salut/mpi/hes-mpi-fhir-mongodb/target/classes/cat/gencat/catsalut/hes/mpi/service/PatientService.class]: Unsatisfied dependency expressed through constructor parameter 2;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'patientRepository' defined in cat.gencat.catsalut.hes.mpi.repository.PatientRepository defined in #EnableMongoRepositories declared on MongoRepositoriesRegistrar.EnableMongoRepositoriesConfiguration: Invocation of init method failed;
nested exception is org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract cat.gencat.catsalut.hes.mpi.model.Patient cat.gencat.catsalut.hes.mpi.repository.MPIPatientRepository.storeMpi(cat.gencat.catsalut.hes.mpi.model.Patient)! Reason: No property storeMpi found for type Patient!;
nested exception is org.springframework.data.mapping.PropertyReferenceException: No property storeMpi found for type Patient!
Any ideas?

UnsatisfiedDependencyException by Maven Packed war but not Intellij IDE why?

i am using Intellij IDE for my springboot project, while running my spring boot project it works fine. but when i create a war with mvn package and run with java -jar project.war it throwing the following error
Warning
2018-05-23 11:05:08.635 WARN 13025 --- [ main]
ationConfigEmbeddedWebApplicationContext : Exception encountered
during context initialization - cancelling refresh attempt:
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name HibernateJpaAutoConfiguration':
Unsatisfied dependency expressed through constructor parameter 0;
nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'dataSource' defined in class path resource
[com/myproject/config/DefaultDataSource.class]: Bean instantiation via
factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [com.mchange.v2.c3p0.ComboPooledDataSource]: Factory method
'dataSource' threw exception; nested exception is
java.lang.ExceptionInInitializerError
Exception
Error starting ApplicationContext. To display the auto-configuration
report re-run your application with 'debug' enabled.
2018-05-23 11:05:10.854 ERROR 13025 --- [ main]
o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name
'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/myproject/config/DefaultDataSource.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.mchange.v2.c3p0.ComboPooledDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.ExceptionInInitializerError
Code
#Configuration
public class DefaultDataSource {
#Autowired
DataBaseCreds dataBaseCreds;
#Bean
#Primary
public ComboPooledDataSource dataSource() {
ComboPooledDataSource dataSource = new ComboPooledDataSource();
try {
dataSource.setDriverClass(dataBaseCreds.getDB_DRIVER());
} catch (PropertyVetoException e) {
}
dataSource.setJdbcUrl(dataBaseCreds.getDB_URL());
dataSource.setUser(dataBaseCreds.getDB_USERNAME());
dataSource.setPassword(dataBaseCreds.getDB_PASSWORD());
dataSource.setMaxPoolSize(200);
return dataSource;
}
}
Sorry guys my mistake there were two versions of c3p0 libraries packed war file /WEB-INF/lib removed one works like charm - Thanks for reading

grails cdn-asset-pipeline plugin

We are currently using grails cdn-asset-pipeline plugin. For pushing our assets into s3. The cdn-asset-pipeline plugin use loadApp() inside _AssetCdn.groovy. Which causes JNDI issues. The JNDI is available in our production tomcat. When we use grails run-app we are able to run our app without issues. Can you let me know what changes we can do to overcome this issue.
_AssetCdn.groovy:
target(loadConfig: "Load CDN assets config") {
depends(compile, parseArguments)
if (argsMap['help']) {
println USAGE
exit 0
}
loadApp()
configureApp()
initKarman()
providers = []
def cdnAssetsConfig = grailsApp.config.grails.assets?.cdn
providers = cdnAssetsConfig.providers ?: []
if (!providers) {
def providerObject = [:]
providerObject.provider = argsMap['provider'] ?: cdnAssetsConfig?.provider ?: ''
providerObject.directory = argsMap['directory'] ?: cdnAssetsConfig?.directory ?: ''
providerObject.accessKey = argsMap['access-key'] ?: cdnAssetsConfig?.accessKey ?: ''
providerObject.secretKey = argsMap['secret-key'] ?: cdnAssetsConfig?.secretKey ?: ''
providerObject.region = argsMap['region'] ?: cdnAssetsConfig?.region ?: ''
providers << providerObject
}
When we run, the below command before building the war
grails asset-cdn-push --provider=S3 --directory="my directory" --gzip=true --storage-path="storage path" --access-key="access key" --secret-key="secret key"
The Error:
| Error executing script AssetCdnPush: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with
name 'transactionManager': Cannot resolve reference to bean 'transactionManager_bonita' while setting constructor argument with key [2]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager_bonita': Cannot resolve reference to
bean 'sessionFactory_bonita' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory_bonita': Cannot resolve reference to bean 'dataSource_bonita' while setting bean property 'dataSource
'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource_bonita': Cannot resolve reference to bean 'dataSourceLazy_bonita' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'dataSourceLazy_bonita': Cannot resolve reference to bean 'dataSourceUnproxied_bonita' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied_bonita': Invocatio
n of init method failed; nested exception is javax.naming.NameNotFoundException: Name [java:comp/env/bonitaDS] not bound; 2 bindings: [bonitaSequenceManagerDS,bonitaDS]
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied_bonita': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [java:comp/env/bonitaDS] not bound; 2 bindings: [bonitaSequenceManagerDS,
bonitaDS]
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied_bonita': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [java:comp/env/bonitaDS] not bound; 2 bindings: [bonitaSequenceManagerDS,
bonitaDS]
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied_bonita': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [java:comp/env/bonitaDS] not bound; 2 bindings: [bonitaSequenceManagerDS,
bonitaDS] (Use --stacktrace to see the full trace)

Inject date using #Value annotation

This is how I am trying to inject a date into a #Component class.
#Value("${new java.text.SimpleDateFormat(\"yyyyMMdd\").parse(\"${PROP_DATE}\")}")
Date myDate;
The date is specified as a String in properties file :
PROP_DATE=20110421
I get this error. What am I doing wrong? Is there any other way to inject Date property? Thanks.
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ccc': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: java.util.Date aaa.bbb.ccc.myDate; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'new java.text.SimpleDateFormat("yyyyMMdd").parse("20110421")'
Use #{new java.text.SimpleDateFormat(\"yyyyMMdd\").parse(\"${PROP_DATE}\")} for process value with spEL

Spring, Hibernate with google app engine

Project Name: CarpoolDB, I have added the jar for this project in another application name Carpool.
While running the Carpool app I am getting following exception.
Project: Carpool.
Here i am getting exception as "carpoolService" not getting autowired while running as "Google Web application" but same runs under Tomcat and beans properly get injected.
#Controller
public class PlacesSearchController {
#Autowired
CarpoolService carpoolService=null;
public CarpoolService getCarpoolService() {
return carpoolService;
}
public void setCarpoolService(CarpoolService carpoolService) {
this.carpoolService = carpoolService;
}
}
carpool-application-context1.xml
Also I have applicationContext-security.xml, for spring security.
Project: CarpoolDB
All class are in package, com.company.carpooldb.db
public interface CarpoolService {
public boolean validateUser(User user);
}
#Service("carpoolService")
public class CarpoolServiceImpl implements CarpoolService{
#Autowired
private CarpoolDao carpoolDao=null;
public CarpoolDao getCarpoolDao() {
return carpoolDao;
}
public void setCarpoolDao(CarpoolDao carpoolDao) {
this.carpoolDao = carpoolDao;
}
#Override
public boolean validateUser(User user) {
return carpoolDao.validateUser(user);;
}
}
public interface CarpoolDao {
public boolean validateUser(User user);
}
public class CarpoolDaoImpl extends HibernateDaoSupport implements CarpoolDao{
#Override
public boolean validateUser(User user) {
// TODO Auto-generated method stub
return false;
}
}
carpool-application-context.xml
<context:annotation-config />
<context:component-scan base-package="com.onmobile" />
<context:property-placeholder location="classpath:server.properties" />
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="mappingResources">
<list>
<value>com\company\carpooldb\hbm\User.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect"><!--Which dialect is used of hibernate according to type of underlying database-->
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">false</prop>
</props>
</property>
<property name="dataSource"><ref bean="dataSource"/></property>
</bean>
<beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<beans:property name="driverClassName"><beans:value>${cm.db.driverClassName}</beans:value></beans:property>
<beans:property name="url"><beans:value>${cm.db.url}</beans:value></beans:property>
<beans:property name="username"><beans:value>${cm.db.username}</beans:value></beans:property>
<beans:property name="password"><beans:value>${cm.db.password}</beans:value></beans:property>
<beans:property name="testOnBorrow"><beans:value>true</beans:value></beans:property>
<beans:property name="testOnReturn"><beans:value>true</beans:value></beans:property>
<beans:property name="validationQuery"><beans:value>select 1</beans:value></beans:property>
</beans:bean>
<!--Hibernate's transaction manager used for handling database transactions/manipulating data happening-->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager" >
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="carpoolDaoImpl" class="com.company.carpooldb.db.CarpoolDaoImpl">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
While running the application, I am getting exception as,
log4j:WARN Error during default initialization
java.lang.NoClassDefFoundError: java.io.FileOutputStream is a restricted class. Please see the Google App Engine developer's guide for more details.
at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
at org.apache.log4j.FileAppender.setFile(FileAppender.java:290)
.........
at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:162)
at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
at com.google.appengine.tools.development.DevAppServerMain.<init>(DevAppServerMain.java:113)
at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:89)
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
11 Nov, 2012 5:14:18 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: Failed startup of context com.google.apphosting.utils.jetty.DevAppEngineWebAppContext#5e55ab{/,D:\EclipseEuropa\CarpoolingGAE\war}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'placesSearchController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.onmobile.carpooldb.db.CarpoolService com.onmobile.carpool.controller.PlacesSearchController.carpoolService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carpoolService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.onmobile.carpooldb.db.CarpoolDao com.onmobile.carpooldb.db.CarpoolServiceImpl.carpoolDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carpoolDaoImpl' defined in class path resource [carpool-application-context.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [carpool-application-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: java.net.InetAddress is a restricted class. Please see the Google App Engine developer's guide for more details.
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1064)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
.........
at com.google.appengine.tools.development.DevAppServerMain.<init>(DevAppServerMain.java:113)
at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:89)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.onmobile.carpooldb.db.CarpoolService com.onmobile.carpool.controller.PlacesSearchController.carpoolService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carpoolService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.onmobile.carpooldb.db.CarpoolDao com.onmobile.carpooldb.db.CarpoolServiceImpl.carpoolDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carpoolDaoImpl' defined in class path resource [carpool-application-context.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [carpool-application-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: java.net.InetAddress is a restricted class. Please see the Google App Engine developer's guide for more details.
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:507)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:283)
... 31 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carpoolService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.onmobile.carpooldb.db.CarpoolDao com.onmobile.carpooldb.db.CarpoolServiceImpl.carpoolDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carpoolDaoImpl' defined in class path resource [carpool-application-context.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [carpool-application-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: java.net.InetAddress is a restricted class. Please see the Google App Engine developer's guide for more details.
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1064)
.... at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:780)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:697)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)
... 33 more
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.onmobile.carpooldb.db.CarpoolDao com.onmobile.carpooldb.db.CarpoolServiceImpl.carpoolDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carpoolDaoImpl' defined in class path resource [carpool-application-context.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [carpool-application-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: java.net.InetAddress is a restricted class. Please see the Google App Engine developer's guide for more details.
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:507)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:283)
... 44 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carpoolDaoImpl' defined in class path resource [carpool-application-context.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [carpool-application-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: java.net.InetAddress is a restricted class. Please see the Google App Engine developer's guide for more details.
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
.... at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:697)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)
... 46 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [carpool-application-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: java.net.InetAddress is a restricted class. Please see the Google App Engine developer's guide for more details.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
.... at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
... 59 more
Caused by: java.lang.NoClassDefFoundError: java.net.InetAddress is a restricted class. Please see the Google App Engine developer's guide for more details.
at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
.... at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1457)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
... 66 more
11 Nov, 2012 5:14:18 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'placesSearchController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.onmobile.carpooldb.db.CarpoolService com.onmobile.carpool.controller.PlacesSearchController.carpoolService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carpoolService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.onmobile.carpooldb.db.CarpoolDao com.onmobile.carpooldb.db.CarpoolServiceImpl.carpoolDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'carpoolDaoImpl' defined in class path resource [carpool-application-context.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [carpool-application-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: java.net.InetAddress is a restricted class. Please see the Google App Engine developer's guide for more details.:
java.lang.NoClassDefFoundError: java.net.InetAddress is a restricted class. Please see the Google App Engine developer's guide for more details.
at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
at org.hibernate.id.AbstractUUIDGenerator.<clinit>(AbstractUUIDGenerator.java:22)
......at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:697)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:283)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1064)
.....
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:697)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:283)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1064)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
..... at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:89)
The server is running at http://localhost:8888/
Why I am getting as
1. java.lang.NoClassDefFoundError: java.io.FileOutputStream is a restricted class.
I am not writing anything on file
GAE doesn't support few API that I am aware of but my application already working for MySQL and I want to support both. I mean based on property set in my property file I want to use sometime MySQL and sometime want to work with GAE datastore.
I am using spring 3.
What I should do in this case?
As Boris notes, the issue appears to be with your session factory. GAE doesn't support jdbc, and it looks like your sessionFactory is configured for mysql:
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect"><!--Which dialect is used of hibernate according to type of underlying database-->
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">false</prop>
</props>
</property>
If you're working with an existing codebase that depends on Hibernate, you could try configuring Hibernate to run backed by Cloud SQL: https://developers.google.com/appengine/articles/using_hibernate
As for the FileOutputStream issue, I believe one of the default appenders for log4j is a FileAppender, so simply not configuring log4j won't fix it - you'll need to explicitly configure it. See if this page helps: http://blog.xam.de/2010/03/logging-in-google-appengine-for-java.html

Resources