Struts2 upload file error - file-upload

I want to upload a file to my web project, but I'm getting:
WARN o.a.struts2.dispatcher.Dispatcher - Could not find create multipart save directory '/temp'.
WARN o.a.s.d.m.JakartaMultiPartRequest - Unable to parse request
org.apache.commons.fileupload.FileUploadBase$IOFileUploadException:
Processing of multipart/form-data request failed.
/temp/upload_1e39874d_effe_405b_9a92_3050ca60a661_00000000.tmp (No such file or directory)
so I want to change the upload directory
<struts>
<constant name="struts.multipart.saveDir" value="/tmp"></constant>
<package name="brand-struts" extends="abstract-struts">
<action name="saveBatchBrandGoodsInfo" class="brandgoodsAction"
method="saveBatchBrandGoodsInfo">
<interceptor-ref name="fileUpload">
<param name="savePath">/upload</param>
<param name="maximumSize">1024000</param>
</interceptor-ref>
<result name="data" type="json">
<param name="root">data</param>
</result>
</action>
</package>
</struts>
but it doesn't work, I keep getting the same error

AFAIK, there's no such thing as an abstract-struts package. Just extend struts-default and remove the savePath customization.
You're including only the fileUpload Interceptor, not the whole defaultStack. You need to do:
<interceptor-ref name="defaultStack">
<param name="fileUpload.maximumSize">1024000</param>
</interceptor-ref>
Also ensure your form has enctype="multipart/form-data".

Related

Running Gatling tests not showing testFile.log on IntelliJ

We have an issue where whenever our Gatling performance tests are run the .log file that should generate at the root of the folder is not there.
This is my whole logback file if anyone able to help please.
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
<resetJUL>true</resetJUL>
</contextListener>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter> -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern>
<immediateFlush>true</immediateFlush>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>testFile.log</file>
<append>false</append>
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern>
</encoder>
</appender>
<!-- uncomment and set to DEBUG to log all failing HTTP requests -->
<!-- uncomment and set to TRACE to log all HTTP requests -->
<logger name="io.gatling.http.engine.response" level="TRACE" />
<root level="WARN">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
</root>
Thank you very much.
Update
It seems the issue may be with IntelliJ itself as noticed we can see the file when going directly to the finder.
Disabling custom plugins should help. Seems one of configuration was corrupted.
There's a good chance the file is simply not generated where you expect it. Try setting an absolute path instead to verify.

NLog outputting all fields in `message` property

I'm using NLog with a Redis target. In an older version all of the attributes in my layout used to appear as 1st class data-items when viewing in Kibana.
Since upgrading to the latest version they all appear as a JSON encoded string value against a single data-item named message.
I've tried specifying a JsonLayout for the message value but it has made no difference
<targets async="true">
<target xsi:type="FallbackGroup" name="fallbacklogger" returnToFirstOnSuccess="true">
<target xsi:type="Redis" name="RedisLog" appName="${appName}" environmentKey="EnvironmentName" connectionStringKey="LoggingRedisConnectionString" includeAllProperties="true" keySettingsKey="LoggingRedisKey">
<layout xsi:type="JsonLayout">
<attribute name="message" encode="false">
<layout type="JsonLayout" includeAllProperties="true" includeMdlc="true"></layout>
</attribute>
</layout>
</target>
</target>
</targets>
How do I get these back to first class data-items in Kibana so that I can click the Filter button against them?
Someone at work fixed this problem, he said he upgraded all dependencies to the latest version and then changed the following:

Pentaho CDE: Is there a way to debug the sql command being executed?

I'm wondering if there is a way to debug the sql command that SQL Query component executes at runtime?
I know placing a "console.log()" can debug components but SQL Query does not have an event to set the console up
Regards,
Erick
Shutdown Pentaho Server, goto YOURDRIVE:\pentaho\biserver-ce\tomcat\webapps\pentaho\WEB-INF\classes\
Open log4j.xml and uncomment this section:
<!--
<appender name="SQLLOG" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="../logs/mondrian_sql.log"/>
<param name="Append" value="false"/>
<param name="MaxFileSize" value="500KB"/>
<param name="MaxBackupIndex" value="1"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
</layout>
</appender>
<category name="mondrian.sql">
<priority value="DEBUG"/>
<appender-ref ref="SQLLOG"/>
</category>
-->
GOTO YOURDRIVE:\pentaho\biserver-ce\pentaho-solutions\system\mondrian
, open mondrian.properties, make sure below code is set to "true"
mondrian.rolap.generate.formatted.sql=true
Start the Pentaho server now, it will start making mysql log file in the "YOURDRIVE:\pentaho\biserver-ce\tomcat\logs\" folder when you execute the sql statements...
I ended up debugging thru SQL Server Management Studio

Custom Lucene Index not visible in Sitecore's Indexing Manager

I have been given the task of implementing content search in a Sitecore (ver. 7.2) based website. For the same, I am planning to use the Lucene search provider as it comes bundled with Sitecore out of the box and also since our search requirements don't seem too exhaustive for me to attempt using Solr.
We want users to be able to search a bucketable list of content residing in Sitecore from the main site.
The documentation and blogs explaining how to do this are sketchy and incomplete.
I used the below blog as a reference point:
http://www.mattburkedev.com/sitecore-7-contentsearch-tips/
After adding the index configuration file in App_Config/Include folder, I expected to see the new index in Sitecore's Indexing Manager. However i do not notice the same there. Any ideas on what I'm doing wrong?
I wanted to create a custom index so that I can target only particular sitecore nodes. Please see my configuration file. I only need to search for data within the articles node using the fields set in the articles item template.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<configuration type="Sitecore.ContentSearch.LuceneProvider.LuceneSearchConfiguration, Sitecore.ContentSearch.LuceneProvider">
<indexes hint="list:AddIndex">
<index id="book_index" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider">
<param desc="name">$(id)</param>
<param desc="folder">$(id)</param>
<!-- This initializes index property store. Id has to be set to the index id -->
<param desc="propertyStore" ref="contentSearch/databasePropertyStore" param1="$(id)" />
<strategies hint="list:AddStrategy">
<!-- NOTE: order of these is controls the execution order -->
<strategy ref="contentSearch/indexUpdateStrategies/syncMaster" />
</strategies>
<commitPolicyExecutor type="Sitecore.ContentSearch.CommitPolicyExecutor, Sitecore.ContentSearch">
<policies hint="list:AddCommitPolicy">
<policy type="Sitecore.ContentSearch.TimeIntervalCommitPolicy, Sitecore.ContentSearch" />
</policies>
</commitPolicyExecutor>
<locations hint="list:AddCrawler">
<crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
<Database>master</Database>
<Root>/sitecore/content/support/articles</Root>
</crawler>
</locations>
</index>
</indexes>
</configuration>
</contentSearch>
</sitecore>
</configuration>
I was finally able to see my index in the Indexing Manager. There seemed to be a problem with the name of the config file. I named my index file "Sitecore.ContentSearch.Lucene.Downloads.config" and after that, the index appeared. The file was being patched in before the standard Lucene config and hence the issue.
Just rename your config file to z.Sitecore.ContentSearch.Lucene.Downloads.config
This is because when sitecore will merge all your configs in one file, the filename is taken into consideration.
Thanks
Some of your namespaces are off in your config. Please try this config and see if it shows up for you. I have modified it to match your parameters. This should work for you.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
<indexes hint="list:AddIndex">
<index id="book_index" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider">
<param desc="name">$(id)</param>
<param desc="folder">$(id)</param>
<!-- This initializes index property store. Id has to be set to the index id -->
<param desc="propertyStore" ref="contentSearch/databasePropertyStore" param1="$(id)" />
<configuration ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration" />
<strategies hint="list:AddStrategy">
<!-- NOTE: order of these is controls the execution order -->
<strategy ref="contentSearch/indexUpdateStrategies/syncMaster" />
</strategies>
<commitPolicyExecutor type="Sitecore.ContentSearch.CommitPolicyExecutor, Sitecore.ContentSearch">
<policies hint="list:AddCommitPolicy">
<policy type="Sitecore.ContentSearch.TimeIntervalCommitPolicy, Sitecore.ContentSearch" />
</policies>
</commitPolicyExecutor>
<locations hint="list:AddCrawler">
<crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
<Database>master</Database>
<Root>/sitecore/content/support/articles</Root>
</crawler>
</locations>
</index>
</indexes>
</configuration>
</contentSearch>
</sitecore>
</configuration>

How to setup MSBuild to name Project.dll instead od Project.vcxproj.dll in TeamCity?

I've got a problem while using TeamCity automation build engine.
I need to build many vcxprojects, some of them are LIB or DLL and rest are EXE files, using previously built LIBs.
Example of setting one LIB project in TeamCity is:
<runner id="RUNNER_15" name="MP3" type="MSBuild">
<parameters>
<param name="build-file-path" value="Audio\mp3\mp3.vcxproj" />
<param name="dotNetCoverage.NCover.HTMLReport.File.Sort" value="0" />
<param name="dotNetCoverage.NCover.HTMLReport.File.Type" value="1" />
<param name="dotNetCoverage.NCover.Reg" value="selected" />
<param name="dotNetCoverage.NCover.platformBitness" value="x86" />
<param name="dotNetCoverage.NCover.platformVersion" value="v2.0" />
<param name="dotNetCoverage.NCover3.Reg" value="selected" />
<param name="dotNetCoverage.NCover3.args" value="//ias .*" />
<param name="dotNetCoverage.NCover3.platformBitness" value="x86" />
<param name="dotNetCoverage.NCover3.platformVersion" value="v2.0" />
<param name="dotNetCoverage.NCover3.reporter.executable.args" value="//or FullCoverageReport:Html:{teamcity.report.path}" />
<param name="dotNetCoverage.PartCover.Reg" value="selected" />
<param name="dotNetCoverage.PartCover.includes" value="[*]*" />
<param name="dotNetCoverage.PartCover.platformBitness" value="x86" />
<param name="dotNetCoverage.PartCover.platformVersion" value="v2.0" />
<param name="msbuild_version" value="4.0" />
<param name="run-platform" value="x86" />
<param name="toolsVersion" value="4.0" />
</parameters>
</runner>
In case of DLL, linker setting in vcxproj file says:
.\Release\$(ProjectName).dll
In case of LIB there isn't such setting at all.
When I build it using VS2010 command line, output is .\Release\mp3.dll or .\Release\mp3.lib.
But when I use TC, I'll get output .\Release\mp3.vcxproj.dll or .\Release\mp3.vcxproj.lib
Why? How to avoid this strange behavior?
(I don't want to replace line in vcxproj file like .\Release\mp3.dll, it's problem with many projects and I'd like to avoid this primitive solution and in case of LIB projects there is not such possibility at all)
Thx for any response.
I had the same problem with .vcxproj appearing in the filename of my binaries. I narrowed it down to the $(ProjectName) variable being different when built with TeamCity than when I built it on my own machine.
The solution for me was to define the ProjectName variable in each of the affected project files (strangely it didn't seem to happen in certain types of projects, e.g. static libraries).
<!-- Define project name to avoid TeamCity from generating incorrect one -->
<PropertyGroup>
<ProjectName>NAME_OF_PROJECT</ProjectName>
</PropertyGroup>
I put this below the <PropertyGroup Label="UserMacros" /> line and above the <TargetName> definitions which reference it.
I still don't understand why TeamCity is different... I hope this helps others with the same problem.
Here is a workaround for this issue that does not require changing anything in project files. Before any project build will be invoked, a script is executed that would rename all .vcxproj files of interest into files of the same name but without .vcxproj extension. It is a 'Command Line' runner and the script is
for /r directory\with_projects %%%%f in (*.vcxproj) do rename %%%%f %%%%~nf
Then 'Visual Studio' runner has the renamed project files as arguments. Internally the runner makes a copy with .teamcity extension, which in turn is trimmed by Visual Studio giving the correct $(ProjectName) value.