[Biojava-l] Reflection Errors reading FASTA file using Biojava.

Randall Svancara rsvancara at wsu.edu
Sat Sep 22 18:18:16 UTC 2007


I figured out the problem and it was rather simple.  I forgot to put
bytecode.jar into my class path.  I am guessing there is a problem with
the Struts 2.0 error handling.  Digging into the catalina.out logs for
tomcat revealed that their was a No Class Definition Exception being
thrown.  Once I found that, it was just a matter of finding the right
jar to include in the classpath.

Otherwise, BioJava works great.  I am going to be incorporating it into
a lot of projects we are working on including a web based blast tool
that will integrate with Sun Grid Engine. I needed BioJava for parsing
Fasta formated files and I may use it to convert other formats to Fasta,
if I can.  

Thanks for your help Mark and thanks for responding on this list so
quickly.

Randall Svancara


On Sat, 2007-09-22 at 19:07 +0800, Mark Schreiber wrote:
> From a quick look at the stack trace it seems it is Struts 2.0 that is
> doing the reflection (and failing).
> 
> I don't see any indication that this is a biojava problem. From the
> trace it doesn't look like any biojava methods have been called.
> 
> - Mark
> 
> On 9/22/07, Randall Svancara <rsvancara at wsu.edu> wrote:
> > I have created a stand alone class that calls this same code as
> > described below and and it executes just fine by itself.  However using
> > Struts 2.0 that uses classes from WebWork MVC framework, this same code
> > fails.  If i comment out lines 8,9,10, there are no errors.  So does the
> > iterator use reflection to obtain at run-time the correct sequence
> > object to load?
> >
> > Randall
> >
> > On Fri, 2007-09-21 at 18:59 +0100, Richard Holland wrote:
> > > The exception stack shows that the error is being thrown by some part of
> > > the software package called com.opensymphony.xwork2.
> > >
> > > This is not part of BioJava.
> > >
> > > If you try running your code outside of the Tomcat/Struts environment, I
> > > think you'll find it works fine (it does for me, anyhow!).
> > >
> > > I suspect that you have some kind of profiling tool active which is
> > > interfering with the process. Try disabling profiling and try again.
> > >
> > > If this persists, you should attempt to contact the manufacturers of your
> > > profiling tool (which I guess is OpenSymphony, based on the classnames
> > > involved) to see if they can tell you what would cause their software to
> > > throw such exceptions. If they can trace it to a particular fault in
> > > BioJava then we would be glad to hear of it, but we are unable to do this
> > > tracing ourselves as the exception is not being thrown from within
> > > BioJava.
> > >
> > > cheers,
> > > Richard
> > >
> > > On Fri, September 21, 2007 5:08 pm, Svancara, Randall wrote:
> > > > Hi,  I am new to biojava.  I am trying to read a fasta file using the
> > > > following code:
> > > >
> > > > 1. public Fasta(File fastafile) throws Exception{
> > > > 2.  this.fastafile = fastafile;
> > > > 3.  BufferedReader br = new BufferedReader(new FileReader(fastafile));
> > > >
> > > > 4.  FastaFormat fastaformat = new FastaFormat();
> > > > 5.  if(fastaformat.canRead(fastafile)){
> > > > 6.    SymbolTokenization cTok =
> > > > fastaformat.guessSymbolTokenization(fastafile);
> > > >
> > > > 7.    RichSequenceIterator it = RichSequence.IOTools.readFasta(br,cTok,
> > > > RichObjectFactory.getDefaultNamespace());
> > > >
> > > > 8.    while(it.hasNext()){
> > > > 9.      Sequence seq = it.nextRichSequence();
> > > > 10.    }
> > > > 11.  }
> > > > 13. }
> > > >
> > > > My problem is that I want to be able to read a fasta file and figure out
> > > > first if it is a protein or DNA sequence file, and next parse out the
> > > > sequences.  However, when I run this code i receive the following
> > > > errors.  I have only included part of the exception stack.  However, you
> > > > can see that there are reflection errors being thrown.  I am using
> > > > biojava in a struts2 environment running on apache tomcat 6.0.12 with
> > > > JDK 1.6 release 2.
> > > >
> > > > javax.servlet.ServletException:
> > > > java.lang.reflect.InvocationTargetException
> > > >     org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
> > > >     org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
> > > >
> > > > root cause
> > > >
> > > > java.lang.reflect.InvocationTargetException
> > > >     sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > >     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > > >     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > > >     java.lang.reflect.Method.invoke(Method.java:597)
> > > >     com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404)
> > > >     com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)
> > > >     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
> > > >     com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
> > > >     com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
> > > >     com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
> > > >     com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
> > > >     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
> > > >     com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:167)
> > > >     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
> > > >     com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
> > > >     com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
> > > >     com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
> > > >     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
> > > >     org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
> > > >     com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
> > > >     com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
> > > >     com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
> > > >     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
> > > >     com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)
> > > >     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
> > > >     com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
> > > >     com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
> > > >     com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
> > > >     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
> > > >     org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
> > > >     com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
> > > >     com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
> > > >
> > > >
> > > > Thanks,
> > > >
> > > > --
> > > > Randall Svancara
> > > > System Administrator
> > > >
> > > >
> > > > _______________________________________________
> > > > Biojava-l mailing list  -  Biojava-l at lists.open-bio.org
> > > > http://lists.open-bio.org/mailman/listinfo/biojava-l
> > > >
> > >
> > >
> > --
> > Randall Svancara
> > System Administrator
> > Horticulture and Landscape Architecture
> > 509-335-7093
> > _______________________________________________
> > Biojava-l mailing list  -  Biojava-l at lists.open-bio.org
> > http://lists.open-bio.org/mailman/listinfo/biojava-l
> >
-- 
Randall Svancara
System Administrator
Horticulture and Landscape Architecture
509-335-7093



More information about the Biojava-l mailing list