Error Server could not create ASP.reporting_reportvalueprediction_aspx - vb.net

I am binding RDLC Report viewer in my project but getting this error
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Server could not create ASP.reporting_reportvalueprediction_aspx.
Stack Trace:
[InvalidOperationException: Server could not create ASP.reporting_reportvalueprediction_aspx.]
__ASP.FastObjectFactory_app_web_1r4mqrnz.Create_ASP_reporting_reportvalueprediction_aspx() +192
System.Web.Compilation.BuildResultCompiledType.CreateInstance() +31
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp) +104
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33
System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String virtualPath, String path) +39
System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +386
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +50
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +163
This is my code which I have tried
<%# Page Language="vb" Debug="true" AutoEventWireup="false" CodeBehind="ReportValuePrediction.aspx.vb" Inherits="TimiWeb.ReportValuePrediction" %>
<%# Register Assembly="Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager" runat="server">
</asp:ScriptManager>
<div>
<rsweb:ReportViewer ID="rptReportViewer" runat="server" Width="100%" Height="700px">
</rsweb:ReportViewer>
</div>
</form>
</body>
</html>
Imports Microsoft.Reporting.WebForms
Public Class ReportValuePrediction
Inherits System.Web.UI.Page
Private _dt As DataTable
Public Sub New(ByVal dt As DataTable)
_dt = dt
End Sub
Protected Sub Page_Load(sender As Object, e As EventArgs)
If Not IsPostBack Then
Dim rep As LocalReport = rptReportViewer.LocalReport
rep.ReportPath = "/Reporting/ValuePrediction.rdlc"
Dim rds As New ReportDataSource()
If _dt.Rows.Count > 0 Then
rds.Name = "ValuePredictionDS"
rds.Value = _dt
rep.DataSources.Add(rds)
End If
End If
End Sub
End Class

Don't get dt values through the constructor, the value is not sustaining, pass the dt values in the page load method
and add a page load event in the report viewer from the report viewer property

Related

Unity Container Vb.net LoadConfiguration Exception

I'm currently using Vb.net in connection with the Unity Container model. But I can't get it to work.
My code is always failing in the Factory.
unity.config:
<unity>
<containers>
<container>
<types>
<type type="TestApplication.Interfaces.IBuilder, TestApplication.Interfaces" mapTo="TestApplication.Classes.Builder, TestApplication.Classes">
<lifetime type="singleton" />
</type>
</types>
</container>
</containers>
</unity>
I'm using a custom config source referenced in my App.config file.
The app.config looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration" />
</configSections>
<unity configSource="unity.config" />
</configuration>
My Factory.vb looks like this:
Imports Microsoft.Practices.Unity
Imports Microsoft.Practices.Unity.Configuration
Imports System.Configuration
Public NotInheritable Class Factory
Private Shared registeredTypes As New Dictionary(Of Type, Object)
Public Shared Function GetInstance(Of T)(Optional asSingleton As Boolean = False) As T
Using container As UnityContainer = Factory.GetConfiguredUnityContainer()
Dim instance = container.Resolve(Of T)()
If (asSingleton = True And Not Factory.registeredTypes.ContainsKey(GetType(T))) Then
Factory.Register(Of T)(instance)
End If
Return instance
End Using
End Function
Private Shared Function GetConfiguredUnityContainer() As UnityContainer
Dim container As New UnityContainer
container.LoadConfiguration()
For Each item In registeredTypes
container.RegisterInstance(item.Key, item.Value)
Next
Return container
End Function
Private Shared Sub Register(Of T)(instance As T)
registeredTypes(GetType(T)) = instance
End Sub
End Class
The Factory fails at the line:
container.LoadConfiguration() in the GetConfiguredUnityContainer method.
A first chance exception of type System.Configuration.ConfigurationsErrorsException occured in System.Configuration.dll
I do have references to the mapped assembly. TestApplication.Classes also to the TestApplication.Interfaces
The interface is named IBuilder.vb and the class is named Builder.vb
References in the project:
Microsoft.Practices.Unity
Microsoft.Practices.Unity.Configuration
PresentationCore
PresentationFramework
System.Configuration
Please suggest me any chances, I'd be happy.
Greets.
So, after I checked some things over the weekend, I came to the conclusion that vb.net doesn't support an external unity configSource.
You could parse the config file with an xml parser and read each value. But I'm too lazy for that.
I edited my:
app.Config like that:
Inserted the container from the unity.config to my app.config
Code:
<configuration>
<configSections>
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration"/>
</configSections>
<unity>
<container>
<register type="TestApplication.Interfaces.IBuilder, TestApplication.Interfaces" mapTo="TestApplication.Classes.Builder, TestApplication.Classes" />
</container>
</unity>
I registered the type/s inside the App.config, after that I can read the container with my Factory, and can work with the unity container.

Page 404 NoT Found Even the Tomcat is not showing any error

I am trying to run this simple example on eclipse .As i run the server it is not showing any error .But in the browser it is showing 404 error page not found. I don't understand what is the error.I have used all the Jars in my WEB-INF/Lib folder too.
THE CODE SNIPPET is below:
CLASS HELLOWORLDACTION
package com.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.form.HelloWorldForm;
public class HelloWorldAction extends Action{
public ActionForward execute(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response) throws Exception {
HelloWorldForm helloWorldForm = (HelloWorldForm) form;
helloWorldForm.setMessage("Hello World! Struts");
return mapping.findForward("success");}
}
CLASS HelloWorldForm
package com.form;
import org.apache.struts.action.ActionForm;
public class HelloWorldForm extends ActionForm{
String message;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
Struts-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans>
<form-bean name="helloWorldForm"
type="com.form.HelloWorldForm"/>
</form-beans>
<action-mappings>
<action path="/helloWorld"
type="com.action.HelloWorldAction"
name="helloWorldForm">
<forward name="success" path="/HelloWorld.jsp"/>
</action>
</action-mappings>
</struts-config>
Web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Maven Struts Examples</display-name>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>
/WEB-INF/struts-config.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
HelloWorld.jsp
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%#taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h1><bean:write name="helloWorldForm" property="message" />
</h1>
</body>
</html>
It sounds like you are using the wrong url. Tomcat generally has a folder called webapps for applications that are deployed on that server. To figure out the configuration, in Eclipse, open up the Server tab, find your Tomcat server and double-click on it.
It should bring up a properties pane with two tabs at the bottom Overview and Modules. Click on Modules and you should see the path to your app. For me, it's in the form of: /webapps/<project name>
Your full url would be localhost:8080/webapps/<project name>/anystringhere.do since you map anything in your app (localhost:8080/webapps/<project name>/) that ends in .do to the action servlet.

#using(Html.BeginForm()) returning Format exception mvc4

I have an MVC4 web app running without any issues on my dev machine but once i deploy it to the host server i get the following exception thrown on #using(Html.BeginForm()).
String was not recognized as a valid Boolean.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: String was not recognized as a valid Boolean.
Source Error:
Line 4:
Line 5:
Line 6: #using(Html.BeginForm(new { returnurl = ViewBag.Returnurl }))
Line 7: {
Line 8: #Html.AntiForgeryToken()
Source File: e:\Sites\familybook\Views\Login\Login.cshtml Line: 6
Stack Trace:
[FormatException: String was not recognized as a valid Boolean.]
System.Boolean.Parse(String value) +12636900
System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) +12819466
System.Web.Mvc.ViewContext.ScopeGet(IDictionary`2 scope, String name, TValue defaultValue) +89
System.Web.Mvc.ScopeCache..ctor(IDictionary`2 scope) +48
System.Web.Mvc.ScopeCache.Get(IDictionary`2 scope, HttpContextBase httpContext) +282
System.Web.Mvc.ViewContext.GetClientValidationEnabled(IDictionary`2 scope, HttpContextBase httpContext) +9
System.Web.Mvc.Html.FormExtensions.FormHelper(HtmlHelper htmlHelper, String formAction, FormMethod method, IDictionary`2 htmlAttributes) +162
System.Web.Mvc.Html.FormExtensions.BeginForm(HtmlHelper htmlHelper, Object routeValues) +192
ASP._Page_Views_Login_Login_cshtml.Execute() in e:\Sites\familybook\Views\Login\Login.cshtml:6
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +125
System.Web.WebPages.StartPage.ExecutePageHierarchy() +143
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +181
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +380
System.Web.Mvc.c__DisplayClass1a.b__17() +33
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +613
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +263
System.Web.Mvc.Async.c__DisplayClass25.b__22(IAsyncResult asyncResult) +230
System.Web.Mvc.c__DisplayClass1d.b__18(IAsyncResult asyncResult) +28
System.Web.Mvc.Async.c__DisplayClass4.b__3(IAsyncResult ar) +20
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
System.Web.Mvc.Async.c__DisplayClass4.b__3(IAsyncResult ar) +20
System.Web.Mvc.c__DisplayClass8.b__3(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.c__DisplayClass4.b__3(IAsyncResult ar) +20
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
The host server is a Windows server 2008 R2 64-bit with IIS 7.5 and the latest updates for OS and .NET 4 framework installed on it.
The funny thing is that when I deployed before I did not get this error until I updated the server with windows updates. Another thing that I have noted is that if I set the type of publish to debug the application works without any problems while it does not with release publish type.
I did also try to deploy to local folder on my dev machine and then copy the content to the host server, but got the same end results.
Edit:
#model FamilyBook.Models.Account.LoginUserModel
#Scripts.Render("~/bundles/jqueryval")
<section>
#using(Html.BeginForm(new { returnurl = ViewBag.Returnurl }))
{
#Html.AntiForgeryToken()
#Html.ValidationSummary(true)
<fieldset>
<legend>Login with local account</legend>
<div class="editor-label">
#Html.LabelFor(model => model.Username)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.Username)
#Html.ValidationMessageFor(model => model.Username)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.Password)
</div>
<div class="editor-field">
#Html.PasswordFor(model => model.Password)
#Html.ValidationMessageFor(model => model.Password)
</div>
<div class="editor-label">
#Html.LabelFor(model => model.RememberMe)
</div>
<div class="editor-field">
#Html.CheckBoxFor(model => model.RememberMe)
</div>
<p>
<input type="submit" value="Login" />
</p>
</fieldset>
}
</section>
The root cause of the problem was that when web.conf transformation was performed on appSettings for custom keys, they overwrote all other keys with the same value of the first custom key. So a simple change on the -> solved the problem.
This can be seen in the stack trace where the application crashes when this function in MVC System.Web.Mvc.ViewContext.GetClientValidationEnabled is called to check if clientSideValidation is enabled or not. More info can be found in this thread http://forums.asp.net/t/1924833.aspx/1?Format+exception+on+Html+BeginForm+String+was+not+recognized+as+a+valid+boolean

Updating xamlx-workflow service reference threw XamlObjectWriterException : 'Cannot create unknown type [...]'

In vs 2010, on right clicking and updating the service reference pointing to my xamlx workflow service project, it throws an error (written in raw html) stating that :
XamlObjectWriterException : 'Cannot create unknown type [...]'
[...] pointing out a message variable of my project.
My workflow is xamlx hosted with WorkflowServiceHost class.
It seems to be due to the SendResponse message. Message type uses [DataContract] and [DataMember], and 'Parameters' ha been chosen in the content UI.
Can't find out what exactly is messing in my message type. Maybe it is something in the build properties of my wkf project ...
Any help is very welcome.
Here is the html sent back :
There was an error downloading 'http://localhost:8008/WfDerogationCreation.xamlx'.
There was an error downloading 'http://localhost:8008/WfDerogationCreation.xamlx'.
The request failed with the error message:
--
<html>
<head>
<title>'Cannot create unknown type '{http://schemas.microsoft.com/netfx/2009/xaml/activities}Variable({clr-namespace:CompanyName.WorkflowSecurity.Derogation.Messages;assembly=CompanyName.WorkflowSecurity}DerogRequest)'.' Line number '4' and line position '8'.</title>
<style>
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Lucida Console";font-size: .9em}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
</style>
</head>
<body bgcolor="white">
<span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>
<h4> <i>'Cannot create unknown type '{http://schemas.microsoft.com/netfx/2009/xaml/activities}Variable({clr-namespace:CompanyName.WorkflowSecurity.Derogation.Messages;assembly=CompanyName.WorkflowSecurity}DerogRequest)'.' Line number '4' and line position '8'.</i> </h4></span>
<font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
<b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
<br><br>
<b> Exception Details: </b>System.Xaml.XamlObjectWriterException: 'Cannot create unknown type '{http://schemas.microsoft.com/netfx/2009/xaml/activities}Variable({clr-namespace:CompanyName.WorkflowSecurity.Derogation.Messages;assembly=CompanyName.WorkflowSecurity}DerogRequest)'.' Line number '4' and line position '8'.<br><br>
<b>Source Error:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code>
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code>
</td>
</tr>
</table>
<br>
<b>Stack Trace:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre>
[XamlObjectWriterException: 'Cannot create unknown type '{http://schemas.microsoft.com/netfx/2009/xaml/activities}Variable({clr-namespace:CompanyName.WorkflowSecurity.Derogation.Messages;assembly=CompanyName.WorkflowSecurity}DerogRequest)'.' Line number '4' and line position '8'.]
System.Xaml.XamlObjectWriter.WriteStartObject(XamlType xamlType) +1131129
System.Xaml.XamlWriter.WriteNode(XamlReader reader) +158
System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter) +106
System.Xaml.XamlServices.Load(XamlReader xamlReader) +56
System.ServiceModel.Activities.Activation.WorkflowServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +302
System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +1461
System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +44
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +651
[ServiceActivationException: The service '/WfDerogationCreation.xamlx' cannot be activated due to an exception during compilation. The exception message is: 'Cannot create unknown type '{http://schemas.microsoft.com/netfx/2009/xaml/activities}Variable({clr-namespace:CompanyName.WorkflowSecurity.Derogation.Messages;assembly=CompanyName.WorkflowSecurity}DerogRequest)'.' Line number '4' and line position '8'..]
System.Runtime.AsyncResult.End(IAsyncResult result) +688590
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +190
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, String routeServiceVirtualPath, Boolean flowContext, Boolean ensureWFService) +234
System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +379
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
</pre></code>
</td>
</tr>
</table>
<br>
<hr width=100% size=1 color=silver>
<b>Version Information:</b> Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.237
</font>
</body>
</html>
<!--
[XamlObjectWriterException]: 'Cannot create unknown type '{http://schemas.microsoft.com/netfx/2009/xaml/activities}Variable({clr-namespace:CompanyName.WorkflowSecurity.Derogation.Messages;assembly=CompanyName.WorkflowSecurity}DerogRequest)'.' Line number '4' and line position '8'.
at System.Xaml.XamlObjectWriter.WriteStartObject(XamlType xamlType)
at System.Xaml.XamlWriter.WriteNode(XamlReader reader)
at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
at System.Xaml.XamlServices.Load(XamlReader xamlReader)
at System.ServiceModel.Activities.Activation.WorkflowServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
[ServiceActivationException]: The service '/WfDerogationCreation.xamlx' cannot be activated due to an exception during compilation. The exception message is: 'Cannot create unknown type '{http://schemas.microsoft.com/netfx/2009/xaml/activities}Variable({clr-namespace:CompanyName.WorkflowSecurity.Derogation.Messages;assembly=CompanyName.WorkflowSecurity}DerogRequest)'.' Line number '4' and line position '8'..
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, String routeServiceVirtualPath, Boolean flowContext, Boolean ensureWFService)
at System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
-->## Heading ##
--.
Metadata contains a reference that cannot be resolved: 'http://localhost:8008/WfDerogationCreation.xamlx'.
The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
If the service is defined in the current solution, try building the solution and adding the service reference again.
I eventually solved this problem like this :
In the couple of ReceiveResponse / SendReply activities.
1/ Delete SendReply.
2/ Recreate SendReply by right clicking on the ReceiveResponse activity and reset properties like on the deleted one.
Xamlx service reference then uploaded quite well ...
Found that error message was quite inappropriate written in raw html, my screen wasn't big enough to read all of it. Anyway, thank you for your help.
This is the Xaml stack's way of telling you that it doesn't know about CompanyName.WorkflowSecurity.Derogation.Messages. What you need to do is figure out why it doesn't know about this type.
The assembly name sure looks strange though "CompanyName.WorkflowSecurity}DerogRequest" notice the '}'? Is that a typo?
Check the XAMLX file at Line number '4' and line position '8'

How do you get a Struts2 value from the .properties file programatically?

Say I have a struts.properties file with a defined value uploads.directory . How can I access that value from an Actioncontext programatically?
You can use getText("some.property.name") which return you the property value
http://struts.apache.org/maven/struts2-core/apidocs/com/opensymphony/xwork2/ActionSupport.html
Create ActionSupport Object and by using getText() method of ActionSupport class.
ActionSupport actionSupport = new ActionSupport();
actionSupport.getText("foo.bar");
Create a resources folder under src.
In the struts.xml file add a constant e.g., <constant name="struts.custom.i18n.resources" value="global"></constant>
Here global is the name of properties file.
Now you will be able to use the properties in the entire application.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<!-- constant to define result path locations to project root directory -->
<!-- constant to define global resource bundle -->
<constant name="struts.custom.i18n.resources" value="global"></constant>
<package name="user" namespace="/" extends="struts-default">
<action name="home">
<result>/home.jsp</result>
</action>
<action name="welcome" class="com.waqar.struts2.actions.WelcomeAction">
<result name="success">/welcome.jsp</result>
</action>
</package>
</struts>
The welcome.jsp
<%# page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%# taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><s:property value="getText('action.welcome.title')"/></title>
</head>
<body>
<s:property value="getText('action.welcome.username')"/>: <s:property value="username"/><br>
</body>
</html>
global.properties
action.welcome.username=waqar
In action class
System.out.println(getText("action.welcome.username"));
You need to put the my.properties file or my_locale.propeties file in the package that houses your action class.
You need to put the values in properties files other than struts.properties for examples ApplicationResources.properties or my.properties which needs to be in the classpath. struts.properties file is used to load struts specific properties for example struts.i18n.encoding=UTF-8 or struts.devMode = false etc.
The thing you need to do in struts.properties after you create the properties file for your customized messages is you have to add the following property in struts.properties file
struts.custom.i18n.resources=ApplicationResources
If you have more than one custom message property files then you need to add them by separating with comma for example:
struts.custom.i18n.resources=ApplicationResources,my
Then in your action classes you can access the property values by using getText('propertyName')
you can get value from message resource file like this:
public class MyAction extends ActionSupport {
public String getUserDetails() {
if("First Name".equals(getText("label.firstName"))) {
System.out.println("In if block");
}
}
}
you can also get more information, how to get values from .properties files in java class or jsp files.
for JSP:
<s:text name="label.firstName" />
and
<s:property value="getText('label.age')" />
for more information you can go through this link:
get info here