ColdFusion 9 Solr: Can't create/update/refresh collections - coldfusion

I've been having some issues with my Solr collections, and out of frustration I decided to delete all the folders and start from scratch. I did not remove them via CFAdmin, first.
After some searching, I read where someone suggested copying the contents of the /solr/core0 folder into the collections folders under /ColdFusion9/collections. This will at least make them appear in CFAdmin. However, when trying to index the collection(s), I get the following error:
ERROR unknown_field_author ERROR unknown_field_author request:
http:localhost:8983/solr/dtrparti/update?commit=true&waitFlush=false&waitSearcher=false&wt=javabin&version=1
Is this recoverable without having to re-install ColdFusion 9 from scratch?
Thank you,
^_^

YES! IT IS! According to http://www.elliottsprehn.com/cfbugs/bugs/83331, if you add the following to all affected collection/conf/schema.xml:
<field name="author" type="text_ws" indexed="true" stored="true" required="true" />
.. it will now index.
^_^

Related

Apache CXF wsdl2java InternalError: unresolved reference

I'm trying to generate Java sources for a Web Service with Apache CXF wsdl2java executable (I've tried 2.7.8 and 3.2.0 versions).
My wsdl file come from an external agency (TMDD), so I assume is well generated
When I tried to generate files first time, a "Non-unique body parts" error occur:
org.apache.cxf.tools.common.ToolException: Non-unique body parts! In a port, operations must have unique operation signatures on the wire for successful dispatching. In port {http://www.tmdd.org/303/dialogs}tmddOCSoapHttpServicePort, operations "{http://www.tmdd.org/303/dialogs}dlVideoSwitchStatusRequest" and "{http://www.tmdd.org/303/dialogs}dlIntersectionSignalStatusRequest" have the same request body block {http://www.tmdd.org/303/messages}deviceInformationRequestMsg
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.validate(WSDLToJavaContainer.java:735)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:276)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:164)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:412)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:105)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:185)
I solved it creating a new input message type in dlVideoSwitchStatusRequest operation to avoid this. My steps were:
Create a new message type
<message name="MSG_VideoSwitchStatusRequest">
<part name="message" element="tmdd:videoSwitchStatusRequestMsg"/>
</message>
Declare videoSwitchStatusRequestMsg
<xs:element name="videoSwitchStatusRequestMsg" type="VideoSwitchStatusRequest">
<xs:annotation>
<xs:documentation>
<objectClass>VideoSwitch</objectClass>
<requirement>REQ1109</requirement>
</xs:documentation>
</xs:annotation>
</xs:element>
This one is defined in .xsd file as similar ones for other operations.
Modify input type for that operation
<operation name="dlVideoSwitchStatusRequest">
<documentation><objectClass>VideoSwitch</objectClass><objectClass>ExternalCenter</objectClass><objectClass>OwnerCenter</objectClass><msgPattern>R-R</msgPattern><requirement>REQ538</requirement></documentation>
<input message="tns:MSG_VideoSwitchStatusRequest"/> <!-- This is the new type -->
<!--<input message="tns:MSG_DeviceInformationRequest"/> This is the old one -->
<output message="tns:MSG_VideoSwitchStatus"/>
<fault name="errorReport" message="tns:MSG_ErrorReport"/>
</operation>
With this, that error was solved (i think), but now i get another error
Exception in thread "main" java.lang.InternalError: unresolved reference
at com.sun.xml.xsom.impl.parser.DelayedRef._get(DelayedRef.java:103)
at com.sun.xml.xsom.impl.parser.DelayedRef$Type.getType(DelayedRef.java:148)
at com.sun.xml.xsom.impl.ElementDecl.getType(ElementDecl.java:110)
at com.sun.xml.xsom.impl.ElementDecl.updateSubstitutabilityMap(ElementDecl.java:174)
at com.sun.xml.xsom.impl.parser.ParserContext.getResult(ParserContext.java:141)
at com.sun.xml.xsom.parser.XSOMParser.getResult(XSOMParser.java:214)
at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:538)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:269)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:95)
at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:459)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:723)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:267)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:164)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:412)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:105)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:185)
This one is too generic and I didn't found any info or doc from Apache site.
First, you must no assume the TMDD wsdl is well generated. I worked with it some time ago and is plenty of errors.
I recommend you to re-create your own version of TMDD.wsdl file, limiting it only to those items you're going to use.
Try that and tell us what you got.
Well, as B. Leal suggest, i drop old tmdd.wsdl and re-do my wsdl files with separate files for each device i will need data for.
As most work has been re-done, i'm not 100% sure about where that error came from, but i'm pretty sure that it was related with some types used in the old wsdl that wasn't declared properly in xsd files.
I know this is not a big help, but if someone falls in this same error, i think you only have two choices:
Re-do your wsdl files, as i did. (I recommend this one, it's easier than it seems)
Check if every single type used in wsdl are present in xsd files and if they're correct.
Thanks for help.
I had the same problem and mine was in XSD. Forgot to add namespace before type. tns and targetNamespace are the same url.
Before:
<xs:element name="getRequest" type="Request">
After
<xs:element name="getRequest" type="tns:Request">
This simple change in all elements using complexType/simpleType fixed the problem.

How to remove comments when server returns a JSP page?

Which class of tomcat is responsible for converting .jsp file to .class file? I want to see the source code written for the conversion. My aim is to check the logic how scriptlet comments are eliminated and based on that I'll write my own code that will remove HTML comments as well (I've not decided how will I implement it).
I am sure source code should be available as it's open source.
Or is it possible to implement some kind of filter so the each time server returns a JSP page it removes the comments. I can replace all HTML comments into Scriptlet comments. But I want to ensure, if someone use html comments in future, it is not displayed. It's basically for security.
[Added]
As per the suggestion given by JB Nizet, we will be modifying build.xml file to remove comments. I have come up with this to remove HTML comments -
<target name="-trim.html.comments">
<echo message="Inside trim html comments" />
<fileset id="html.fileset" dir="${build.dir}" includes="**/*.jsp, **/*.html" />
<!-- HTML Comments -->
<replaceregexp replace="" flags="g" match="\<![ \r\n\t]*(--([^\-]|[\r\n]|-[^\-])*--[ \r\n\t]*)\>">
<fileset refid="html.fileset"/>
</replaceregexp>
</target>
However, I am not sure how to remove comments that starts with // or /* */. Any suggestion how can I do so? I have searched over internet but didn't get a clue.
We are using ant script for build.
[Added]
To remove single line comment that starts with // I am using below regex. But somehow it's not working. Can anyone please help me what I'm doing wrong? Thanks in advance.
<replaceregexp flags="gs" match="?:^\s*\/\/(?:.*)$" replace="">
Rather than doing it in Tomcat, use Apache directly. It supports modules which do exactly what you need. mod pagespeed is probably closest to what you want; mod deflate may be configurable to do the same thing, though it also compresses the data, which might be overkill.
As a nice side-effect, this allows you to leave your handy comments in and they'll be served to your internal users (developers) who use port 8080, while those using port 80 will see only the minified product.

Can't build index for solr/haystack: unknown field 'django_id'

I'm trying to follow along the haystack tutorial. I run into an error when I run manage.py rebuild index
I get the following error:
WARNING: This will irreparably remove EVERYTHING from your search index.
Your choices after this are to restore from backups or rebuild via the `rebuild_index` command.
Are you sure you wish to continue? [y/N] y
Removing all documents from your index because you said so.
All documents removed.
/Users/heri0n/python_env/lib/python2.7/site-packages/django/db/models/fields/__init__.py:808: RuntimeWarning: DateTimeField received a naive datetime (2013-04-07 16:14:15.481145) while time zone support is active.
RuntimeWarning)
Indexing 1 notes.
Failed to add documents to Solr: [Reason: None]
<response><lst name="responseHeader"><int name="status">400</int><int name="QTime">6</int></lst><lst name="error"><str name="msg">ERROR: [doc=haystacktester.note.3] unknown field 'django_id'</str><int name="code">400</int></lst></response>
I did run manage.py build_solr_schema > ~/solr-4.2.1/example/solr/conf/schema.xml
I had to create the conf directory manually as it did not exist. I noticed the tutorial uses Solr 3 while I'm on 4. Did the location of the conf dir change perhaps?
The problem is with the Solr (haystack document use v3.5.0, here you may be using the latest) not finding the configuration file. These 3 steps worked for me
Place the schema in solr-x.y.z/example/solr/collection1/conf/schema.xml
In the schema change stopwords_en.txt to lang/stopwords_en.txt
Add the version field (as mentioned below) to the schema in the fields section
<field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
For more information check out the same discussion in GitHub
This is more of a comment, but due to my lack of points I am unable to comment...
Has anyone figure out a soltuion to this? I'm having the exact same problem. The field is being created in schema.xml as such:
<field name="django_id" type="string" indexed="true" stored="true" multiValued="false"/>
I have restarted Solr (multiple times), and I am 100% positive my schema.xml code is correct. What the heck is going on here?
EDIT: I switched to Elasticsearch and have no problems. However, I'm sure others out there would find help to this question useful.
I had to clone the haystack source code and do some hacks as follows :
In the /haystack/management/commands/build_solr_schema.py , I commented DJANGO_ID in the build_context() func.
Then in /haystack/templates/search_configuration/solr.xml , I replaced {{ DJANGO_ID }} with "django_id" and everything worked ok.
I think the {{DJANGO_ID}} is not being replaced with "django_id" when you generate schema.xml.

cfform cannot be initialized

I'm checking the tag cfform in coldfusion, the codes are very simple:
<cfform name="testFrm" format="Flash">
<cfinput type="text" name="abc" value ="">
</cfform>
But when running it says:
"NetworkError: 404 Not Found - .../1405338045.mxml.cfswf"
The form cannot be shown.
Anybody here got this error? Could you help me about this, I have no any clues on this?
Thanks.
I suspect you do not have a /CFIDE virtual directory mapping, which one needs if one is to use things like <cfform>.
Short of having that mapping, one can use <cfajaximport> to specify an alternative location for the resource files that <cfform> requires to work.
If you're using CF11, open the web.xml file in
{CF11}\cfusion\wwwroot\WEB-INF\web.xml and uncomment any configs that have to do with SWF or CFForm. Restart CF and try again.
Had a client with lots of legacy code that needed flash forms and this fixed the 404's for "mxml.cfswf" files for the client, so I figured I'd post here for the sake of anyone else searching on this topic.

List of tags not available ColdFusion 9 script syntax?

I'm looking for a complete list of tags that are not available in ColdFusion 9 script syntax.
Example:
CFSetting: is one example that is available in Railo but not in CF9 for use in cfscript
CFDocument: I can't find this one so far.
Not an official list by any measure, but this is a list I presented to a private forum a while back, and it didn't receive too much correction (and those corrections have been integrated). It was in the context of what CF does and doesn't need to be implemented, to claim 100% coverage in CFScript.
Summary of omissions:
These ones are significant omissions:
<cfcollection>
<cfexchangecalendar>
<cfexchangeconnection>
<cfexchangecontact>
<cfexchangefilter>
<cfexchangemail>
<cfexchangetask>
<cfexecute>
<cfindex>
<cfinvoke> (support for dynamic method names)
<cflogin>
<cfloginuser>
<cflogout>
<cfmodule>
<cfoutput> (implementation of query looping with grouping)
<cfparam> (fix the bug in that enforced requiredness doesn’t work (ie: param name="foo";))
<cfsearch>
<cfsetting>
<cfwddx>
<cfzip>
<cfzipparam>
There’s a reasonable case for these ones to be implemented:
<cfassociate>
<cfcache>
<cfcontent>
<cfflush>
<cfhtmlhead>
<cfheader>
<cfntauthenticate>
<cfprint>
<cfschedule>
<cfsharepoint>
These ones... I’m ambivalent:
<cfgridupdate>
<cfinsert>
<cfobjectcache>
<cfregistry>
<cfreport>
<cfreportparam>
<cftimer>
<cfupdate>
We don’t need these ones at all, I think:
<cfajaximport>
<cfajaxproxy>
<cfapplet>
<cfcalendar>
<cfchart>
<cfchartdata>
<cfchartseries>
<cfcol>
<cfdiv>
<cfdocument>
<cfdocumentitem>
<cfdocumentsection>
<cffileupload>
<cfform>
<cfformgroup>
<cfformitem>
<cfgraph>
<cfgraphdata>
<cfgrid>
<cfgridcolumn>
<cfgridrow>
<cfinput>
<cflayout>
<cflayoutarea>
<cfmap>
<cfmapitem>
<cfmediaplayer>
<cfmenu>
<cfmenuitem>
<cfpod>
<cfpresentation>
<cfpresentationslide>
<cfpresenter>
<cfselect>
<cfsilent>
<cfslider>
<cfsprydataset>
<cftable>
<cftextarea>
<cftextinput>
<cftooltip>
<cftree>
<cftreeitem>
<cfwindow>
If there's anything here that you think ought to be included in CFScript, please raise an issue here - http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html - and cross reference the issue number here.
HTH.
I would argue that there are no commands that are not available as script as you can extend and write the missing bits using cfc's.
Thus wrap your favourite missing <cftag in a cfc and call it using new
However, here is a list of what is supported
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSe9cbe5cf462523a02805926a1237efcbfd5-7ffe.html