'context:annotation-config' does not work in spring - java

I am getting error for context:annotation-config/, Namespace & schema location seems fine, if i remove context:annotation-config tag, i don't red line under context.xsd
On hovering tag, it says cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:annotation-config'.
UPDATE: I tried running the Application, It works fine, though I see red lines in xml file but App runs fine.

Related

Resolve unreadable content message in Word with Docx4J v. 3.3.3

We are processing a Word template that was created with Word 365 (Version 2202 Build 16.0.14931.20648) in Docx4J. Once the file was modified by our Java application, Word will show an error message when we open the document. The message will state that the file contains unreadable content and that Word needs to repair it. This works fine and the document will eventually open, however, the message is annoying.
I assume that the error message is related to a namespace issue (see this question). That issue was resolved with docx4j v. 8.2.9, which defines the missing namespaces properly.
However, I'm stuck with docx4j 3.3.3 and cannot update. The fix seems rather simple in the GitHub commit, so I wonder, if there is any way to resolve the issue myself. All I have in my code, is a WordprocessingMLPackage object. Can I add or append namespace definitions to that object or it's sub-properties somehow?
You can't add the namespace definitions to the WordprocessingMLPackage object.
You'll need to get the source code for 3.3.3 from https://github.com/plutext/docx4j/tree/docx4j-3.3.3 then copy the new NamespacePrefixMappings content into it, then build it. You can then deploy this new jar file.
If you wanted to try to avoid compiling the source code, you'd have 2 alternatives to try (since docx4j doesn't implement the stategy pattern there). I don't expect these to work!
One is to replace the relevant classes at runtime. For this, see How to replace classes in a running application in java ?
The other is to replace the relevant classes in your jar file, which is just a zip file.
You'd need to get the new class from docx4j 8.2.9.
Please note that sometimes, there are also changes to ContentTypeManager and ContentTypes; see for example https://github.com/plutext/docx4j/commit/d4d02d3fa6e7bf98f35d1f0520e62eb8aef06cba
That commit introduces new parts, and you'll run into problems if you update ContentTypeManager without those.
So you might be tempted to try to replace NamespacePrefixMappings in your existing jar.
But the interfaces it implements changed at https://github.com/plutext/docx4j/commit/65fb843a26b5893200a1824c04c826db2db7940c#diff-70242e2f5ec56be77fe15322526f4530b02e8eafdcb9ae16b60b2220f62e0632
See further https://github.com/plutext/docx4j/commits/VERSION_8_3_8/docx4j-core/src/main/java/org/docx4j/jaxb/NamespacePrefixMappings.java so that is going to cause you problems.
The upshot is you'll need to get the source code for 3.3.3 from https://github.com/plutext/docx4j/tree/docx4j-3.3.3 then copy the new NamespacePrefixMappings content into it (ie except the interface changes), then build it. If you do this, you may as well just deploy your new jar file.

How to avoid auto forward slash IntelliJ IDEA 2022.2.1 in Windows 10

I am using IntelliJ IDEA 2022.2.1 editor. In one of my test case I am reading the file from resource folder using below method getClass().getResource(filename)
I can get the path, but problem is it's always returning with extra forward slash('/') for an instance /C:/Users/test/IdeaProjects/data.json like this.
Due to that extra slash at 0 index. I am getting java.nio.file.InvalidPathException.
Note: this works fine in mac book, This issue is only with window OS.
Any suggestion would be reuired.

Problem with IntelliJ -> Cannot create class with name "Main"

Title states my problem, i get this error message:
Cannot Create Class Unable to parse template "Class"
Error message:
Selected class file name 'Main.java' mapped to not java file type
'Files supported via TextMate bundles'
Anyone got any ideas on how I can solve this?
Please check the File Types. It looks like Main.java file name or extension was mapped to the wrong file type by accident (Files supported via TextMate bundles). Remove the invalid type mapping to fix the problem. The name/extension should be mapped to Java files instead (the default setting).
See if disabling TextMate bundles plug-in helps.
You do not need "Edit" button at all. Instead you need to use "-" (Minus) button in Registered Patterns area:
Select required file type in top list (Recognized File Types) -- do it for "Text files"
In bottom list (Registered Patterns) select undesired pattern -- "SomeFileName.java"
Click on "-" (Minus) button to remove pattern from the list
Repeat 1-2-3 for other undesired patterns
If desired, you can also do this manually by editing config file while IDE is closed. Because it's IDE-wide setting, it is not stored in .idea folder (which has project settinsg only) -- the file to look for is called filetypes.xml and shoudl be located in ~/Library/Preferences/IntelliJIdeaXX/options ( see http://devnet.jetbrains.net/docs/DOC-181 for other OS etc )

"Cannot resolve symbol "R" - all XML android:ids are correct

I edited a small amount of my xml code
(tried to add an android:src"#drawable/" but it didn't seem to like it so I deleted it after)
and my java code (added Troop1P1.setVisibility(View.VISIBLE); to the end of an OnClickListener,
and again deleted afterwards [I had already used findViewByID for Troop1P1]).
However, my whole code has now stopped working, with every "R" in (R.id.) being highlighted, with the text "Cannot resolve symbol "R"" when hovered over.
In addition, when I run the code I get the following error:
error: Error: No resource found that matches the given name (at 'layout_above' with value '#id/btnTroop1P2').
However, I've checked and I'm fairly sure I've correctly id'd btnTroop1P2 using android:id="#+id/btnTroop1P2", so I can't find any problems there.
I'd really appreciate any help, I just want to be able to run my project again!
are you using Eclipse? .if yes go to Project -> Clean... -> Tick your project name -> OK.
Give that a try. I always get similar problems and this solves it for me anyway.
When this occurs, it's usually because you have an error in your layout XML. When an error exists there, the R file is not generated. Therefore, Cannot resolve symbol "R" is the only information Java can give you. Go back into your drawable, layout, or any other XML you've been playing with and make sure you have everything properly formatted.

How to resolve this error: "an unknown item is declared as the root of your mxml document"?

I'm working with eclipse, blazeds and Flex Plugin, and every time I create a Web Dynamic Project then add a Flex Project Nature to it this error: "An unknown item is declared as the root of your mxml document" appears just as the perspective view changes and I click on the design mode. As far as I know the only lines of code written on the screen are the standard in any other program, but I'll put here anyway so you can have a go at it if there's something realyy wrong and I didn't see:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
</mx:Application>
Try this...
copy the code from IDE to some text editor eg. notepad and try to see if there is any junk character there?
If you are using win XP SP 2.0, then update with SP 3.0
Generally the problem occurs when junk characters occur in the lines or the tags are not properly closed.

Categories

Resources