JBoss Developer Studio, JPA, Seam problem

Long story short, if you see:
org.hibernate.console.HibernateConsoleRuntimeException: Could not create JPA basedConfiguration, you may have your workspace and/or project in a path with a space in one of the directory names.

Let me expound:
I recently downloaded the newest JBoss Developer Studio (JDS) and thought “hey I’ll whip up a JBoss Seam application using EJB3.0, JPA, and Hibernate.” I watched a tutorial and saw how awesome their Hibernate Configuration capabilities were. Then I tried to replicate it. I use the wizard to create a new Seam Web Project and boom, the very next step I get an error.

The full error was:
org.hibernate.console.HibernateConsoleRuntimeException: Could not create JPA based Configuration
Could not create JPA based Configuration
<No message>
java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException: <no message>
java.lang.reflect.InvocationTargetException
javax.persistence.PersistenceException: java.lang.IllegalArgumentException: Unable to visit JAR file:/C:/Documents and Settings/jmarcum/jbworkspace/example/build/classes. Cause: Illegal character in path at index 18: file:/C:/Documents and Settings/jmarcum/jbworkspace/example/build/classes
java.lang.IllegalArgumentException: Unable to visit JAR file:/C:/Documents and Settings/jmarcum/jbworkspace/example/build/classes. Cause: Illegal character in path at index 18: file:/C:/Documents and Settings/jmarcum/jbworkspace/example/build/classes
java.lang.IllegalArgumentException: Unable to visit JAR file:/C:/Documents and Settings/jmarcum/jbworkspace/example/build/classes. Cause: Illegal character in path at index 18: file:/C:/Documents and Settings/jmarcum/jbworkspace/example/build/classes
Unable to visit JAR file:/C:/Documents and Settings/jmarcum/jbworkspace/example/build/classes. Cause: Illegal character in path at index 18: file:/C:/Documents and Settings/jmarcum/jbworkspace/example/build/classes

Now the “Could not create JPA based Configuration” could be for several reasons, but one that you won’t find anywhere on the internet (except right here, and I know this because I looked) is because of your file location. You can’t have any spaces in the path to your filename. Like by default, JDS will put your stuff in C:\Documents and Settings\yourname\workspace. First off, thanks Windows for putting spaces in my default directories, that helps with everything. Second, thanks JDS for giving me the worst error message ever. Now true, they gave me a hint in the ‘details’, but the main error that shows up is much less helpful.

So anyway, hope that helps some other poor soul doomed to develop on Windows. Word to the wise, if you are on windows and developing using Java, always put your source in a short path (name-wise) that has no spaces. Like c:\source. Same thing for your maven repository. Get that shiz out of your home directory and move it to c:\repo. You can specify where the repository is in your settings.xml in your home directory. This will help in lots of things, like tools that don’t expect spaces, and limitations with windows command length (like if you have a super long classpath).

Cheers.

 

4 Responses

  1. R Says:

    Worked like a charm! I had absolutely no clue what to do with this error!

    This was exactly what I needed.

  2. Apurv Mahajan Says:

    thanks a lot!!!!

  3. KG Says:

    Must be a JBoss thing. Been using Eclipse for Java projects for years with no problem. Ran into the same thing trying to run a Seam tutorial.

  4. Mauro Calendi Says:

    Great!!

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.