facebook

Jboss 4 + Struts2 = java.lang.NullPointerException

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #299224 Reply

    sumitkaran
    Member

    Hi,
    I am trying to deploy a struts 2.1 application on jboss 4.0.2.
    I can deploy via maven, and Ive followed the steps outlined here to configure myeclipse.
    http://struts.apache.org/2.0.14/docs/does-myeclipse-6-support-struts-2.html

    But no cigar, I keep getting

    !ENTRY org.eclipse.core.jobs 4 2 2009-06-10 11:39:13.312
    !MESSAGE An internal error occurred during: “Launching loanmanager on JBoss 4.x”.
    !STACK 0
    java.lang.NullPointerException
    at org.eclipse.core.runtime.Path.<init>(Path.java:152)
    at com.genuitec.eclipse.ast.deploy.core.DeploymentManager.computeDeploymentLocation(Unknown Source)
    at com.genuitec.eclipse.ast.deploy.core.ui.debug.RunOnServerLaunchConfigurationDelegate.ÄÂ�(Unknown Source)
    at com.genuitec.eclipse.ast.deploy.core.ui.debug.RunOnServerLaunchConfigurationDelegate.ÄÂ�(Unknown Source)
    at com.genuitec.eclipse.ast.deploy.core.ui.debug.RunOnServerLaunchConfigurationDelegate.ÄÂ�(Unknown Source)
    at com.genuitec.eclipse.ast.deploy.core.ui.debug.RunOnServerLaunchConfigurationDelegate.launch(Unknown Source)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:764)
    at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:614)
    at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:880)
    at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1083)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

    <Installation Summary>
    *** Date:
    Wednesday, June 10, 2009 11:45:41 AM EDT

    ** System properties:
    OS=WindowsXP
    OS version=5.1.0
    Java version=1.5.0_11

    *** MyEclipse details:
    MyEclipse Enterprise Workbench
    Version: 7.1.1
    Build id: 7.1.1-20090310

    *** Eclipse details:
    MyEclipse Enterprise Workbench

    Version: 7.1.1
    Build id: 7.1.1-20090310

    Eclipse Platform

    Version: 3.4.1.r341_v20080731-9I96EiDElYevwz-p1bP5z-NlAaP7vtX6Utotqsu
    Build id: M20080911-1700

    Eclipse Java Development Tools

    Version: 3.4.1.r341_v20080709-0800-7o7tEAfEF_U5qyUgrb2HAp539P97
    Build id: M20080709-0800

    Eclipse Graphical Editing Framework GEF

    Version: 3.4.1.v20080806-67718083A56B4H2A3213573
    Build id: 200809101400

    Eclipse RCP

    Version: 3.4.100.r341_v20080814-989JESIEdAciFYfkZZsBfSwQ2341
    Build id: M20080703-0800

    Eclipse Plug-in Development Environment

    Version: 3.4.1.r341_v20080731-7T7U0E9mlRIuGUYviF_VP
    Build id: M20080703-0800

    Eclipse startup command=-os
    win32
    -ws
    win32
    -arch
    x86
    -showsplash
    -launcher
    C:\Program Files\Genuitec\MyEclipse 7.1\myeclipse.exe
    -name
    Myeclipse
    –launcher.library
    C:\Program Files\Genuitec\MyEclipse 7.1\../Common\plugins\org.eclipse.equinox.launcher.win32.win32.x86_1.0.101.R34x_v20080731\eclipse_1115.dll
    -startup
    C:\Program Files\Genuitec\MyEclipse 7.1\../Common\plugins\org.eclipse.equinox.launcher_1.0.101.R34x_v20080819.jar
    -clean
    -configuration
    configuration
    -vm
    C:\Program Files\Genuitec\Common\binary\com.sun.java.jre.win32.x86_1.5.0.011\bin\client\jvm.dll

    #299229 Reply

    Loyal Water
    Member

    MyEclipse does not support Struts 2 at this point in time.

    Moving to Off Topic >> Software Development.

    #299231 Reply

    sumitkaran
    Member

    Thanks for your reply, but this post implies that there is a workaround?

    https://www.genuitec.com/forums/topic/jboss-5-1-0-ga-struts-does-not-work/

    #299239 Reply

    support-joy
    Member

    sumitkaran,

    Nipun is right, ME currently doesn’t support Struts2. Having said that, there is a workaround. Here is a sample project which elaborates using struts2
    1) Create a web application
    2) Configure the web.xml to load the Struts filter. MyEclipse will create a starter web.xml. Just change it to look like this:
    <?xml version=”1.0″ encoding=”UTF-8″?>
    <web-app version=”2.5″
    xmlns=”http://java.sun.com/xml/ns/javaee&#8221;
    xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221;
    xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd”&gt;

    <filter>
    <filter-name>
    struts2
    </filter-name>
    <filter-class>
    org.apache.struts2.dispatcher.FilterDispatcher
    </filter-class>
    </filter>
    <filter-mapping>
    <filter-name>
    struts2
    </filter-name>
    <url-pattern>
    /*
    </url-pattern>
    </filter-mapping>
    <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    </web-app>

    3) Create a Jsp file, which will ask you to enter your name.

    <%@ page language=”java” contentType=”text/html; charset=UTF-8″pageEncoding=”UTF-8″%>
    <%@ taglib prefix=”s” uri=”/struts-tags” %>
    <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”&gt;
    <html>
    <head>
    <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
    <title>Welcome to Struts 2
    </head>
    <body>
    <s:form action=”struts”>
    <s:textfield name=”name” label=”Your name”/>
    <s:submit/>
    </s:form>

    </body>
    </html>
    4) Create a Success JSP page, which will display the result after executing your action class. Here this page will greet you with your name as mentioned in index.jsp page.

    <%@ page language=”java” contentType=”text/html; charset=UTF-8″
    pageEncoding=”UTF-8″%>
    <%@ taglib prefix=”s” uri=”/struts-tags” %>
    <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”&gt;
    <html>
    <head>
    <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
    <title>Hello, Struts
    </head>
    <body>
    <h4>Hello, <s:property value=”name”/>!</h4>
    </body>
    </html>

    5) Create an Action class.

    package com.test.TestApp.action;
    import org.apache.struts2.config.Result;


    @Result
    (name=”SUCCESS”, value=”/success.jsp”)
    public class StrutsAction
    {
    private String name;
    public void setName(String a){
    name=a;
    }
    public String getName(){
    return name;
    }
    public String execute()
    {
    return “SUCCESS”;
    }
    }

    6) Then add necessary Jar files as Referenced Libraries
    Right click on your project and select
    Build Path >Add External Archives, then locate and add your Struts2 library files.

    • struts2-core
    • xwork2
    • freemarker
    • ognl
    • commons-logging

    7) Deploy into Server and execute the application.

    #302502 Reply

    sumitkaran
    Member

    Thanks Joy, but I can set up a struts 2 app in ME, but I cant get it to deploy and debug?
    can you offer some guidance on how to get ME to deploy to JBoss and debug?
    I already have ME setup to deploy/debug spring apps?

    Thanks again.

    #302509 Reply

    support-joy
    Member

    sumitkaran,

    but I cant get it to deploy and debug?

    Are you getting any errors in JBoss console when you deploy Struts2 based application?. If so Please copy and paste those error messages.
    Can you elaborate more about what problem you are facing with Struts2 application?

    #302520 Reply

    sumitkaran
    Member

    Thanks for your reply.
    I dont have a debug option to debug on a server.
    When I right click on the project and select debug, I dont see an option to debug on my jboss server, which is setup.
    I can, however, use maven to build and deploy to my jboss server, and then use ME to debug that server and my struts code.

    I dont have this problem with any of my spring apps, I can just right click and debug to my server.
    Hope that gives you an idea, please let me know if you need more information.

    Thanks again.

    #302541 Reply

    support-joy
    Member

    sumitkaran,

    I am not able to replicate this issue at my end. I am able to debug Struts2 Application using JBoss4,JBoss5, Tomcat and Weblogic10.
    Have you tried to debug any other struts2 application?
    MyEclipse8.0 will be released soon, which includes Struts2 capabilities. As already mentioned that ME7.5 does not support Struts2 capabilities, I would suggest you wait for ME8 release.

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Jboss 4 + Struts2 = java.lang.NullPointerException

You must be logged in to post in the forum log in