Issue Details (XML | Word | Printable)

Key: MPCASTOR-3
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: David Thexton
Votes: 2
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Maven 1.x Castor Plugin

"castor:generate" not working when using J2SDK >= 1.4

Created: 23/Apr/04 07:38 PM   Updated: 23/Apr/04 07:41 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. Text File patch.txt (2 kB)

Environment: Windows or Linux, J2SDK 1.5.0-beta1, 1.4.1 or 1.4.2 or 1.4.2_03, Maven 1.0-rc2


 Description  « Hide

I have some schema files I generate Java classes from using Castor. A snippet from my maven.xml looks like:

<attainGoal name="castor:prepare-filesystem"/>
<castor:generate
schema="${maven.src.dir}/xsd/adapter.script.xsd"
package="com.piplusplus.messaging.configuration"/>

When I use JDK 1.3.1 it generates the source correctly. When using any of the newer Java versions I instead get the following obscure error:

java.lang.NoClassDefFoundError: sun/reflect/ConstructorAccessorImpl

I tried adding the "-X" and "-verbose:class" options to track the problem further and also tried debugging against with the Castor source in my path. I think I began to make some progress, but subsequently gave up. From memory it was having problems unmarshalling the "simple types" (or similar) properties file.

After much lost time I found that the problem was avoided by causing the invokation of the source generator to be done in a forked process.

This can be achieved by pretending to have a Castor properties file by adding the line "maven.castor.properties.dir=." to the "project.properties" file, which is the workaround I'm currently using.

I've also added a patch to always fork, rather than only when a Castor properties file is available.

If "someone" could take a look at what I've done and commit if appropriate I'd be appreciative. If not, then at least if I save someone's time I'd be happy too. I like Maven, but it can be difficult to debug certain problems that occur.



David Thexton added a comment - 23/Apr/04 07:41 PM

Patch produced with "cvs diff -U3 castor/plugin.jelly" in "maven-plugins" project to always fork source generator process.