Not able to run java EE project - java

I have an existing java (EE) project, which I am trying to run from eclipse. I have imported that project in eclipse and added the tomcat7 server. But when I am running the project, it is giving spring error as
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'seoDestinationsDataSource' defined in class path resource [spring/fn-landing-persistence-context.xml]: Could not resolve placeholder 'seodestinations.db.driverClassName' in string value "${seodestinations.db.driverClassName}"
Please find below snapshot of error.
Image
What is the step i am missing. Please advise. Thanks for help.

Related

Spring Boot 2 Upgrade not able to resolve class name as property

We have an application where one of our internal libraries has defined a bean like this
<bean id="myBean" class="${myBean.type}"/>
We have a Spring Cloud Config Server which feeds properties to this application on startup, which also contains the property myBean.type. This setup is currently working fine with no issues. I then made the following change to my pom
Earlier
<spring.boot.version>1.5.16.RELEASE</spring.boot.version>
<spring.cloud.version>Edgware.RELEASE</spring.cloud.version>
<spring.version>4.3.19.RELEASE</spring.version>
Now
<spring.boot.version>2.0.9.RELEASE</spring.boot.version>
<spring.version>5.0.13.RELEASE</spring.version>
<spring.cloud.version>Finchley.SR2</spring.cloud.version>
Then I started getting this error on startup
An attempt was made to call the method org.springframework.beans.factory.support.BeanDefinitionBuilder.addConstructorArg(Ljava/lang/Object;)Lorg/springframework/beans/factory/support/BeanDefinitionBuilder; but it does not exist. Its class, org.springframework.beans.factory.support.BeanDefinitionBuilder, is available from the following locations:
jar:file:/I:/Library/MavenRepository/org/springframework/spring-beans/5.0.13.RELEASE/spring-beans-5.0.13.RELEASE.jar!/org/springframework/beans/factory/support/BeanDefinitionBuilder.class
It was loaded from the following location:
file:/I:/Library/MavenRepository/org/springframework/spring-beans/5.0.13.RELEASE/spring-beans-5.0.13.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.beans.factory.support.BeanDefinitionBuilder
Looking at this, I excluded the artifact org.apache.cxf:cxf-api:jar:2.7.18:compile from all the jars that depended on it & upgraded cxf jars versions to 3.2.5. Now the startup is going ahead but it is giving me the following error:
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [${myBean.type}] for bean with name 'myBean' defined in class path resource [xyz.xml]; nested exception is java.lang.ClassNotFoundException: ${myBean.type}
I am not sure if removal of cxf-api is causing this issue, or upgrade of Spring Boot 2, or is it something else that is going wrong here!

Deploy custom task model Alfresco Community 5.1

I'm trying to deploy my custom workflow (with custom task model) following Jeff Potts's tutorial. All seems to work fine, until I try to initialize build-in Alfresco and login on it.
That's an extract of the output:
2016-07-08 11:49:52,163 ERROR [web.context.ContextLoader] [localhost-startStop-1] Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.someco.scripts.GetReview] for bean with name 'webscript.com.someco.bpm.review.get' defined in class path resource [alfresco/module/someco-repo/context/service-context.xml];
And a lot of exceptions below.
I guess it is an error at service-context.xml file, but I don't know how to well-form that file.
Verify that you have created the webscript class under the same package and with the same name as Jeff Potts because, in your log, spring doesn't found it. Or edit the class attribute in your service-context.xml
For future questions about this, solution was to download and install all dependencies using Maven.

ambiguous mapping while deploying

I'm using Jenkins 1.6.20 (Git Client Plugin 1.18.0, Git Plugin 2.4.0) to get the Java application code from bitbucket.org and deploy it to Apache Tomcat 8.0.23.
The error appears while deploying and looks like:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/spr$
public java.util.List by.ipps.accounting.ws.PositionWS.getEmployeePost(java.lang.Long)
to {[/positionListJson/{id}],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json],custom=[]}: There is already 'resourceWS' bean method
public by.ipps.accounting.model.Employee.EmployeePost by.ipps.accounting.ws.ResourceWS.getEmployeePost(java.lang.Long) mapped.
bla-bla-bla ... so many errors ...
Caused by: java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'positionWS' bean method
public java.util.List by.ipps.accounting.ws.PositionWS.getEmployeePost(java.lang.Long)
to {[/positionListJson/{id}],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json],custom=[]}: There is already 'resourceWS' bean method
public by.ipps.accounting.model.Employee.EmployeePost by.ipps.accounting.ws.ResourceWS.getEmployeePost(java.lang.Long) mapped.
The problem is that the class (with annotation #Controller) PositionWS with method getEmployeePost was renamed to ResourceWS a week ago, so exists no more, so I should not get this error.
To fix this I have to create a blank PositionWS controller (with no methods in it), commit & push that to bitbucket (and delete (cus i really don't need it) later and commit & push).
It seems to be like a bug in any of the applications I use. I can't find out in which app there is a bug to report it. Tell me please, if anyone faced such problems.
The heart of the issue was in incorrect configuration of Jenkins, it was my fault.
When I was configuring Jenkins I set maven goal as "install", but it must be "clean install". According to this Jenkins never deleted old files and kept them, so got a lot of issues of different kinds and with different log messages.
Due to Jenkins working specialty it downloads project files and try to assemble it on path /var/lib/jenkins/jobs/<projectName>/workspace/target/.
So I've drop the data in this folder and afterwards set maven goal to "clean install" and that fixed the issue.

Class path resource not found randomly

We have integrated Spring with Hibernate and Struts2 in Eclipse and have been getting these errors when running the build:
14-Oct-2011 10:37:27 org.apache.catalina.core.StandardContext listenerStart
SEVERE: 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 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [Test.hbm.xml] cannot be opened because it does not exist
...
Caused by: java.io.FileNotFoundException: class path resource [Test.hbm.xml] cannot be opened because it does not exist
...
Our mapping in applicationContext.xml is:
<property name="mappingResources" value="Test.hbm.xml" />
Test.hbm.xml is in /build/classes, and we have tried putting it in /WEB-INF, /src, and even created a new source folder called /hibernate and dumped it in and it worked on only a few machines.
The first time we wrote it, it showed this error. And then we copied the exact same code into a new project, it suddenly worked. On some machines, it works; on others, it shows this error.
Does anyone know what could be wrong? Let me know if any other information is needed.
Thanks so much.
That's not a build-time error. It's a run-time one. Intermittent failures of that sort indicate a problem with your build, though. As a classpath resource, Test.hbm.xml must be in a classpath location when you run your app. Where exactly that is depends on how you're running it, but /WEB-INF will never work for a webapp, and a random /hibernate folder is unlikely to work, too, unless you've done some custom configuration to make that a classpath resource or make it build to one. For a more definitive answer, you'll need to provide more detail about what you're running and how you're building it.

Tomcat - unable to open logs - unable to deploy

I am trying to deploy a web app on an Ubuntu system. The WAR is an EXPLODED folder. There are no issues with build. But I am unable to deploy to Tomcat6 server. Everything was working fine. Same Code, Same files. All of a sudden, unable to deploy.
The main difference I find now is that - the logs at /var/lib/tomcat6/logs - localhost.2010-11-01.log is locked and can be opened only by root user. Dont understand why?
Because of this issue, I am getting the following error (from localhost.2010-11-01.log):
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
Is my issue related to
BeanCreationException in Spring Framework .WAR deploy to Tomcat 6 on Ubuntu 9.10?
Update1:
The issue of Tomcat logs being readable by root user is gone now. However, these ERRORs remain.
SEVERE: 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 'africa' defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
Cannot resolve reference to bean 'antarctica' while setting bean property 'antarctica'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'antarctica' defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
Cannot resolve reference to bean 'australia' while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'australia' defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
Invocation of init method failed; nested exception is java.lang.Exception: Unexpected line
Warning: mysql_connect(): Lost connection to MySQL server during query in .... #ERROR:Too Many Connections!
Update 2:
Just switched on my Ubuntu system. Only firefox running at the moment. No Eclipse or other software running. Did not shutdown or restart Tomcat. Just tried to launch the web app thru Tomcat Manager application (http://localhost:8080/manager/html) - the same thing I had been trying before.
Result: Web app gets launched with no issues!
I have absolutely NO CLUE why this did not work before. Also, NO CLUE why it's working now, if at all there was a serious issue. I WASTED one whole day :(.
if you set-up logging like so: Tomcat startup logs - SEVERE: Error filterStart how to get a stack trace?
Then at least you will get the stack trace.

Categories

Resources