reset password
Author Message
jonathankroening
Posts: 39
Posted 17:20 Feb 14, 2015 |

I'm sure it's something simple, but I've been unable to find the fix.

I updated my build.properties file accordingly and made sure any dependency versions in pom.xml match those I have installed.

Of note:  springmvc runs just fine going through a similar process as I've tried here with csns2.

I'm getting the following errors:

 

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Illegal repetition near index 28

^csns\.importer\.parser\.(?!${app.school})\..*$

Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml]

java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

 

It kind of looks like applicationContext.xml doesn't like the dollar sign symbol to call property "app.school", which is set in build.properties.

 

Any help on getting this up and running so I can study for the midterm?  Thanks everyone.

cysun
Posts: 2935
Posted 11:10 Feb 15, 2015 |

Basically the placeholder ${app.school} was not replaced by the value in build.properties. You just need to force Eclipse to rebuild the project. A Project -> Clean should do it. Also make sure Project -> Build Automatically is checked.

 

jonathankroening
Posts: 39
Posted 11:13 Feb 15, 2015 |

Did a Project::Clean and Project::Build Automatically is checked.

Still getting the same error...

cysun
Posts: 2935
Posted 11:18 Feb 15, 2015 |
jonathankroening wrote:

Did a Project::Clean and Project::Build Automatically is checked.

Still getting the same error...

In the Servers View, stop the server, remove csns2 from the server, then right click on the server and select "Clean ..." then "Clean Tomcat Work Directory ...", then run the project again.

 

jonathankroening
Posts: 39
Posted 11:24 Feb 15, 2015 |

That didn't work either.

If I hardcode csula instead of the placeholder I can connect, but then I get a runtime error where the postgresql driver can't seem to see the value of the ${db.url} placeholder (i.e. java.sql.SQLException: Driver:org.postgresql.Driver@73cb3d0e returned null for URL:${db.url}).

My build.properties file is a sibling of pom.xml (I also tried it as a sibling of applicationContext but that didn't work) and as far as I can tell it has all of the properties set correctly.

Is there a plugin/import I'm missing that helps application context read these placeholders?

cysun
Posts: 2935
Posted 11:29 Feb 15, 2015 |

Then try cleaning Tomcat work directory manually as described here.

If above fails to fix the problem, I'd double check the name and location of build.properties - it should be at the same level as pom.xml & build.properties.sample, and make sure the file name doesn't have any leading/trailing white spaces.

jonathankroening
Posts: 39
Posted 11:45 Feb 15, 2015 |

No sir, tried the Clean Eclipse WTP Project Work Directory and double-checked the name and location of build.properties to no avail.

Maybe it's a classpath issue?

cysun
Posts: 2935
Posted 11:53 Feb 15, 2015 |

Go to Tomcat work directory .../tmp0/wtpwebapps/csns2 and check if the project is indeed deployed there. If it is, check WEB-INF/applicationContext.xml and see if the placeholders are replaced with actual values.

cysun
Posts: 2935
Posted 11:55 Feb 15, 2015 |

You can also package the whole project directory in a zip file and email it to me. I'll have a look at it.

jonathankroening
Posts: 39
Posted 11:59 Feb 15, 2015 |

Thank you. I'll email.

The project directory is located there but the applicationContext.xml there doesn't have values, it has the placeholders.

cysun
Posts: 2935
Posted 12:04 Feb 15, 2015 |

It sounds like Eclipse deployed the project but the resource filtering step in Maven build was not performed. Assuming you checked out the project as a Maven project and didn't change pom.xml, I'd check the .project file and see if the Maven builder is in there (see attachment).

Attachments:
jonathankroening
Posts: 39
Posted 12:08 Feb 15, 2015 |

I did check it out as a Maven project and haven't changed the pom.xml. the .project file is identical to the one you sent me.

cysun
Posts: 2935
Posted 12:22 Feb 15, 2015 |

There are some changes in pom.xml, but they are mostly version changes of some dependencies and plugins, which shouldn't cause much problem.

.project looks fine.

I did a "mvn package" and the build worked fine with the resource files properly filtered.

The only thing I notice was that you didn't change app.file.dir and app.log.dir. Since you are using a Mac which uses Unix path, this resulted a folder _E in your project folder. This may have affected the build process in some way. So set app.file.dir and app.log.dir to valid directories and try again.

jonathankroening
Posts: 39
Posted 12:36 Feb 15, 2015 |

Thanks for looking.

I didn't think it would affect anything either, but I changed the app.dir for file and log appropriately and the same error is still happening.

If I do a mvn package it builds just fine as well, no failures.

cysun
Posts: 2935
Posted 12:45 Feb 15, 2015 |

So something was wrong when Eclipse running Maven build.

I'd delete the project and redo the checkout and configuration process from the beginning. After creating build.properties and doing a Maven -> Update Project, right click on the project and select Properties -> Builders and make sure that the Maven Project Builder is checked.

If it fails again, there's nothing else I can think of. You'll have to manually put the values in build.properties into various configuration files - check every file under src/main/resources, src/test/resources, and src/main/webapp/WEB-INF.

jonathankroening
Posts: 39
Posted 13:01 Feb 15, 2015 |

OK.

So here's something I have to do every time I checkout a Maven Project in order to have the option to "Run on server" that might be different than expected:

Go to Properties::Project Facets and Convert to faceted form... Select Dynamic Web Module 3.0. Set Content Directory to src/main/webapp and change Java to 1.7

Then go to Properties::Deployment Assembly and Add... Java Build Path Entries/Maven Dependencies

And if I do a Maven::Update Project... it removes the previous Deployment Assembly that I added and I have to re-add.

Not sure if any of these things are related to the problems I'm having but I went ahead and deleted the project and started from scratch.  The same error is happening so I'm just going to hard-code all those values.

Thanks.

 

jonathankroening
Posts: 39
Posted 13:50 Feb 15, 2015 |

Got it working.

Installed the m2e-wtp connector.

Don't know why that was all it took, but it was.

cysun
Posts: 2935
Posted 14:01 Feb 15, 2015 |

m2e-wtp is included in the Eclipse Luna release. You are probably using an old version of Eclipse.

jonathankroening
Posts: 39
Posted 14:07 Feb 15, 2015 |
cysun wrote:

m2e-wtp is included in the Eclipse Luna release. You are probably using an old version of Eclipse.

cysun
Posts: 2935
Posted 20:48 Feb 15, 2015 |

The one you are using is Eclipse IDE for Java Developers while you should use Eclipse IDE for Java EE Developers. I'm surprised you haven't run into problems before this.

jonathankroening
Posts: 39
Posted 21:07 Feb 15, 2015 |

Oh I have. Haha. I usually can figure them out.

At least now I know why it's been such a pain.