You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by ranbaab <el...@gmail.com> on 2011/05/31 15:38:35 UTC

class path issue

Hi all,

Our web application deploy on tomcat is planning to move to
geronimo-tomcat6-2.2.

In our application, we use castor-codegen-1.1 to generate the java class
from the schema file.
The generated class is using the method 
Unmarshaller.unmarshal(com/bnt/ui/preference/xml/UserPreference, reader)
from the castor-1.1.

The class file is packed in the application jar and is inside the
web-inf\lib folder so when trying to unmarshall, the path of the class
provided in the unmarshall method is giving exception as 

2011-05-31 18:22:23,265 WARN  [DefaultRemoter] Method execution failed:
java.lang.NullPointerException
        at
com.bnt.ui.preference.UserPrefXMLUtility.getChildNodes(UserPrefXMLUtility.java:193)
        at
com.bnt.ui.preference.UserPrefXMLUtility.getColPref(UserPrefXMLUtility.java:344)
        at
com.bnt.ui.preference.UserPreferenceCfgRW.getDeviceListColumnPreferences(UserPreferenceCfgRW.java:352)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:618)
        at
org.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilter.java:34)
        at
org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428)
        at
org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:431)
        at
org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:283)
        at
org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:52)
        at
org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
        at
org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
        at com.bnt.ui.BHMServlet.doPost(BHMServlet.java:56)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at
org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:420)
        at
org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:396)
        at org.apache.geronimo.pool.ThreadPool$1.run(ThreadPool.java:214)
        at
org.apache.geronimo.pool.ThreadPool$ContextClassLoaderRunnable.run(ThreadPool.java:344)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:678)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:703)
        at java.lang.Thread.run(Thread.java:811)
2011-05-31 18:22:23,280 WARN  [BaseCallMarshaller] --Erroring: batchId[13]
message[java.lang.NullPointerException]
18:22:24,421 WARN  [geronimo-commands:start-server] unable to find
UserPreference for 'name' in ClassDescriptor of node{File: [not available];
li
e: 4; column: 15}
18:22:24,421 WARN  [geronimo-commands:start-server]     at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:740)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:596)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:817)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
com.bnt.ui.preference.xml.UserPreference.unmarshal(UserPreference.java:271)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
com.bnt.ui.preference.UserPrefXMLUtility.unmarshal(UserPrefXMLUtility.java:111)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
com.bnt.ui.preference.UserPrefXMLUtility.getPrefObj(UserPrefXMLUtility.java:86)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
com.bnt.ui.preference.UserPrefXMLUtility.getChildNodes(UserPrefXMLUtility.java:192)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
com.bnt.ui.preference.UserPrefXMLUtility.getColPref(UserPrefXMLUtility.java:344)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
com.bnt.ui.preference.UserPreferenceCfgRW.getDeviceListColumnPreferences(UserPreference
fgRW.java:352)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
java.lang.reflect.Method.invoke(Method.java:618)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
org.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilter.java:34)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:431)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:283)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:52)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
com.bnt.ui.BHMServlet.doPost(BHMServlet.java:56)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
18:22:24,421 WARN  [geronimo-commands:start-server]     at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain
java:290)

While deploying in the tomcat, there is no issue. Can anybody throw some
light on this?


Thanks,
Ranjan


--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/class-path-issue-tp3005965p3005965.html
Sent from the Development mailing list archive at Nabble.com.

Re: class path issue

Posted by ranbaab <el...@gmail.com>.
Hi Kevan,

With your suggestion to hide the castor, now it is working

<dep:hidden-classes>
      <dep:filter>org.exolab</dep:filter>
      <dep:filter>org.castor</dep:filter>
    </dep:hidden-classes>
  </dep:environment> 

Instead of putting all the dependencies jar from the web-inf/lib to
repository folder of geronimo, I just moved the xerces.jar in the endorsed
folder and put the below deployment plan

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1"
         xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
    <sys:environment>
        <sys:moduleId>
            <sys:groupId>samples</sys:groupId>
            <sys:artifactId>bhm</sys:artifactId>
            <sys:version>5.2</sys:version>
            <sys:type>war</sys:type>
        </sys:moduleId>	
       <sys:hidden-classes>
          <sys:filter>org.exolab</sys:filter>
          <sys:filter>org.castor</sys:filter>
       </sys:hidden-classes> 		
    </sys:environment>
    <context-root>/bhm</context-root>
	<gbean name="MyAppSystemProperties"           
class="org.apache.geronimo.system.properties.SystemProperties">
    <attribute name="systemPathProperties">
         com.myApp.ConfigFile=var
    </attribute>
    <reference name="ServerInfo">
        <name>ServerInfo</name>
    </reference>
</gbean>
</web-app>


So, is there any further improvement which can be done.

Thanks,
Ranjan



--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/class-path-issue-tp3005965p3009991.html
Sent from the Development mailing list archive at Nabble.com.

Re: class path issue

Posted by ranbaab <el...@gmail.com>.
Hi Kevan,

Thanks for your response, you are right, the castor-1.0.5 is used by the
org\apache\geronimo\configs\webservices-common.
Can we overcome the jar issue by putting the castor-1.1 in the
repository.org.codehaus.castor/castor/1.1 and declare in the artifact alias
as 
org.codehaus.castor/castor/1.0.5/jar=org.codehaus.castor/castor/1.1/jar 
and declared as dependency in my deployment plan  
             <sys:dependency>
                <sys:groupId>org.codehaus.castor</sys:groupId>
                <sys:artifactId>castor</sys:artifactId>
				<sys:version>1.1</sys:version>
                <sys:type>jar</sys:type>
            </sys:dependency>

Now after putting the above code, I didn't get the exception related to
unmarshall method, instead I got the error

2011-06-01 13:35:47,295 WARN  [DefaultRemoter] Method execution failed:
java.lang.NoClassDefFoundError: org.apache.oro.text.regex.Pattern
        at java.lang.J9VMInternals.verifyImpl(Native Method)
        at java.lang.J9VMInternals.verify(J9VMInternals.java:69)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:131)
        at java.lang.Class.forNameImpl(Native Method)
        at java.lang.Class.forName(Class.java:130)
        at
org.exolab.castor.util.LocalConfiguration.getRegExpEvaluator(LocalConfiguration.java:483)
        at
org.exolab.castor.xml.validators.PatternValidator.initEvaluator(PatternValidator.java:262)
        at
org.exolab.castor.xml.validators.PatternValidator.validate(PatternValidator.java:200)
        at
org.exolab.castor.xml.validators.StringValidator.validate(StringValidator.java:302)
        at
org.exolab.castor.xml.validators.StringValidator.validate(StringValidator.java:340)
        at
org.exolab.castor.xml.FieldValidator.validateInstance(FieldValidator.java:316)
        at
org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:263)
        at
org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescriptorImpl.java:938)
        at org.exolab.castor.xml.Validator.validate(Validator.java:124)
        at
org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:237)
        at
org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescriptorImpl.java:931)
        at org.exolab.castor.xml.Validator.validate(Validator.java:124)
        at
org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:237)
        at
org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescriptorImpl.java:931)
        at org.exolab.castor.xml.Validator.validate(Validator.java:124)
        at
org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:237)
        at
org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescriptorImpl.java:931)
        at org.exolab.castor.xml.Validator.validate(Validator.java:124)
        at
org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:913)
        at
org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:1108)
        at
org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:559)
        at
org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java:646)
        at
org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2978)
        at
org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:918)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.handleEndElement(XMLDocumentFragmentScannerImpl.java:1145)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:988)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1446)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
        at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:529)
        at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardParserConfiguration.java:585)
        at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
        at
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1148)
        at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:726)
        at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:596)
        at
org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:817)
        at
com.bnt.ui.configuration.Configuration.unmarshal(Configuration.java:270)
        at
com.bnt.ui.configuration.ConfReader.getFileObj(ConfReader.java:51)
        at
com.bnt.ui.configuration.ConfReader.getDetailsForID(ConfReader.java:97)
        at
com.bnt.ui.configuration.SwitchConfiguration.getFilteredData(SwitchConfiguration.java:97)
        at
com.bnt.ui.configuration.SwitchConfiguration.get(SwitchConfiguration.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:618)
        at
org.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilter.java:34)
        at
org.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428)
        at
org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:431)
        at
org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:283)
        at
org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:52)
        at
org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
        at
org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
        at com.bnt.ui.BHMServlet.doPost(BHMServlet.java:56)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at
org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:420)
        at
org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:396)
        at org.apache.geronimo.pool.ThreadPool$1.run(ThreadPool.java:214)
        at
org.apache.geronimo.pool.ThreadPool$ContextClassLoaderRunnable.run(ThreadPool.java:344)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:678)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:703)
        at java.lang.Thread.run(Thread.java:811)
Caused by: java.lang.ClassNotFoundException:
org.apache.oro.text.regex.Pattern in classloader
org.apache.geronimo.configs/webservices-common/2.2.1/
car
        at
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(MultiParentClassLoader.java:407)
        at
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:257)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:606)
        ... 78 more

The above mention jar jakarta-oro-2.0.5 is also put in the 
repository.org.apache.jakarta-oro/jakarta-oro/2.0.5 and declared in the
artifact alias as 
org.apache.jakarta-oro/jakarta-oro//jar=org.apache.jakarta-oro/jakarta-oro/2.0.5/jar
and in the deployment plan as 
           <sys:dependency>
                <sys:groupId>org.apache.jakarta-oro</sys:groupId>
                <sys:artifactId>jakarta-oro</sys:artifactId>
				<sys:version>2.0.5</sys:version>
                <sys:type>jar</sys:type>
            </sys:dependency>

I am wondering why the application cannot read the class file
org.apache.oro.text.regex.Pattern from the jar jakarta-oro-2.0.5.

Thanks,
Ranjan


--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/class-path-issue-tp3005965p3009836.html
Sent from the Development mailing list archive at Nabble.com.

Re: class path issue

Posted by Kevan Miller <ke...@gmail.com>.
On May 31, 2011, at 9:38 AM, ranbaab wrote:

> Hi all,
> 
> Our web application deploy on tomcat is planning to move to
> geronimo-tomcat6-2.2.
> 
> In our application, we use castor-codegen-1.1 to generate the java class
> from the schema file.
> The generated class is using the method 
> Unmarshaller.unmarshal(com/bnt/ui/preference/xml/UserPreference, reader)
> from the castor-1.1.

Hi Ranjan,
Geronimo includes castor 1.0.5. I'm not positive, but I think it will probably be in one of your parent classloaders. So, if you require castor 1.1, you'll want to hide castor from your application. A deployment plan like the following should do that:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1" xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1">
  <dep:environment>
    <dep:moduleId>
      <dep:groupId>org.mygroup</dep:groupId>
      <dep:artifactId>MyApp</dep:artifactId>
      <dep:version>1.1</dep:version>
      <dep:type>car</dep:type>
    </dep:moduleId>

    <dep:hidden-classes>
      <dep:filter>org.exolab</dep:filter>
      <dep:filter>org.castor</dep:filter>
    </dep:hidden-classes>
  </dep:environment>
</web-app>

To deploy, something like:

./bin/deploy.sh deploy <your-webapp.war> <your-xml-deployment-plan>

No guarantees that this will actually alter the behavior of your app... May need more information... But let's start by using a single version of castor...

--kevan