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.
Related
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.
EDIT: Before reading the question: deleting the folder in wildfly deployment "solved" the issue. But I didn't put back my code for the other DB. Is the way I did it was right?
I was working this morning, everything was going fine.
I added a dependency which is the core of another maven project and the goal was to use that project to add data in the database of that project, not the one of my current project.
So I tried a lot of stuff, but at the end it was working. And then, I left to go eat.
The server is host on my computer, so localhost and I left it like that for about an hour.
Here's what I did:
Create new hibernate.cfg.xml in src/main/resources with properties.
So I had 2 hibernate.cfg.xml in my project. The original one in src/main/resources/my/hibernate/package/ and the new one in the default package.
In my code ->
Configuration cfg = new Configuration();
cfg.configure();
Note that before doing only that, I was setting the properties programmatically and it was working fine.
I thought it was taking the one in default package. That was working earlier.
So I came back, try to run the application and get this exception:
Nested exception: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
I haven't touch a thing... so I removed all my work (the new hibernate.cfg.xml too), restarted the server, even the computer.
I read about the exception, it says that maybe I have two dom4j, or that I need to put <scope>provided</scope> to some dependencies.
I added the scope everywhere, removed the dependency of the other project, but it won't help.
I have these logs in my wildfly server.log
WFLYCTL0186: Services which failed to start:
service jboss.undertow.deployment.default-server.default-host./PROJECT_NAME:
org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./PROJECT_NAME:
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'firstControllerInMyDispatcher':
Unsatisfied dependency expressed through field 'DAO_name':
Error creating bean with name 'DAO_name' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]:
Cannot resolve reference to bean 'mySessionFactory' while setting constructor argument;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]:
Invocation of init method failed;
nested exception is org.hibernate.InvalidMappingException:
Unable to read XML;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'DAO_name' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]:
Cannot resolve reference to bean 'mySessionFactory' while setting constructor argument;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]:
Invocation of init method failed;
nested exception is org.hibernate.InvalidMappingException:
Unable to read XML
The dom4j exception only shows in the Netbeans console log and it's after all those same lines:
"{\"WFLYCTL0080: Failed services\" => {\"[previous exceptions lines]
Caused by:
org.dom4j.DocumentException:
org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory Nested exception:
org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory\"}}"
I'm clueless, can anyone help with this? Thanks.
This error I see everywhere but I still find no solution to my deployment.
I am using Eclipse Luna, jdk6, Spring, hibernate (3.3.2 GA), and maven 3.2.3, I run the application on a glassfish 3.1.2 server and then I receive this error in my server's log:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stateMachineManager' defined in URL [jar:file:/C:/glassfish3/glassfish/domains/domain2/applications/moon-web-1.0/WEB-INF/lib/moon-commons-1.0.jar!/spring/context/orm/applicationContext-orm.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheDAO': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [jar:file:/C:/glassfish3/glassfish/domains/domain2/applications/moon-web-1.0/WEB-INF/lib/moon-commons-1.0.jar!/spring/context/orm/applicationContext-orm.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V
I found somewhere that this may be caused by the cglib (1.2_3) that I have replaced with cglib-nodep(1.2_3) and removed the asm as mentionned in some questions already asked. I am still receiving the same error on deployment.
Any help is most appreciated. Thanks in advance.
EDIT: The original error thrown by glassfish is the following, I only traced the first "caused by" for the above error:
[#|2014-12-19T16:09:41.997+0100|SEVERE|oracle-glassfish3.1.2|com.sun.xml.ws.server.http|_ThreadID=21;_ThreadName=Thread-2;|WSSERVLET11 : échec de l'analyse du descripteur d'exécution : java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
As far as I know "init" methods are used to implement constructors in bytecode. So I think there is a wrong constructor call. There is no ClassWriter constructor which accepts boolean argument. Please try to use latest asm jar.
So I have solved the issue. I noticed that in the log file of my glassfish server there was an error mentionning unability to find my reference to the handlerchain for my webservices. After googling this, i found this was a bug reported in the 3.1.2.2 version of glassfish. The solution hence is just to upgrade the server. I run currently glassfish 4.1 with the respective jre7 of course and my application is deployed successfully.
Thanks everyone, I hope this solves someone else's problem one day!
I ran into a problem trying to use Spring-roo in STS ide.
I created a project and added EclipseLink ORM, and that is about it.
In persistence.xml i added all the details for the database connectivity.
When I tried to run the spring project, it failed to show the default jspx page i was expecting.
Here is the error:
2012-07-02 10:45:39,411 [pool-2-thread-1] ERROR org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in file [/home/ubuntu/springsource/vfabric-tc-server-developer-2.7.0.RELEASE/spring-insight-instance/wtpwebapps/SpringRooStats/WEB-INF/classes/META-INF/spring/applicationContext.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in file [/home/ubuntu/springsource/vfabric-tc-server-developer-2.7.0.RELEASE/spring-insight-instance/wtpwebapps/SpringRooStats/WEB-INF/classes/META-INF/spring/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.reflect.UndeclaredThrowableException
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
It is complaining it seems that it needs to create an entity manager, but I think that
it should not since it should run a project that does not connect to a database and just run a simple jspx page.
Does one need to go thru the whole thing with entities just to run a simple project.
Hope someone can help.
Your applicationcontext.xml has a transactionManager defined. This needs a entity manager. Your would need to remove the transaction manager or add the entity manager.
I'm also not sure why you added the ORM framework if your not going to use it.
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.