Home arrow static arrow Java Programming [Archive] - java.lang.ExceptionInInitializerError
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - java.lang.ExceptionInInitializerError
This topic has 25 replies on 2 pages.    1 | 2 | Next »

Posts:370
Registered: 8/17/02
java.lang.ExceptionInInitializerError  
Jul 18, 2004 12:52 PM



 
OK I am getting a weird error... I am working with XSLT transformations.. and I want to transform a string that has XML .. and output it in a httpResponse for my servlet.
I think I am doing everything right... but for some reason it keeps throwing an error... here is the transform method...

public static void transformOutput(java.io.File x)
{
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
TransformerFactory transformerFactory = TransformerFactory.newInstance();
try{
DocumentBuilder builder = builderFactory.newDocumentBuilder();
Document document = builder.parse(new InputSource(new StringReader(sourceString)));
Source xmlSource = new DOMSource(document);
Source XSLSource = new StreamSource(x);
Transformer transformer = transformerFactory.newTransformer(XSLSource);
System.out.println("Last Line eh");
transformer.transform(xmlSource, new StreamResult(response.getWriter())); //<<<<<Error Occures here
}
catch(Exception e)
{
System.out.println("statics.SessionServInfoAcs:"+e);
}

}

--------------------------------------HERE IS THE ERROR
java.lang.ExceptionInInitializerError
org.apache.xml.serializer.ToStream.<init>(ToStream.java:112)
org.apache.xml.serializer.ToXMLStream.<init>(ToXMLStream.java:57)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:415)
java.lang.Class.newInstance0(Class.java:322)
java.lang.Class.newInstance(Class.java:275)
org.apache.xml.serializer.SerializerFactory.getSerializer(SerializerFactory.java:91)
org.apache.xalan.transformer.TransformerImpl.createSerializationHandler(TransformerImpl.java:1097)
org.apache.xalan.transformer.TransformerImpl.createSerializationHandler(TransformerImpl.java:981)
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1187)
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1170)
statics.SessionServInfoAcs.transformOutput(SessionServInfoAcs.java:75) <<The Call that throws error
WebEngin.doGet(WebEngin.java:53)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
filters.ExampleFilter.doFilter(ExampleFilter.java:101)


if someone could tell me why the hell it is doing this I would be greatful... I have a inkling it may be that I am trying to pump XML from a string in rather than from a file, and I am not doing somthing right....
Thanksx
Matt
 

Posts:370
Registered: 8/17/02
Re: java.lang.ExceptionInInitializerError  
Jul 18, 2004 1:07 PM (reply 1 of 25)



 
bump
 

Posts:370
Registered: 8/17/02
Re: java.lang.ExceptionInInitializerError  
Jul 18, 2004 1:21 PM (reply 2 of 25)



 
ok correction... it probably is not the string because I made a XML file the same as the string... and replaced my string call and I still got the same error..... also I don't know if this helps... but after the first time I try it... if gives me ClassNotFound Errors..... for some weird reason...

java.lang.NoClassDefFoundError
org.apache.xml.serializer.ToStream.<init>(ToStream.java:112)
org.apache.xml.serializer.ToXMLStream.<init>(ToXMLStream.java:57)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:415)
java.lang.Class.newInstance0(Class.java:322)
java.lang.Class.newInstance(Class.java:275)
org.apache.xml.serializer.SerializerFactory.getSerializer(SerializerFactory.java:91)
org.apache.xalan.transformer.TransformerImpl.createSerializationHandler(TransformerImpl.java:1097)
org.apache.xalan.transformer.TransformerImpl.createSerializationHandler(TransformerImpl.java:981)
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1187)
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1170)
statics.SessionServInfoAcs.transformOutput(SessionServInfoAcs.java:75)
WebEngin.doGet(WebEngin.java:53)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
filters.ExampleFilter.doFilter(ExampleFilter.java:101)

 

Posts:370
Registered: 8/17/02
Re: java.lang.ExceptionInInitializerError  
Jul 18, 2004 1:51 PM (reply 3 of 25)



 
bump
 

Posts:370
Registered: 8/17/02
Re: java.lang.ExceptionInInitializerError  
Jul 18, 2004 4:05 PM (reply 4 of 25)



 
I only seem to get this error when I execute in servlet form on tomcat... for the life of me I have no idea whats wrong... I think I put all the jars in the proper files... so like everything should be working right... but it works outside a servlet enviroment... I am totally perplexed by this error... I will take the working code that I made (that works outside the servlet) and then try executing it from inside a servlet... and the thing just starts shooting out errors....
 

Posts:370
Registered: 8/17/02
Re: java.lang.ExceptionInInitializerError  
Jul 18, 2004 4:25 PM (reply 5 of 25)



 
For the love of god..... someone please help me.....
 

Posts:370
Registered: 8/17/02
Re: java.lang.ExceptionInInitializerError  
Jul 18, 2004 5:22 PM (reply 6 of 25)



 
bump
 

Posts:370
Registered: 8/17/02
Re: java.lang.ExceptionInInitializerError  
Jul 18, 2004 5:25 PM (reply 7 of 25)



 
I have tried nearly everything I could think of.. the error just won't go away :-((
 

Posts:2,830
Registered: 9/1/03
Re: java.lang.ExceptionInInitializerError  
Jul 18, 2004 5:29 PM (reply 8 of 25)



 
I have tried nearly everything I could think of.. the
error just won't go away :-((

try deleting the program.
 

Posts:7,258
Registered: 1/31/02
Re: java.lang.ExceptionInInitializerError  
Jul 18, 2004 5:30 PM (reply 9 of 25)



 
XML troubles almost always have to do with missing or incorrect versions of the various parsers and libraries. I did a quick google search and a search of the forums:

http://forum.java.sun.com/thread.jsp?thread=525227&forum=34&message=2586494

You might look and see what versions of the various XML jars you have lying around your classpath.

Good Luck

Lee
 

Posts:2,830
Registered: 9/1/03
Re: java.lang.ExceptionInInitializerError  
Jul 18, 2004 5:30 PM (reply 10 of 25)



 
but seriously, if it only occurs in the tomcat environment
then it must be a problem with jars or file permissons, so
check that the user that tomcat runs as has permission
and the jars are in the appropriate lib folders.
 

Posts:370
Registered: 8/17/02
Re: java.lang.ExceptionInInitializerError  
Jul 18, 2004 5:57 PM (reply 11 of 25)



 
I must need to override somthing in apache tomcat... because I just tried it again... this time un-jaring the base...base xalan files in my base application directory... and suddenly I got a different error (some casting thing) but none the less I am not getting that gay *** error.... I figure the casting thing will be fixed when I override the old files... which I don't know how to do... anyone have any ideas about this...
 

Posts:2,830
Registered: 9/1/03
Re: java.lang.ExceptionInInitializerError  
Jul 18, 2004 6:17 PM (reply 12 of 25)



 
...

what are you talking about ?

either you have new jars or old ones, put the new ones in the appropriate
lib dir (refer to the tomcat docs) and it will be using the new ones.

i.e. - does it work in a normal environment ? yes

then make it use the same jars in the tomcat environment ...
 

Posts:370
Registered: 8/17/02
Re: java.lang.ExceptionInInitializerError  
Jul 18, 2004 6:20 PM (reply 13 of 25)



 
this is frusterating
 

Posts:370
Registered: 8/17/02
Re: java.lang.ExceptionInInitializerError  
Jul 18, 2004 6:21 PM (reply 14 of 25)



 
this stupid error has kept up nearly a full days worth of work....
very very frusterating...
 
This topic has 25 replies on 2 pages.    1 | 2 | Next »