Issue JNDI resource initialization - DB connection #"DB2 on Cloud - BLUEMIX - db2

We are unable to make DB2 database connection from Java application deployed on "Liberty on Java" using JNDI resource at Bluemix.
It is not able to initialize the resource.
My server.xml file is
"<dataSource id="eVotingDataSource" jdbcDriverRef="db2-driver" jndiName="jdbc/DatabaseName" type="javax.sql.DataSource">
<properties.db2.jcc id="eVotingDataSource-props" databaseName="*******" user="db2inst1" password="******" portNumber="50001" serverName="********" sslConnection="true"/>
</dataSource>
<jdbcDriver id="db2-driver" libraryRef="db2-library"/>
<library id="db2-library">
<fileset id="db2-fileset" dir="${server.config.dir}/lib" includes="db2jcc4.jar db2jcc_license_cu.jar"/>
</library>
Web.xml file
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/DatabaseName</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
applicationContext.xml file
<jee:jndi-lookup id="eVotingDataSource"
jndi-name="jdbc/DatabaseName"
expected-type="javax.sql.DataSource" />
Below is output of messages.log
org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.nl.abnamro.evoting.dao.IssuerDAOImpl.eVotingSessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eVotingSessionFactory' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'eVotingDataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eVotingDataSource': Invocation of init method failed; nested exception is javax.naming.NamingException: CWWKN0008E: An object could not be obtained for name jdbc/DatabaseName.
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eVotingDataSource': Invocation of init method failed; nested exception is javax.naming.NamingException: CWWKN0008E: An object could not be obtained for name jdbc/DatabaseName.
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eVotingMailSource': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Intermediate context does not exist: mail/Session
When we load the application we receive the following error:
Error 500: javax.servlet.ServletException: Filter [springSecurityFilterChain]: could not be initialized
Could you please assist?

The error you are receiving is related with this configuration from your server.xml
jndiName="**jdbc/DatabaseName**"
CWWKN0008E: An object could not be obtained for name **jdbc/DatabaseName**.
If you are using a DB service bound using Bluemix, the runtime is automatically configured when your application is staging, so you usually don't need to provide your own configuration in your server.xml overwriting the Bluemix configuration.
Instead, if you need to overwrite the server.xml for your own configurations, you could access the DB service references on your Bluemix page, on the Bluemix console under the 'Environment Variables' section
You could retrieve the DBService name to use inside your server.xml as JNDI/[DBNAME]
You could also retrieve the right Datasource to use simply deploying your app on Bluemix without overwriting the server.xml and check on the Bluemix UI (under Files section) the value of the Datasource on the produced server.xml
Just a little question: Could you confirm that you are pushing your application along with your server.xml, within a packaged version of your liberty run-time ?

Related

Alfresco Community 7.1 Cannot Authenticate with Keycloak Server when Keycloak use Self Sign Certificate

I have test Alfresco Community 7.1 with Keycloak.
My Keycloak use https (self signed certificate)
My alfresco-global.properties (Alfresco Repository)
authentication.chain=identity-service1:identity-service,alfrescoNtlm1:alfrescoNtlm
identity-service.enable-basic-auth=true
identity-service.authentication.validation.failure.silent=false
identity-service.auth-server-url=https://192.168.10.25/auth
identity-service.realm=guru
identity-service.resource=alfresco-client
identity-service.public-client=true
identity-service.ssl-required=none
csrf.filter.referer=https://192.168.11.22:443
csrf.filter.origin=https://192.168.11.22:443/*
aims.enabled=true
aims.realm=guru
aims.resource=alfresco-client
aims.authServerUrl=https://192.168.10.25/auth
aims.publicClient=true
My share-config-custom.xml (Alfresco Share)
<alfresco-config>
<config evaluator="string-compare" condition="Users" replace="true">
<users>
<username-min-length>2</username-min-length>
<password-min-length>3</password-min-length>
<show-authorization-status>false</show-authorization-status>
</users>
<enable-external-users-panel>false</enable-external-users-panel>
</config>
<config evaluator="string-compare" condition="AIMS">
<enabled>true</enabled>
<realm>guru</realm>
<resource>alfresco-client</resource>
<authServerUrl>https://192.168.10.25/auth</authServerUrl>
<sslRequired>none</sslRequired>
<publicClient>true</publicClient>
</config>
</alfresco-config>
When I start alfresco with docker compose command. It show error like this
alfresco_1 | 2022-03-01 06:41:33,478 WARN [context.support.XmlWebApplicationContext] [main] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'patch.updateAdminUserWhenDefault' defined in URL [jar:file:/usr/local/tomcat/webapps/alfresco/WEB-INF/lib/alfresco-repository-12.23.jar!/alfresco/patch/patch-services-context.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationComponent' defined in URL [jar:file:/usr/local/tomcat/webapps/alfresco/WEB-INF/lib/alfresco-repository-12.23.jar!/alfresco/subsystems/Authentication/identity-service/identity-service-authentication-context.xml]: Cannot resolve reference to bean 'authenticatorAuthzClient' while setting bean property 'authenticatorAuthzClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticatorAuthzClient': FactoryBean threw exception on object creation; nested exception is java.lang.RuntimeException: Could not obtain configuration from server [https://192.168.10.25/auth/realms/guru/.well-known/uma2-configuration].
alfresco_1 | 2022-03-01 06:41:33,854 INFO [management.subsystems.ChildApplicationContextFactory] [main] Stopping 'Authentication' subsystem, ID: [Authentication, managed, alfrescoNtlm1]
alfresco_1 | 2022-03-01 06:41:33,856 INFO [management.subsystems.ChildApplicationContextFactory] [main] Stopped 'Authentication' subsystem, ID: [Authentication, managed, alfrescoNtlm1]
alfresco_1 | 2022-03-01 06:41:33,866 ERROR [web.context.ContextLoader] [main] Context initialization failed
alfresco_1 | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'patch.updateAdminUserWhenDefault' defined in URL [jar:file:/usr/local/tomcat/webapps/alfresco/WEB-INF/lib/alfresco-repository-12.23.jar!/alfresco/patch/patch-services-context.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationComponent' defined in URL [jar:file:/usr/local/tomcat/webapps/alfresco/WEB-INF/lib/alfresco-repository-12.23.jar!/alfresco/subsystems/Authentication/identity-service/identity-service-authentication-context.xml]: Cannot resolve reference to bean 'authenticatorAuthzClient' while setting bean property 'authenticatorAuthzClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticatorAuthzClient': FactoryBean threw exception on object creation; nested exception is java.lang.RuntimeException: Could not obtain configuration from server [https://192.168.10.25/auth/realms/guru/.well-known/uma2-configuration].
[Alfresco Repository Error]
: https://i.stack.imgur.com/4yHl4.jpg
[Alfreso Share Error][1]
: https://i.stack.imgur.com/FePSJ.jpg
But if I use another Keycloak Server on Public Cloud with Valid Certificate (Lets Encrypt) It can work without problem.
My Question is, How to configure alfresco to use with Keycloak Internal Server which use Self Sign Certificate.
Thank you

Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' [duplicate]

This question already has answers here:
javax.persistence.PersistenceException : [PersistenceUnit: vodPersistenceUnit] class or package not found
(4 answers)
Closed 5 years ago.
Error creating bean with name
'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in URL [file:/E:/source-files-healthentic/securityadmin/build/test/classes/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [file:/E:/source-files-healthentic/securityadmin/build/test/classes/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Must start with Java agent to use InstrumentationLoadTimeWeaver. See Spring documentation.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in URL [file:/E:/source-files-healthentic/securityadmin/build/test/classes/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [file:/E:/source-files-healthentic/securityadmin/build/test/classes/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Must start with Java agent to use InstrumentationLoadTimeWeaver. See Spring documentation.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:411)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:382)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:271)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:268)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:170)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:597)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:366)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
at org.apache.struts2.StrutsSpringTestCase.setupBeforeInitDispatcher(StrutsSpringTestCase.java:39)
at org.apache.struts2.StrutsTestCase.setUp(StrutsTestCase.java:208)
at healthentic.admin.action.StrutsSpringBase2Setup.setUp(StrutsSpringBase2Setup.java:128)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [file:/E:/source-files-healthentic/securityadmin/build/test/classes/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Must start with Java agent to use InstrumentationLoadTimeWeaver. See Spring documentation.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1330)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:411)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:382)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:271)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:268)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:174)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:309)
at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:266)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:122)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.<init>(PersistenceExceptionTranslationInterceptor.java:78)
at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.<init>(PersistenceExceptionTranslationAdvisor.java:70)
at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:97)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1318)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:475)
Caused by: java.lang.IllegalStateException: Must start with Java agent to use InstrumentationLoadTimeWeaver. See Spring documentation.
at org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver.addTransformer(InstrumentationLoadTimeWeaver.java:88)
at org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo.addTransformer(SpringPersistenceUnitInfo.java:80)
at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:225)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:224)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:291)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1361)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1327)
I'm getting this error when running my application(using Struts2 spring3 integrated and jpa eclipse link ) junit test.... how can i resolve this problem................ kindly check ans suggest me....
To help others with this issue,
I have he same problem after including some of the APIS thst uses later Spring (3.x.) versions to the existing project.
My application was started up successfully in one machine but failed on another machine. After investigating carefully we found this,
On the machine it was failing, the PersistenceExceptionTranslationPostProcessor was loaded from spring-dao-2.0.8.jar
[Loaded org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor from file:/lib/spring-dao-2.0.8.jar]
Where as on the other machine it was loaded from spring-tx-3.1.1.RELEASE.jar
[Loaded org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor from file:/lib/spring-tx-3.1.1.RELEASE.jar]
Then I tried removing the spring-dao-2.0.8.jar from the class-path and tried, it worked.
spring-dao-2.0.8.jar was an unnecessary dependency.
Regards
Lyju
The error states,
"Must start with Java agent to use InstrumentationLoadTimeWeaver. See Spring documentation."
so, you either need to use the Spring Java agent to start your JVM, or need to disable the InstrumentationLoadTimeWeaver.
See,
How to configure EclipseLink 2.0 and Spring 3.0.5 and Tomcat 6?
For JPA weaving with EclipseLink, you can also use the static weaver, then no agent or instrumentation is required.

How to change the liferay database to mysql database

I have downloaded the liferay6 bundle with tomcat.I need to change the liferay database to mysql database.I have searched in google and as per information i have created the portal-ext.properties with below lines of code.
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=root
jdbc.default.password=root123
jdbc.default.jndi.name=jdbc/LiferayPool
schema.run.enabled=true
schema.run.minimal=true
and i modified the ROOT.xml.Now the code in that file is :
<Context path="" crossContext="true">
<Resource
name="jdbc/LiferayPool"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8"
username="root"
password="root123"
maxActive="20"
/>
</Context>
and i have created the lportal database in mysql.Do i need to modify anything more.If i do like this i am not even able to see the default login page of liferay.Can anyone point me where i am doing wrong.Thank You.
I am getting the below Exception if i am doing like this.
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at java.net.Socket.<init>(Socket.java:425)
at java.net.Socket.<init>(Socket.java:241)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:271)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2744)
at com.mysql.jdbc.Connection.<init>(Connection.java:1553)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:148)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.spring.aop.ServiceBeanAutoProxyCreator#0' defined in class path resource [META-INF/base-spring.xml]: Cannot resolve reference to bean 'serviceAdvice' while setting bean property 'methodInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceAdvice' defined in class path resource [META-INF/base-spring.xml]: Cannot resolve reference to bean 'asyncAdvice' while setting bean property 'nextMethodInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'asyncAdvice' defined in class path resource [META-INF/base-spring.xml]: Cannot resolve reference to bean 'threadLocalCacheAdvice' while setting bean property 'nextMethodInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'threadLocalCacheAdvice' defined in class path resource [META-INF/base-spring.xml]: Cannot resolve reference to bean 'bufferedIncrementAdvice' while setting bean property 'nextMethodInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bufferedIncrementAdvice' defined in class path resource [META-INF/base-spring.xml]: Cannot resolve reference to bean 'indexableAdvice' while setting bean property 'nextMethodInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'indexableAdvice' defined in class path resource [META-INF/base-spring.xml]: Cannot resolve reference to bean 'transactionAdvice' while setting bean property 'nextMethodInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionAdvice' defined in class path resource [META-INF/base-spring.xml]: Cannot resolve reference to bean 'liferayTransactionManager' while setting bean property 'platformTransactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liferayTransactionManager' defined in class path resource [META-INF/hibernate-spring.xml]: Cannot resolve reference to bean 'liferayHibernateSessionFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liferayHibernateSessionFactory' defined in class path resource [META-INF/hibernate-spring.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
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.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1327)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1085)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:710)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:410)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at com.liferay.portal.spring.context.PortalContextLoaderListener.contextInitialized(PortalContextLoaderListener.java:172)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:649)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1585)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
1-updating java connector driver
be sure that the liferay portal is not started ! if it does, then shut down.
download and install MySQL and HeidiSQL, you can simply create mysql database via HeidiSql.
download mysql.jar (Connector/J) from dev.mysql.com
you may not login just go below in page and click link: No thanks, just start my download.
delete mysql.jar in liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\lib\ext
copy mysql-connector-java-some version-bin.jar in
\Program Files(x86)\MySQL\Connector J folder and
paste it in liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\lib\ext .(don't forget to rename it to mysql.jar)
2- work with control panel of liferay
now you can start liferay portal
open in browser localhost:8080/
go to -> control panel -> server administration -> Data Migration
JDBC Driver Class Name:
com.mysql.jdbc.Driver
JDBC URL:
jdbc:mysql://localhost:3306/DB-NAME?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
DB-NAME - name of database you've created earlier.
write MySQL username and password then click the button below.
now in the next page you can see some text in the *red border*like : The system is currently undergoing maintenance. Please try again later.
It's allright. just wait for .. may be half an hour or more or less, just wait, and be patient))
while process is going, you can do the next last step:
3- change portal properties
open file portal-ext.properties (create it if doesn't exist) in liferay-portal-6.1.1-ce-ga2\tomcat-7.0.27\webapps\ROOT\WEB-INF\classes and paste to this file following text:
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost:here must be DB port, by default it's 3306/*DB_NAME*?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=username of MySQL user
jdbc.default.password=password of MySQL user
THAT'S IT
RESTART TOMCAT SERVER
In your portal-ext.properties file, it should be enough if you specif JNDI name to lookup.
jdbc.default.jndi.name=MyDataSource
In your Tomcat's xml file,
<Resource
name="MyDataSource"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8"
username="root"
password="root123"
maxActive="20"
/>
Make sure that the user you are using above (root) has privilege to create the tables.
Also, don't forget to restart your Tomcat container.
Even on top of this if it doesn't work, share the exceptions in your (bin) logs.

error on integrating spring data jpa with spring batch admin

o.s.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productfeedSvc':
Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field:
private com.dealwallet.productFeed.repository.ProductFeedRepository
com.dealwallet.productFeed.svc.impl.ProductSvcImpl.productFeedRepository;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productFeedRepository': Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: **org.springframework.transaction.interceptor.TransactionInterceptor.setTransactionManagerBeanName(Ljava/lang/String;)**V
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287) ~[spring-beans-3.1.2.RELEASE.jar:3.1.2.RELEASE]
I am using spring data jpa with spring batch admin,
i configured application-context.xml and persistance.xml,
when am running this in tomcat i got this error.
It says there is problem in auto-wiring.
So check these items:
- Make sure your class (the one which is using the other) has setter for that property.
- Make sure your class's property (the one which is using the other) has the exact name of the other class bean id.
- Make sure you have enabled annotations.

JBoss 6 DataSource JNDI Not Found

I am trying to deploy .war file on JBoss 6 and I have made MySql datasource which I want to access using JNDI.
My Config looks like this :
in myDB-mysql-ds.xml
jndi-name : MyDataSource
in jboss-web.xml
res-ref-name : jdbc/MyDataSource
res-type : javax.sql.DataSource
jndi-name : java:/MyDataSource
in applicationContext.xml
property name="jndiName"
& its value : java:comp/env/jdbc/MyDataSource
When I deploy this war file, It gets bound to MyDatasource like,
INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=MyDataSource' to JNDI name 'java:MyDataSource'
but still I get error :
ERROR [[/AppName]] Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: JNDI object with [java:comp/env/jdbc/MyDataSource] not found: JNDI implementation returned null
It is because you are accessing it some wrong way. You should do the following,
<use-java-context>false</use-java-context>
and then access it by its JNDI name.