Solved

Manually deploy java application in jboss

Posted on 2009-05-19
28
979 Views
Last Modified: 2013-12-12
Hi Experts,
I want to manually deploy hello_world.java file in Jboss version 4.2.9.

By manually deployment i mean to deploy without using .ear/.war etc  but by manually placing the file on to specific directory.

This question means much to me at the moment.

Thanks

0
Comment
Question by:sandhya01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 15
  • 13
28 Comments
 
LVL 12

Expert Comment

by:Gibu George
ID: 24420258
Is the hello_world.java a servlet?
0
 

Author Comment

by:sandhya01
ID: 24420266
Yes
0
 
LVL 12

Accepted Solution

by:
Gibu George earned 250 total points
ID: 24420336
Ythen in that case you need to put it in a war. but it need not be an archive file, it can be a folder named helloworld.war.

The folder stricture being
helloworld.war--
                         |
                          --WEB-INF
                                    |
                                    -- classes

Put your hello_world.class in the classes folder, put your web.xml with servlet mapping in the WEb-INF folder, then you will be able to access the servlet from http://<servername>:<port>/helloworld/<servletmapping url>
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 12

Assisted Solution

by:Gibu George
Gibu George earned 250 total points
ID: 24420355
else if you want to access like
http://<servername>:<port>/<servletmapping url> then you need to place the class file inside the ROOT.war folders classes and modifying the web.xml. Another way to do it like this is use another ear put the war folder in the ear then in application.xml specify the teh context root as /
0
 

Author Comment

by:sandhya01
ID: 24439471
Hi
I am getting the below exception when i try to run the servlet:

2009-05-21 09:05:33,125 WARN  org.jboss.jbossweb: WARNING: Exception for /HelloWorld/servlet/HelloWorld
javax.servlet.UnavailableException: java.lang.ClassNotFoundException: HelloWorld
      at org.mortbay.jetty.servlet.Invoker.service(Invoker.java:154)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:558)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1714)
      at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:507)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1664)
      at org.mortbay.http.HttpServer.service(HttpServer.java:863)
      at org.jboss.jetty.Jetty.service(Jetty.java:460)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:775)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:939)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:792)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:201)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
      at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)
 (PoolThread-8)

I checked and the classfile is present in the classes folder and web.xml maps to this file

THanks
0
 
LVL 12

Expert Comment

by:Gibu George
ID: 24439760
Please post the mapping, it should be like this

       <servlet>
            <servlet-name>Helloworld</servlet-name>
            <servlet-class>test.Helloworld</servlet-class>
      </servlet>
       <servlet-mapping>
            <servlet-name>Helloworld</servlet-name>
            <url-pattern>/Helloworld</url-pattern>
      </servlet-mapping>

then you can access it like

http://<servername>:<port>/HelloWorld/Helloworld
0
 

Author Comment

by:sandhya01
ID: 24439968
Hi gibu,
I identified the error actually when I transferred the directory structure using FTP, the WEB-INF folder got renamed to web-inf. When I renamed the folder web-inf to WEB-INF, I am getting the following error:

org.jboss.deployment.DeploymentException: Could not create deployment: file:/appl/documentum/fulltext/IndexServer/j2ee/server/vespa/deploy/HelloWorld.war/; - nested throwable: (java.lang.ClassFormatError: HelloWorld (Illegal UTF8 string in constant pool))
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:853)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:640)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:613)
      at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy7.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:458)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:200)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:211)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:190)
Caused by: java.lang.ClassFormatError: HelloWorld (Illegal UTF8 string in constant pool)
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
      at org.mortbay.http.ContextLoader.loadClass(ContextLoader.java:225)
      at org.mortbay.http.ContextLoader.loadClass(ContextLoader.java:198)
      at org.mortbay.http.HttpContext.loadClass(HttpContext.java:1317)
      at org.mortbay.jetty.servlet.Holder.start(Holder.java:165)
      at org.mortbay.jetty.servlet.ServletHolder.start(ServletHolder.java:198)
      at org.mortbay.jetty.servlet.ServletHandler.initializeServlets(ServletHandler.java:436)
      at org.mortbay.jetty.servlet.WebApplicationHandler.initializeServlets(WebApplicationHandler.java:150)
      at org.mortbay.jetty.servlet.WebApplicationContext.start(WebApplicationContext.java:442)
      at org.mortbay.j2ee.J2EEWebApplicationContext.start(J2EEWebApplicationContext.java:85)
      at org.jboss.jetty.JBossWebApplicationContext.start(JBossWebApplicationContext.java:89)
      at org.jboss.jetty.Jetty.deploy(Jetty.java:331)
      at org.jboss.jetty.JettyService.performDeploy(JettyService.java:242)
      at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:357)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
      ... 14 more


My xml file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC  
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"  
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
        <servlet>
                <servlet-name>HelloWorld</servlet-name>
                <servlet-class>HelloWorld</servlet-class>
        </servlet>

            <servlet-mapping>
              <servlet-name>HelloWorld</servlet-name>
              <url-pattern>/servlet/HelloWorld</url-pattern>
            </servlet-mapping>

</web-app>


Thanks
0
 
LVL 12

Expert Comment

by:Gibu George
ID: 24440010
I think this is caused because of the FTP. Are you transferring from a windows machine to linux machine? If yes what is the encoding for the linux box. If you are not able to solve this issue try compiling your class files on server machine.
0
 
LVL 12

Expert Comment

by:Gibu George
ID: 24440023
Which FTP util are you using? Try using the ftp command line
0
 
LVL 12

Expert Comment

by:Gibu George
ID: 24440028
else use filezilla ftp client
0
 

Author Comment

by:sandhya01
ID: 24440213
Hi
The transfer method is set to Ascii.
I am using Reflection FTP
I think the problem was with the version of jdk i am using to compile my class file. when i used version 1.5 which is the same version on my linux machine. I am now getting the following exception:

2009-05-21 11:40:00,634 WARN  org.jboss.jbossweb: WARNING: Exception for /HelloWorld/servlet/HelloWorld
javax.servlet.UnavailableException: Servlet Not Initialized
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:329)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:558)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1714)
      at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:507)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1664)
      at org.mortbay.http.HttpServer.service(HttpServer.java:863)
      at org.jboss.jetty.Jetty.service(Jetty.java:460)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:775)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:939)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:792)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:201)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
      at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)
 (PoolThread-8)

THnaks
0
 

Author Comment

by:sandhya01
ID: 24440228
Hi
See my java source file:
/*
 * HelloWorld.java
 *
 */

import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

/

public class HelloWorld extends HttpServlet {


    public void service(HttpServletRequest request,
                      HttpServletResponse response)
        throws IOException, ServletException
    {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();

        out.println("<html>");
        out.println("<head>");
        out.println("<title>Hello World Servlet!</title>");
        out.println("</head>");
        out.println("<body>");
              out.println("<p align=\"center\"><font size=\"5\" color=\"#000080\">Hello World!</font></p>");
              out.println("<p align=\"center\"><a href=\"javascript:history.back()\">Go to Home</a></p>");
        out.println("</body>");
        out.println("</html>");
    }
}



0
 
LVL 12

Expert Comment

by:Gibu George
ID: 24440296
You need not implement the service method.

you can do this in the doGet or doPost method like this
/*
 * HelloWorld.java
 *
 */
 
import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
 
/
 
public class HelloWorld extends HttpServlet {
 
 
    public void doGet(HttpServletRequest request,
                      HttpServletResponse response)
        throws IOException, ServletException
    {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
 
        out.println("<html>");
        out.println("<head>");
        out.println("<title>Hello World Servlet!</title>");
        out.println("</head>");
        out.println("<body>");
              out.println("<p align=\"center\"><font size=\"5\" color=\"#000080\">Hello World!</font></p>");
              out.println("<p align=\"center\"><a href=\"javascript:history.back()\">Go to Home</a></p>");
        out.println("</body>");
        out.println("</html>");
    }
    public void doPost(HttpServletRequest request,
                      HttpServletResponse response){
          doGet(request,response);
    }
}

Open in new window

0
 

Author Comment

by:sandhya01
ID: 24440647
Hi,
I am using the modified version of your java program as you have not catched the exception at  post and I am now getting the following error:

2009-05-21 12:37:03,831 ERROR org.jboss.deployment.MainDeployer: could not start deployment: file:/appl/documentum/fulltext/IndexServer/j2ee/server/vespa/deploy/HelloWorld.war/ (ScannerThread)

java.lang.UnsupportedClassVersionError: HelloWorld (Unsupported major.minor version 49.0)
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
      at org.mortbay.http.ContextLoader.loadClass(ContextLoader.java:225)
      at org.mortbay.http.ContextLoader.loadClass(ContextLoader.java:198)
      at org.mortbay.http.HttpContext.loadClass(HttpContext.java:1317)
      at org.mortbay.jetty.servlet.Holder.start(Holder.java:165)
      at org.mortbay.jetty.servlet.ServletHolder.start(ServletHolder.java:198)
      at org.mortbay.jetty.servlet.ServletHandler.initializeServlets(ServletHandler.java:436)
      at org.mortbay.jetty.servlet.WebApplicationHandler.initializeServlets(WebApplicationHandler.java:150)
      at org.mortbay.jetty.servlet.WebApplicationContext.start(WebApplicationContext.java:442)
      at org.mortbay.j2ee.J2EEWebApplicationContext.start(J2EEWebApplicationContext.java:85)
      at org.jboss.jetty.JBossWebApplicationContext.start(JBossWebApplicationContext.java:89)
      at org.jboss.jetty.Jetty.deploy(Jetty.java:331)
      at org.jboss.jetty.JettyService.performDeploy(JettyService.java:242)
      at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:357)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:640)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:613)
      at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy7.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:458)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:200)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:211)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:190)
2009-05-21 12:37:03,835 ERROR org.jboss.deployment.scanner.URLDeploymentScanner: Failed to deploy: org.jboss.deployment.scanner.URLDeploymentScanner$DeployedURL@fd98a64d{ url=file:/appl/documentum/fulltext/IndexServer/j2ee/server/vespa/deploy/HelloWorld.war/, deployedLastModified=1242905985000 } (ScannerThread)

org.jboss.deployment.DeploymentException: Could not create deployment: file:/appl/documentum/fulltext/IndexServer/j2ee/server/vespa/deploy/HelloWorld.war/; - nested throwable: (java.lang.UnsupportedClassVersionError: HelloWorld (Unsupported major.minor version 49.0))
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:853)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:640)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:613)
      at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy7.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:458)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:200)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:211)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:190)
Caused by: java.lang.UnsupportedClassVersionError: HelloWorld (Unsupported major.minor version 49.0)
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
      at org.mortbay.http.ContextLoader.loadClass(ContextLoader.java:225)
      at org.mortbay.http.ContextLoader.loadClass(ContextLoader.java:198)
      at org.mortbay.http.HttpContext.loadClass(HttpContext.java:1317)
      at org.mortbay.jetty.servlet.Holder.start(Holder.java:165)
      at org.mortbay.jetty.servlet.ServletHolder.start(ServletHolder.java:198)
      at org.mortbay.jetty.servlet.ServletHandler.initializeServlets(ServletHandler.java:436)
      at org.mortbay.jetty.servlet.WebApplicationHandler.initializeServlets(WebApplicationHandler.java:150)
      at org.mortbay.jetty.servlet.WebApplicationContext.start(WebApplicationContext.java:442)
      at org.mortbay.j2ee.J2EEWebApplicationContext.start(J2EEWebApplicationContext.java:85)
      at org.jboss.jetty.JBossWebApplicationContext.start(JBossWebApplicationContext.java:89)
      at org.jboss.jetty.Jetty.deploy(Jetty.java:331)
      at org.jboss.jetty.JettyService.performDeploy(JettyService.java:242)
      at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:357)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
      ... 14 more
0
 
LVL 12

Expert Comment

by:Gibu George
ID: 24440697
What is the version of java which you are using?  on the machine which you are compiling and on the server?
0
 

Author Comment

by:sandhya01
ID: 24441362
Hi
Find the details:
on my machine in which I am compiling(windows xp)::
java -version: 1.5.0_18
javac -version: 1.5.0_18
JAVA_HOME:C:\Program Files\Java\jdk1.5.0_18

On the machine in which I am deploying(solaris):
java -version: 1.5.0_07
javac -version: 1.5.0_07
JAVA_HOME:/appl/documentum/share/java/1.4.2_4

Do you think JAVA_HOME is causing the problem?

Thanks

0
 
LVL 12

Expert Comment

by:Gibu George
ID: 24441446
yes, the  JAVA_HOME should point to the 1.5.0_07 version
0
 

Author Comment

by:sandhya01
ID: 24442113
Hi
I did change JAVA_HOME To point to 1.5.0_07, but still the same error. Do I need to restart the system also?
Also, why do you think the error is due to JAVA_HOME?

Thanks
0
 
LVL 12

Expert Comment

by:Gibu George
ID: 24442186
because you have used java version 5 to compile the servlet and it is showing the class version, since the lower version java VM is used to interpret the byte code generated by a higher version compiler. You need to restart tomcat after changing the java home
0
 

Author Comment

by:sandhya01
ID: 24442421
Hi
Once sec, in my target machine also JAVA -VERSION = 1.5.0_07, how can you say that lower VM is used to interpret the byte code?
and I am using jboss and not tomcat :)

Also, when I tried to compilte java files on my server machine, I got error, which i get when I dont set the appropriate jar files on the ClASSPATH
0
 
LVL 12

Expert Comment

by:Gibu George
ID: 24442459
See the error ava.lang.UnsupportedClassVersionError: HelloWorld (Unsupported major.minor version 49.0)
it says unsupported version error
0
 
LVL 12

Expert Comment

by:Gibu George
ID: 24442465
restart JBoss after setting the JAVA_HOME to version 5
0
 

Author Comment

by:sandhya01
ID: 24442631
Hi
To give you some more input:
1. my echo $PATH=/usr/local/bin:./:usr/bin
In the /usr/bin directory there are files : java; javac;jawaw etc
2. in my JAVA_HOME directory also there are directories 1.bin 2.lib etc

Hope it makes matter more clear.
0
 

Author Comment

by:sandhya01
ID: 24442734
Hi
I did the following:
I set the path to JAVA_HOME/BIN on the target machine,
now my java -version and javac -version and JAVA_HOME are all pointing to same version number(1.4),
now I compiled my source code with java version 1.4, and now I am getting the previous error:
org.jboss.deployment.DeploymentException: Could not create deployment: file:/appl/documentum/fulltext/IndexServer/j2ee/server/vespa/deploy/HelloWorld.war/; - nested throwable: (java.lang.ClassFormatError: HelloWorld (Illegal UTF8 string in constant pool))
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:853)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:640)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:613)
      at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
      at $Proxy7.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:302)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:458)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:200)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:211)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:190)
Caused by: java.lang.ClassFormatError: HelloWorld (Illegal UTF8 string in constant pool)
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
      at org.mortbay.http.ContextLoader.loadClass(ContextLoader.java:225)
      at org.mortbay.http.ContextLoader.loadClass(ContextLoader.java:198)
      at org.mortbay.http.HttpContext.loadClass(HttpContext.java:1317)
      at org.mortbay.jetty.servlet.Holder.start(Holder.java:165)
      at org.mortbay.jetty.servlet.ServletHolder.start(ServletHolder.java:198)
      at org.mortbay.jetty.servlet.ServletHandler.initializeServlets(ServletHandler.java:436)
      at org.mortbay.jetty.servlet.WebApplicationHandler.initializeServlets(WebApplicationHandler.java:150)
      at org.mortbay.jetty.servlet.WebApplicationContext.start(WebApplicationContext.java:442)
      at org.mortbay.j2ee.J2EEWebApplicationContext.start(J2EEWebApplicationContext.java:85)
      at org.jboss.jetty.JBossWebApplicationContext.start(JBossWebApplicationContext.java:89)
      at org.jboss.jetty.Jetty.deploy(Jetty.java:331)
      at org.jboss.jetty.JettyService.performDeploy(JettyService.java:242)
      at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:357)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)


Please let me know the jars I should keep in my classpath to compile the servlet on the target machine. Also please advice on the above error.

Thanks a lot
0
 
LVL 12

Expert Comment

by:Gibu George
ID: 24442839
For the servlet to work you don't need any particular jar file on the JBoss as the jboss has a servlet container whihc has the related jar files.

This error is normally caused by using a nonstandard compiler to compile or caused by pre JDK 2 compilers. are you using the standard compiler from Sun to compile your class?
0
 
LVL 12

Assisted Solution

by:Gibu George
Gibu George earned 250 total points
ID: 24442869
If you are using the standard one instead of using Ascii in your FTP set it to binary
0
 

Author Comment

by:sandhya01
ID: 24443199
Hey,
what a coincidence,
I exactly figured out that the culprit was the transfer method used , it should be binary and not ascii and when I came to post this solution, I see this you have already posted the same solution, though if you see up in the comments trail, I have posted the same problem above -05/21/09 04:12 AM.
Anyways, I got this answer from following linK:
http://www.artima.com/legacy/answers/Apr2000/messages/85.html

Anyways thanks for your help gibu_george. You deserve full points.

Thanks
-Rajesh
0
 

Author Comment

by:sandhya01
ID: 24471586
Hi
Find my servlet code,
After compiling the code on the linux machine, I am getting error " http 503 sevlet not initialized"

package com.wyeth.dctm.authenticate;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.documentum.com.DfClientX;
import com.documentum.com.IDfClientX;
import com.documentum.fc.client.IDfClient;
import com.documentum.fc.client.IDfSession;
import com.documentum.fc.common.DfException;
import com.documentum.fc.common.DfLogger;
import com.documentum.fc.common.IDfLoginInfo;

public class AuthenticationServlet extends HttpServlet
{
      
    public AuthenticationServlet()
    {
    }
   

    protected boolean authenticate(String strUserName,String strPassword,String strDocbase) {
          boolean isAuthenticated=true;
          IDfClientX clientX=null;
          IDfClient client=null;
          IDfLoginInfo loginInfo=null;
          IDfSession session=null;
          clientX=new DfClientX();
          try {
                client=clientX.getLocalClient();
                loginInfo=clientX.getLoginInfo();
                loginInfo.setUser(strUserName);
                loginInfo.setPassword(strPassword);
                session=client.newSession(strDocbase,loginInfo);
                if (session==null) {
                      isAuthenticated=false;
                      return isAuthenticated;
                }
                else {
                      isAuthenticated=session.getUser(strUserName).isSuperUser();
                }
                
                System.out.println("User Authenticated");
          }
          catch (DfException dfEx) {
                DfLogger.debug(this,"Unable to Authenticate user:: {0} in docbase {1}",new String[]{strUserName,strDocbase}, dfEx);
                System.out.println("User Not Authenticated::" + dfEx.toString());
                isAuthenticated=false;
          }
          finally {
                System.out.println(isAuthenticated);
          }
          
          return isAuthenticated;
    }
    public void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException
    {
          String strUserName=null;
          String strPassword=null;
          String strDocbase=null;
          
        System.out.println("Login servlet called");
         response.setContentType("text/html");
         response.setHeader("Cache-Control","no-store");
         strPassword = request.getParameter("password");
         strUserName = request.getParameter("login");
         strDocbase = request.getParameter("domain");
       
        if( authenticate(strUserName,strPassword,strDocbase))
        {
              PrintWriter out = response.getWriter();
            out.println("1");
        } else
        {
            PrintWriter out = response.getWriter();
            out.println("0");
        }
    }

    public boolean isUserInRole(String strRole,String strUserName) {
     
          return false;
    }
   
    public void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException
    {
        doPost(req, resp);
    }
}


Thanks
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
The viewer will learn common shortcuts with easy ways to remember them. The viewer will then learn where to find all of the keyboard shortcuts, how to create/change them, and how to speed up their workflow.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question