This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes Problem deplying struts application in weblogic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem deplying struts application in weblogic" Watch "Problem deplying struts application in weblogic" New topic
Author

Problem deplying struts application in weblogic

Prashanth Chandra
Ranch Hand

Joined: Dec 07, 2005
Posts: 79
Hi all
I have depolyed a struts application in weblogic server which is able to recognize the applcation and is displaying the home page. But when I am trying to call the FormBean or Action class it says class not found.

I have compiled my classes as
javac -d . DtsDataForm.java DtsDataAction.java DtsUtil.java

It get compiled and creates the exact package folder strutcture. I have put these files in WEB-INF/classes folder.

Below are the errors:

java.lang.ClassNotFoundException: com.gecs.dts.DtsDataForm
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at org.apache.struts.action.ActionServlet.processActionForm(ActionServlet.java:1701)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1563)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)


java.lang.ClassNotFoundException: com.gecs.dts.DtsDataAction
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at org.apache.struts.action.ActionServlet.processActionCreate(ActionServlet.java:1631)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1577)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)


regards
Prashanth
tapeshwar sharma
Ranch Hand

Joined: Mar 10, 2006
Posts: 245
Can you post the complete source code for : DtsDataForm.java ?
Please paste code for only this file for now.
Kindly use the UBB code tag for this purpose.
Refer to this for more information.
Prashanth Chandra
Ranch Hand

Joined: Dec 07, 2005
Posts: 79
Hi,
Please find the code below:

package com.dts;
import java.sql.*;
import java.util.StringTokenizer;
import java.util.ArrayList;
import java.util.HashMap;
import java.io.*;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public class DtsDataForm extends ActionForm
{
String start=null;
String end=null;
String startTime=null;
String endTime=null;
public void setStart(String start)
{
this.start=start;
}
public String getStart()
{
return this.start;
}

public void setEnd(String end)
{
this.end=end;
}
public String getEnd()
{
return this.end;
}

public void setStartTime(String startTime)
{
this.startTime=startTime;
}
public String getStartTime()
{
return this.startTime;
}


public void setEndTime(String endTime)
{
this.endTime=endTime;
}
public String getEndTime()
{
return this.endTime;
}
public void reset(ActionMapping mapping, HttpServletRequest request)
{
this.start = null;
this.end = null;
this.startTime = null;
this.endTime = null;
}

}


regards
Prashanth
tapeshwar sharma
Ranch Hand

Joined: Mar 10, 2006
Posts: 245
Ok, first of all, kindly use the code tags to paste any code.It makes it easier for others to understand what you are saying, so ultimately, it will help you.

Your code for DtsDataForm specifies package name as "com.dts", whereas at runtime, it this Form is expected to be inside com/gecs/dts.
This is obvious from the following error:


Kindly check the Action and Form classes signature specified in
struts-config.xml for the associated mapping.
Its likely that you have specified wrong fully-qualified class names.

Once again, please follow the rules of the Ranch and use proper code tags.
Prashanth Chandra
Ranch Hand

Joined: Dec 07, 2005
Posts: 79
Hi All,
Sorry the package structure was "com.gecs.dts"

There was a miss while I was pasting the code.



regards
Prashanth
tapeshwar sharma
Ranch Hand

Joined: Mar 10, 2006
Posts: 245
Ok, once again go back and supply the following items 'As It is' from the source files :
1) DtsDataForm.java
2) struts-config.xml.
Also, provide the directory structure that you see after the compilation of source files under WEB-INF/classes.

Please use proper code tags or I may not be able to help you.
Prashanth Chandra
Ranch Hand

Joined: Dec 07, 2005
Posts: 79
Hi

DtsDataForm.java

<code>
package com.gecs.dts;
import java.sql.*;
import java.util.StringTokenizer;
import java.util.ArrayList;
import java.util.HashMap;
import java.io.*;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public class DtsDataForm extends ActionForm
{
String start=null;
String end=null;
String startTime=null;
String endTime=null;
public void setStart(String start)
{
this.start=start;
}
public String getStart()
{
return this.start;
}

public void setEnd(String end)
{
this.end=end;
}
public String getEnd()
{
return this.end;
}

public void setStartTime(String startTime)
{
this.startTime=startTime;
}
public String getStartTime()
{
return this.startTime;
}


public void setEndTime(String endTime)
{
this.endTime=endTime;
}
public String getEndTime()
{
return this.endTime;
}
public void reset(ActionMapping mapping, HttpServletRequest request)
{
this.start = null;
this.end = null;
this.startTime = null;
this.endTime = null;
}

}

Struts-config.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!--<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">


This is a blank Struts configuration file with an example
welcome action/page and other commented sample elements.

Tiles and the Struts Validator are configured using the factory defaults
and are ready-to-use.

NOTE: If you have a generator tool to create the corresponding Java classes
for you, you could include the details in the "form-bean" declarations.
Otherwise, you would only define the "form-bean" element itself, with the
corresponding "name" and "type" attributes, as shown here.
-->


<struts-config>

<!-- ============================================ Data Source Configuration -->

<!-- ================================================ Form Bean Definitions -->

<form-beans>

<form-bean name="DtsDataForm" type="com.gecs.dts.DtsDataForm"/>

</form-beans>


<!-- ========================================= Global Exception Definitions -->

<global-exceptions>
<!-- sample exception handler
<exception
key="expired.password"
type="app.ExpiredPasswordException"
path="/changePassword.jsp"/>
end sample -->
</global-exceptions>



<action-mappings>
<!-- Default "Welcome" action -->
<!-- Forwards to Welcome.jsp -->
<action
path="/DtsDataAction"
type="com.gecs.dts.DtsDataAction"
name="DtsDataForm"
scope="request"
validate="true"
input="/jsp/HomeReport.jsp">

<forward name="success" path="/jsp/dts.jsp"/>
</action>

</action-mappings>


<!-- ============================================= Controller Configuration -->

<controller
processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>


<!-- ======================================== Message Resources Definitions -->

<message-resources parameter="MessageResources" />


<!-- =============================================== Plug Ins Configuration -->

<!-- ======================================================= Tiles plugin -->
<!--
This plugin initialize Tiles definition factory. This later can takes some
parameters explained here after. The plugin first read parameters from
web.xml, thenoverload them with parameters defined here. All parameters
are optional.
The plugin should be declared in each struts-config file.
- definitions-config: (optional)
Specify configuration file names. There can be several comma
separated file names (default: ?? )
- moduleAware: (optional - struts1.1)
Specify if the Tiles definition factory is module aware. If true
(default), there will be one factory for each Struts module.
If false, there will be one common factory for all module. In this
later case, it is still needed to declare one plugin per module.
The factory will be initialized with parameters found in the first
initialized plugin (generally the one associated with the default
module).
true : One factory per module. (default)
false : one single shared factory for all modules
- definitions-parser-validate: (optional)
Specify if xml parser should validate the Tiles configuration file.
true : validate. DTD should be specified in file header (default)
false : no validation

Paths found in Tiles definitions are relative to the main context.
-->

<plug-in className="org.apache.struts.tiles.TilesPlugin" >

<!-- Path to XML definition file -->
<set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml" />
<!-- Set Module-awareness to true -->
<set-property property="moduleAware" value="true" />
</plug-in>


<!-- =================================================== Validator plugin -->

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>

</struts-config>
</code>

Package Structure:
WEB-INF/classes/com/gecs/dts/DtsDataForm


regards
Prashanth
tapeshwar sharma
Ranch Hand

Joined: Mar 10, 2006
Posts: 245
It really wouldn't hurt to read this link before you start posting.
My guess is that there might be a problem with your server class path, since the qualified names in struts-config and the folder structure seem to be in order.
You can also try putting all your class files in a jar file under WEB-INF/lib.
Prashanth Chandra
Ranch Hand

Joined: Dec 07, 2005
Posts: 79
Hi
Have set the classpath for the classes I have compiled and also put them in WEB-INF/lib folder. But still facing the same issue



regards
Prashanth
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem deplying struts application in weblogic