Velocity - where to set velocity to read class files not only in WEB-INF/classes but also in sub directories in WEB-INF

View: New views
4 Messages — Rating Filter:   Alert me  

Velocity - where to set velocity to read class files not only in WEB-INF/classes but also in sub directories in WEB-INF

by newbie-gero :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
i am currently trying out velocity and i need some guidance from you guys. Velocity is able to read class files from the default path WEB-INF/classes.

I have create folders in WEB-INF/classes eg: WEB-INF/classes/JavaData/JavaObj

I placed my class file in JavaObj directory and velocity is not able to find the class files. Where do i set to ask velocity to read the class files in WEB-INF/classes/JavaData/JavaObj

I have upload my example as shown below:
velocity.war.zip

Thanks for the guidance

Re: Velocity - where to set velocity to read class files not only in WEB-INF/classes but also in sub directories in WEB-INF

by Mead Lai :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have look through your Code,
I think the problem is in your web.xml configuration.
line 22~25
<servlet>
        <servlet-name>VelocityTest</servlet-name>
        <servlet-class>velocityTest</servlet-class>
</servlet>
the Servlet Class Package is wrong
It shall be that:
<servlet>
        <servlet-name>VelocityTest</servlet-name>
        <servlet-class>com.email.emailData.emailObj.velocityTest</servlet-class>
</servlet>
U can get U classes now.

luck
Mead

On Wed, May 14, 2008 at 9:20 AM, newbie-gero <chongming@...> wrote:

>
>  Hi,
>  i am currently trying out velocity and i need some guidance from you guys.
>  Velocity is able to read class files from the default path WEB-INF/classes.
>
>  I have create folders in WEB-INF/classes eg:
>  WEB-INF/classes/JavaData/JavaObj
>
>  I placed my class file in JavaObj directory and velocity is not able to find
>  the class files. Where do i set to ask velocity to read the class files in
>  WEB-INF/classes/JavaData/JavaObj
>
>  I have upload my example as shown below:
>  http://www.nabble.com/file/p17221634/velocity.war.zip velocity.war.zip
>
>  Thanks for the guidance
>  --
>  View this message in context: http://www.nabble.com/Velocity---where-to-set-velocity-to-read-class-files-not-only-in-WEB-INF-classes-but-also-in-sub-directories-in-WEB-INF-tp17221634p17221634.html
>  Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@...
>  For additional commands, e-mail: user-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...


Re: Velocity - where to set velocity to read class files not only in WEB-INF/classes but also in sub directories in WEB-INF

by newbie-gero :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
Thanks for your prompt reply.

I have change according to your solutions as shown below:
My class file is located at WEB-INF\classes\com\velocity\velocityObj
I change the xml as shown below:
<servlet>
        <servlet-name>VelocityTest</servlet-name>
        <servlet-class>com.velocity.velocityObj.velocityTest</servlet-class>
    </servlet>


However my jboss reponds with these errors:
10:12:29,427 ERROR [MainDeployer] Could not create deployment: file:/C:/jboss-4.2.2.GA/server/default/deploy/velocity.war/
java.lang.NoClassDefFoundError: com/velocity/velocityObj/velocityTest (wrong name: velocityTest)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at org.jboss.wsf.container.jboss42.JAXWSDeployerHookPreJSE.getRelevantServlets(JAXWSDeployerHookPreJSE.java:128)
        at org.jboss.wsf.container.jboss42.JAXWSDeployerHookPreJSE.isWebServiceDeployment(JAXWSDeployerHookPreJSE.java:101)
        at org.jboss.wsf.container.jboss42.ArchiveDeployerHook.deploy(ArchiveDeployerHook.java:87)
        at org.jboss.wsf.container.jboss42.DeployerInterceptor.create(DeployerInterceptor.java:79)
        at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(SubDeployerInterceptorSupport.java:180)
        at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:91)


Previously when i start to put the class file under WEB-INF/classes, it is able to work. This is the old file i have deployed previously: velocity%28previous%29.war.zip

This is the file i have edit according to your solutions: velocity.war.zip

Thank for the guidance


Mead Lai wrote:
I have look through your Code,
I think the problem is in your web.xml configuration.
line 22~25
<servlet>
        <servlet-name>VelocityTest</servlet-name>
        <servlet-class>velocityTest</servlet-class>
</servlet>
the Servlet Class Package is wrong
It shall be that:
<servlet>
        <servlet-name>VelocityTest</servlet-name>
        <servlet-class>com.email.emailData.emailObj.velocityTest</servlet-class>
</servlet>
U can get U classes now.

luck
Mead

On Wed, May 14, 2008 at 9:20 AM, newbie-gero <chongming@e7tech.com> wrote:
>
>  Hi,
>  i am currently trying out velocity and i need some guidance from you guys.
>  Velocity is able to read class files from the default path WEB-INF/classes.
>
>  I have create folders in WEB-INF/classes eg:
>  WEB-INF/classes/JavaData/JavaObj
>
>  I placed my class file in JavaObj directory and velocity is not able to find
>  the class files. Where do i set to ask velocity to read the class files in
>  WEB-INF/classes/JavaData/JavaObj
>
>  I have upload my example as shown below:
>  http://www.nabble.com/file/p17221634/velocity.war.zip velocity.war.zip
>
>  Thanks for the guidance
>  --
>  View this message in context: http://www.nabble.com/Velocity---where-to-set-velocity-to-read-class-files-not-only-in-WEB-INF-classes-but-also-in-sub-directories-in-WEB-INF-tp17221634p17221634.html
>  Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>  For additional commands, e-mail: user-help@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org

Re: Velocity - where to set velocity to read class files not only in WEB-INF/classes but also in sub directories in WEB-INF

by Christopher Schultz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

newbie-gero,

newbie-gero wrote:
> java.lang.NoClassDefFoundError: com/velocity/velocityObj/velocityTest (wrong
> name: velocityTest)

You need a "package" statement at the top of your Java file if you want
to put your servlet into a package.

-chris



signature.asc (266 bytes) Download Attachment