kmmbvnr / sarasvati

Automatically exported from code.google.com/p/sarasvati
0 stars 5 forks source link

Need workaround for missing javax.xml.bind.JABX in Java 5 #66

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Simple web app attempts to implement the Graph Visualization example
2. Forced to deploy to Websphere 6.1 (supports java 5 max) with 
sarasvati-java-1.0.3 embedded in simple hello-world web app.
3. Ran the hello-world web app
4. Page Cannot Be Displayed message in browser
5. In server logs, I see the following error

[10/21/10 17:30:58:032 EDT] 00000037 WebApp        E   [Servlet 
Error]-[/helloworld_visualization.jsp]: java.lang.NoClassDefFoundError: 
javax.xml.bind.JAXBException

What is the expected output? What do you see instead?
Expected output is something like the test.gif seen in your Graph Visualization 
wiki page (at least eventually, right now all I wanted to see was the page's 
text be displayed). Instead, the web app complains that an xml parser class [is 
that what this class does?] cannot be found. 

What version of the product are you using? On what operating system?
Product = Sarasvati 1.0.3
OS = Microsoft Windows Server 2003 Standard SP2
Webapp Server = Websphere 6.1

Please provide any additional information below.
Google searches suggest that the missing Java xml parser class is not part of 
Java 5, but is included in Java 6. Unfortunately, we must use a Java 5 
environment due to our version of Websphere. I've thought about just going out 
there and downloading the JAR that contains this class? Or possibly using an 
earlier version of Sarasvati? But not sure if there is a decent solution / 
workaround to this.

I'm guessing it's the   this.engine.getLoader().load()   line in the 
constructor that's causing the error?

Sample code:

package: engine_test
class: MemEngine_HelloWorld

public class MemEngine_HelloWorld {

...
... member variables and such ...
...

/**
* Constructor, sets up the in-Memory Hello World test scenario
*/
public MemEngine_HelloWorld(){
//Instantiates the in-memory engine
this.engine = new MemEngine();

// Tells engine about our custom node type
this.engine.addNodeType( this.node_type_name, HelloNode.class );

// Loads the process definition (this can throw LoadException or JAXBException
// The graph will be stored in the GraphRepository for this engine
this.engine.getLoader().load( new File(this.process_definition_xml_path) );

//Gets the graph from the GraphRepository
this.graph = engine.getRepository().getLatestGraph( 
this.process_definition_name );
}

...
... rest of class ...
...

================================================================

this is the other file, the simple hello-world jsp:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.googlecode.sarasvati.Graph" %>
<%@ page import="com.googlecode.sarasvati.visual.GraphToImageMapAdapter" %>
<%@ page import="com.googlecode.sarasvati.Node" %>
<%@ page import="com.googlecode.sarasvati.visual.GraphImageMapCreator" %>

<%@ page import="engine_test.MemEngine_HelloWorld" %>

<html>
  <head>
      <jsp:useBean id="datetime" class="java.util.Date" />
      <title>Hello World in-Memory Engine Test JSP v2</title>
  </head>
  <body>
        <h2>Welcome to the Hello World in-Memory Engine Test JSP v2</h2>

        <%
            MemEngine_HelloWorld eng1 = new MemEngine_HelloWorld();  //this simple one-liner doesn't work
        %>

        <p>This concludes the Hello World in-Memory Engine Test JSP v2</p>
  </body>
</html>

Original issue reported on code.google.com by yan...@gmail.com on 21 Oct 2010 at 10:12

GoogleCodeExporter commented 9 years ago
Thanks in advance for your help!

Original comment by yan...@gmail.com on 21 Oct 2010 at 10:14

GoogleCodeExporter commented 9 years ago
You just need to download JAXB from https://jaxb.dev.java.net and add it to 
your project. I tested with Java 5 and version 2.2.1 of JAXB, and worked fine. 

I added a note to the README to this effect. Let me know if you still have 
problems. I haven't tested much with 1.5, so there may be other issues.

Original comment by plor...@gmail.com on 22 Oct 2010 at 4:03

GoogleCodeExporter commented 9 years ago
Cool, it worked! I added the   JAXB RI 2.2.1 (JAXB2_20100511.jar)   jar to my 
web app's  WEB-INF\lib  folder ... re-deployed the sample web app and the text 
now shows up (and no errors in the log).

Thanks!

Original comment by yan...@gmail.com on 22 Oct 2010 at 3:38

GoogleCodeExporter commented 9 years ago
Oops, said that too soon. Project works in Eclipse, but when exported to our QA 
Websphere environment, server logs still shows the error. I've even added the 
JAXB2_20100511.jar into the build path itself, but it didn't seem to help.

Original comment by yan...@gmail.com on 22 Oct 2010 at 4:32

GoogleCodeExporter commented 9 years ago
Hm, specifically, the error message mentions the GraphLoaderImpl class as the 
initial source of the exception. Will adding the JAXB2_20100511.jar to the 
project solve that?

[10/22/10 12:55:15:554 EDT] 00000028 WebApp        E   [Servlet 
Error]-[/helloworld_visualization_v2.jsp]: java.lang.NoClassDefFoundError: 
javax.xml.bind.JAXBException
...
...
...
at com.googlecode.sarasvati.load.GraphLoaderImpl.load(GraphLoaderImpl.java:270)
at engine_test.MemEngine_HelloWorld.<init>(MemEngine_HelloWorld.java:50)
...
...

Original comment by yan...@gmail.com on 22 Oct 2010 at 4:57

GoogleCodeExporter commented 9 years ago
Unfortunately, I'm not familiar with WebSphere (and don't know the specifics of 
how you're deploying). Generally speaking, with a .war deploy you'd need to 
extract the jaxb-api.jar and jaxb-impl.jar and copy them to the WEB-INF/lib 
directory of your war.

Original comment by plor...@gmail.com on 22 Oct 2010 at 5:06

GoogleCodeExporter commented 9 years ago
Oh silly me, I thought   JAXB2_20100511.jar   was the file to include in the 
path, didn't even realize that it was the JAXB installation JAR.

Anyway, ran the installation JAR, which installed the following JARs, and then 
copied those new JARs to my web app's WEB-INF/lib folder

activation.jar
jaxb1-impl.jar
jaxb-api.jar
jaxb-impl.jar
jaxb-xjc.jar
jsr173_1.0_api.jar

Now I no longer get any JAXB-related ClassNotFound exceptions. Thanks!!!

Original comment by yan...@gmail.com on 22 Oct 2010 at 7:25

GoogleCodeExporter commented 9 years ago
1.0.4 was released quite a while ago. Marking bugs released.

Original comment by plor...@gmail.com on 18 Oct 2012 at 1:34