Gareth Western

Ranch Hand
+ Follow
since Apr 07, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gareth Western

Solved it. I think it was related to some files created by an older version of JAXB still lying in the classpath (jaxb.properties? bgm.ser?).

phew!
Nevermind. I've managed to get my example working with JDK5 in a clean project, therefore it must be a classpath issue...
I'm trying to validate and unmarshall an xml document using JDK5. The code is as follows:

But I'm getting the following error:

I'm using Java 1.5.0_12, with JAXB 2.1.3 and Xerces 2.9.1, and passing in the following Java options to use the Xerces SAX Parser: -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl

The program works correctly using Java 6, which already has JAXB and Xerces included with it. What am I doing wrong with Java 5?
I have an application which uses Xerces-J (2.9.0) to parse a large xml document which I'd like to split into several smaller files just to make it easier to manage. The main file looks like this:

Each of the included files is similar to the following:

The schema prevents me from including the entire inner file, as that would result in nested function-set elements, so I want to only include the "function" elements from each inner file. XPointer looks like it would be the answer to this, changing the main file to look something like:

... however according to the Xerces XInclude FAQ only the "element()" scheme is supported. Does this mean I can only reference specific individual elements from the included file, as opposed to the full range of functions? For example, the following works perfectly, but only includes the first function from PrivateFunctions.xml:

Any suggestions as to how to accomplish what I'm trying to do? Let me know if you have any questions / if I haven't explained the situation very well.

Thanks!

Gareth
I gave up with XIncluder in the end, and instead decided to upgrade my SAXParser to the latest version of Xerces (2.9.0), which support xincludes.
We use JAXB to create java objects from a rather large XML file. To make this file easier to manage I'm trying to break it down using xinclude, however JAXB appears to be unable to cope with the new xinclude directives. Kohsuke Kawaguchi's Blog recommends using XIncluder to expand the includes prior to unmarshalling. This seems to be working, because If I leave out Xincluder I get the following message:

However WITH xincluder I get a different message, which I have not been able to work around:

All of my xml documents are well-formed and correct. I even removed all comments, just in case.

Does anyone have any ideas as to what might be causing this problem?
Thanks for keeping the thread alive! I am still following any updates with great interest.

Unfortunately I still haven't figured out how to convert the project, although I haven't given the assembly plugin much time. As Tim pointed out, Hasnig, the war won't work if everything is just bundled into a jar (or a zip).

For now I think the effort to switch from our existing Ant scripts to Maven outweighs any benefits Maven will provide... :\

Cheers!
15 years ago
Yeah, unfortunately there are things like javascript files, graphics, and JSPs which I can't put in a jar.

I guess what I need to do is create artifacts for each of the "common" projects to create a jar file of the classes, but then also use the Maven Assembly feature to pull in the other files from those common directories.

It won't be quite as easy or elegant as I hoped for, but I still believe it would be worth trying!

Thanks for the suggestion about the Assembly, Tim!
15 years ago
The problem is that common1 isn't a complete application. In this case it's half of a webapp which is used in both AppA and AppB.

So I can't just create a common1.war and then include that in AppA/WEB-INF/lib...
15 years ago
Hi, I'm trying to convert an application to use Maven instead of Ant for building, however I've got the following problem. Our directory structure is something like the following:

/
--/webAppA (application A)
--/webAppB (application B)
--/common1 (files common to both A and B, including JSPs, classes, and other configuration files [e.g. struts configuration, action mappings, etc])

I need to, in effect, copy common1 to both AppA and AppB when I build either of them. I don't think I can't just produce a common1.jar and declare it as a dependency because then the configuration files won't be picked up properly.

I suppose I could create a common1.jar for the class files and declare it as a dependency, and then also use the maven-resources-plugin to copy the other files into the appropriate place, but I don't think that's ideal as won't I then have multiple copies of the common1 configuration files lying around?

Or would it be better to declare common1 as a "war" artifact and then use the maven-war-plugin:exploded goal to explode that somewhere?

Or something else?

Any suggestions or advice?
15 years ago
The fact that it worked for Java 5 was the clue I needed.

The problem was that the application's class files had not been retrotranslated from Java 5. After retrotranslation the application precompiled correctly.
15 years ago
Congratulations on passing!

Effective Java (2nd Edition) has some good "best practices" for several of the new Java 5 features, including a good chapter on Generics!
15 years ago
Hi,

We use the wlappc Ant task to precompile each of our application's JSPs on Weblogic 8.1 like so:


This works correctly on two of our applications, however the third fails with the following error:

precompile-jsps.xml:16: weblogic.utils.compiler.ToolFailureException: [J2EE:160119]Appc is unable to process the file '/home/gareth/software/bea/user_projects/domains/mydomain/applications/myapp'. The following error occurred:

The class "com.mycompany.myapp.ApplicationContextListener" referred by the descriptor element "listener" is not found. Please ensure that it is present in the classpath.

at weblogic.servlet.internal.dd.compliance.ComplianceUtils.checkCompliance(ComplianceUtils.java:47)
at weblogic.servlet.jsp.JspcInvoker.compile(JspcInvoker.java:139)
at weblogic.appc.compileWAR(appc.java:866)
at weblogic.appc.compileWAR(appc.java:822)
at weblogic.appc.compileInput(appc.java:472)
at weblogic.appc.runBody(appc.java:186)
at weblogic.utils.compiler.Tool.run(Tool.java:192)
at weblogic.utils.compiler.Tool.run(Tool.java:147)
at weblogic.appc.main(appc.java:1037)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at weblogic.ant.taskdefs.j2ee.CompilerTask.invokeMain(CompilerTask.java:278)
at weblogic.ant.taskdefs.j2ee.Appc.privateExecute(Appc.java:199)
at weblogic.ant.taskdefs.j2ee.Appc.execute(Appc.java:124)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.Main.runBuild(Main.java:698)
at org.apache.tools.ant.Main.startAnt(Main.java:199)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

weblogic.servlet.internal.dd.compliance.ComplianceException: The class "com.mycompany.myapp.ApplicationContextListener" referred by the descriptor element "listener" is not found. Please ensure that it is present in the classpath.
at weblogic.servlet.internal.dd.compliance.BaseComplianceChecker.addDescriptorError(BaseComplianceChecker.java:75)
at weblogic.servlet.internal.dd.compliance.BaseComplianceChecker.addDescriptorError(BaseComplianceChecker.java:81)
at weblogic.servlet.internal.dd.compliance.WebAppDescriptorComplianceChecker.validateListeners(WebAppDescriptorComplianceChecker.java:107)
at weblogic.servlet.internal.dd.compliance.WebAppDescriptorComplianceChecker.check(WebAppDescriptorComplianceChecker.java:73)
at weblogic.servlet.internal.dd.compliance.ComplianceUtils.checkCompliance(ComplianceUtils.java:45)
at weblogic.servlet.jsp.JspcInvoker.compile(JspcInvoker.java:139)
at weblogic.appc.compileWAR(appc.java:866)
at weblogic.appc.compileWAR(appc.java:822)
at weblogic.appc.compileInput(appc.java:472)
at weblogic.appc.runBody(appc.java:186)
at weblogic.utils.compiler.Tool.run(Tool.java:192)
at weblogic.utils.compiler.Tool.run(Tool.java:147)
at weblogic.appc.main(appc.java:1037)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at weblogic.ant.taskdefs.j2ee.CompilerTask.invokeMain(CompilerTask.java:278)
at weblogic.ant.taskdefs.j2ee.Appc.privateExecute(Appc.java:199)
at weblogic.ant.taskdefs.j2ee.Appc.execute(Appc.java:124)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.Main.runBuild(Main.java:698)
at org.apache.tools.ant.Main.startAnt(Main.java:199)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

--------------- nested within: ------------------
weblogic.utils.compiler.ToolFailureException: [J2EE:160121]Errors encountered while compiling module '/home/gareth/software/bea/user_projects/domains/mydomain/applications/myapp':

The class "com.mycompany.myapp.ApplicationContextListener" referred by the descriptor element "listener" is not found. Please ensure that it is present in the classpath.
- with nested exception:
[
The class "com.mycompany.myapp.ApplicationContextListener" referred by the descriptor element "listener" is not found. Please ensure that it is present in the classpath.
]
at weblogic.appc.compileWAR(appc.java:837)
at weblogic.appc.compileInput(appc.java:472)
at weblogic.appc.runBody(appc.java:186)
at weblogic.utils.compiler.Tool.run(Tool.java:192)
at weblogic.utils.compiler.Tool.run(Tool.java:147)
at weblogic.appc.main(appc.java:1037)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at weblogic.ant.taskdefs.j2ee.CompilerTask.invokeMain(CompilerTask.java:278)
at weblogic.ant.taskdefs.j2ee.Appc.privateExecute(Appc.java:199)
at weblogic.ant.taskdefs.j2ee.Appc.execute(Appc.java:124)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.Main.runBuild(Main.java:698)
at org.apache.tools.ant.Main.startAnt(Main.java:199)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
- with nested exception:
[weblogic.utils.compiler.ToolFailureException: [J2EE:160121]Errors encountered while compiling module '/home/gareth/software/bea/user_projects/domains/mydomain/applications/myapp':

The class "com.mycompany.myapp.ApplicationContextListener" referred by the descriptor element "listener" is not found. Please ensure that it is present in the classpath.
- with nested exception:
[
The class "com.mycompany.myapp.ApplicationContextListener" referred by the descriptor element "listener" is not found. Please ensure that it is present in the classpath.
]]



The ApplicationContextListener.class is in the appropriate location in the src.dir WEB-INF/clases folder, as with the other two applications, so why would the classpath suddenly not be correct for this app?

ALSO if I set the JAVA_HOME environment variable to point to a Java5 JDK the script precompiles correctly. Only the Java 1.4 JDK has this problem...

Any ideas?
15 years ago
Perhaps "doit" is still looking for help with his problem...
*phew*! did it.

Thanks to everyone for all the useful tips and training material on the ranch / around t'interweb!

17 years ago