Play Framework: how to resolve failure to download a JSON-LIB dependent library? - json

I am working with Play Framework 1.2.4, and using JSON-LIB to parse some JSON data from Java code.
Initially, I just put the 'json-lib-2.4-jdk15.jar' into the 'lib' folder, and the application worked fine. At some point, I got that this is not the right way to add libraries, and "play dependencies --sync" will even delete the JAR.
This is how my 'dependencies.yml' file looks now:
# Application dependencies
transitiveDependencies: false
require:
- play
- play -> crud
- play -> secure
- play -> cloudbees 0.2.2
- net.sf.flexjson -> flexjson 2.1
- net.sf.json-lib -> json-lib 2.4
Why I had a successful import of dependencies with 'flexjson', it fails with 'json-lib'.
Running "play dependencies -- verbose" gets to the following error:
:: problems summary ::
:::: WARNINGS
[NOT FOUND ] net.sf.json-lib#json-lib;2.4!json-lib.jar (347ms)
==== mavenCentral: tried
http://repo1.maven.org/maven2/net/sf/json-lib/json-lib/2.4/json-lib-2.4.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: FAILED DOWNLOADS ::
:: ^ see resolution messages for details ^ ::
::::::::::::::::::::::::::::::::::::::::::::::
:: net.sf.json-lib#json-lib;2.4!json-lib.jar
::::::::::::::::::::::::::::::::::::::::::::::
Isn't it here?
http://mvnrepository.com/artifact/net.sf.json-lib/json-lib/2.4
In addition, the process brings additional JARs to the 'lib' folder: xerces, xalan etc. - even after I asked to ignore transitive dependencies.
2 questions:
1. What did I do wrong?
2. Is there a good way to "force" Play to recognize certain JAR as a "local" library (so it won't be downloaded from external repository), and yet allow working with other modules and libraries via 'dependencies' mechanism

Related

Cabal ExitFailure 1

I'm getting this error when trying to install csv using Cabal (OS X):
Resolving dependencies...
Configuring csv-0.1.2...
Building csv-0.1.2...
Failed to install csv-0.1.2
Build log ( /Users/roshnal/.cabal/logs/csv-0.1.2.log ):
Configuring csv-0.1.2...
Building csv-0.1.2...
Preprocessing library csv-0.1.2...
[1 of 1] Compiling Text.CSV ( Text/CSV.hs, dist/build/Text/CSV.o )
Text/CSV.hs:70:1:
Bad interface file: /Library/Haskell/ghc-7.10.2-x86_64/lib/parsec-3.1.9/Text/ParserCombinators/Parsec.hi
Something is amiss; requested module parsec-3.1.9#parse_8fSmqig53hOL2SEu1k9Tv0:Text.ParserCombinators.Parsec differs from name found in the interface file AwpZ7A1As1bGsDMsWSTZ1J:Text.ParserCombinators.Parsec
cabal: Error: some packages failed to install:
csv-0.1.2 failed during the building phase. The exception was:
ExitFailure 1
I tried updating Cabal, ghc-pkg recache, and as another answer on SO suggested, setting library-profiling to False (in ~/.cabal/config). None of them are working.
Any idea what I can do to install this package? Earlier I have installed other packages using cabal install successfully.
Thanks!
EDIT
As ErirR suggested in his answer, I ran ghc-pkg list and this is the output I got. I don't appear to be having multiple installs of parsec.
/Library/Frameworks/GHC.framework/Versions/7.10.2-x86_64/usr/lib/ghc-7.10.2/package.conf.d
Cabal-1.22.4.0
GLURaw-1.5.0.1
GLUT-2.7.0.1
HTTP-4000.2.20
HUnit-1.2.5.2
ObjectName-1.1.0.0
OpenGL-2.12.0.1
OpenGLRaw-2.5.1.0
QuickCheck-2.8.1
StateVar-1.1.0.0
array-0.5.1.0
async-2.0.2
attoparsec-0.13.0.1
base-4.8.1.0
bin-package-db-0.0.0.0
binary-0.7.5.0
bytestring-0.10.6.0
case-insensitive-1.2.0.4
cgi-3001.2.2.2
containers-0.5.6.2
deepseq-1.4.1.1
directory-1.2.2.0
exceptions-0.8.0.2
fgl-5.5.2.1
filepath-1.4.0.0
ghc-7.10.2
ghc-prim-0.4.0.0
hashable-1.2.3.3
haskeline-0.7.2.1
haskell-src-1.0.2.0
hoopl-3.10.0.2
hpc-0.6.0.2
hscolour-1.23
html-1.0.1.2
integer-gmp-1.0.0.0
mtl-2.2.1
multipart-0.1.2
network-2.6.2.1
network-uri-2.6.0.3
old-locale-1.0.0.7
old-time-1.1.0.3
parallel-3.2.0.6
parsec-3.1.9 // <-- Here's parsec
pretty-1.1.2.0
primitive-0.6
process-1.2.3.0
random-1.1
regex-base-0.93.2
regex-compat-0.95.1
regex-posix-0.95.2
rts-1.0
scientific-0.3.3.8
split-0.2.2
stm-2.4.4
syb-0.5.1
template-haskell-2.10.0.0
terminfo-0.4.0.1
text-1.2.1.3
tf-random-0.5
time-1.5.0.1
transformers-0.4.2.0
transformers-compat-0.4.0.4
unix-2.7.1.0
unordered-containers-0.2.5.1
vector-0.11.0.0
xhtml-3000.2.1
zlib-0.5.4.2
This SO thread might be relevant:
"requested module differs from name found in the interface file"
I would run ghc-pkg list and see if you have multiple installs of the parsec package.

3rd party Framework Library not loaded: 'Image not found'

I am upgrading a framework to latest version. Earlier integration (>2 years old) had framework directly copied in the project; now getting cocoapod (0.39.0) to get framework integrated with project using xcode (7.2.1) and objective-c project.
Upon run, it generates following error:
dyld: Library not loaded: #rpath/name.framework/name
Referenced from:
/Users/xyz_xyz/Library/Developer/CoreSimulator/Devices/xxxxxxx/data/Containers/Bundle/Application/xxxxxxx/appname.app/appname
Reason: image not found
"Pod" xcode-project has correct reference and framework is present in corresponding folder
Found that nameFramework isn't linked (added) in any of the build phases. I am new to using cocoapods and not sure what changes would be necessary in Xcode build settings to make transition from directly-embedded framework to cocoapods based integration.
how to get past "dyld: Library not loaded" error?
What phase should I use to reference name.Framework during build as it's not getting generated?
How to copy bundle resources from Pod to project? Dragging-n-drop Pods/name/Resources/name.bundle prompts "copy item if needed" dialog. <- I don't think I need to do this when using cocoapods.
[update] Integration using cocoapods works fine when a sample or new project is used. It's something in the current project settings that's causing the issue.
Podfile:
platform :ios, '8.0'
# use_framework for swift based pod integration. requires cocoapod 0.39.0
#use_frameworks!
pod 'GTMOAuth2'
pod 'Typhoon'
pod 'Alamofire'
# Issue with name
pod 'name', podspec:'https://customers.pspdfkit.com/cocoapods/.../latest.podspec'
target :ABC do
pod '...', '~>1'
end
target :XYZ do
pod '...', :path => 'submodules/...'
end
[Update]
- Upgraded to CocoaPods 1.0.1 & modified the Podfile to uncomment use_frameworks!, and make other changes that are required for 0.39.0 to 1.0.1 migration. Here is the updated Podfile.
platform :ios, '8.0'
# use_framework is required for dynamic links (swift) based pod integration.
use_frameworks!
target 'XYZ' do
pod 'GTMOAuth2'
pod 'Alamofire'
pod 'name', podspec:'https://customers.name.com/cocoapods/.../latest.podspec'
target :XYZ-A do
pod 'XYZ-iOS-SDK', :path => 'submodules/xyz-ios-sdk'
end
end
Fixed errors such as following by adding $(inherited) flag (where applicable)
[!] The XYZ-v2 [Release] target overrides the OTHER_LDFLAGS build setting defined in ...
Progress after above changes, Pods/Target Supported Files/XYZ-v2/ has Pods-XYZ-v2-frameworks.sh and resources.sh; earlier frameworks.sh was missing. Following is partial content of the framworks.sh, and it does contain copy instructions.
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "$BUILT_PRODUCTS_DIR/GTMOAuth2/GTMOAuth2.framework"
install_framework "$BUILT_PRODUCTS_DIR/GTMSessionFetcher/GTMSessionFetcher.framework"
install_framework "$BUILT_PRODUCTS_DIR/GoogleAPIClient/GoogleAPIClient.framework"
install_framework "$BUILT_PRODUCTS_DIR/Mantle/Mantle.framework"
install_framework "${PODS_ROOT}/PSPDFKit/PSPDFKit.framework"
install_framework "$BUILT_PRODUCTS_DIR/SSKeychain/SSKeychain.framework"
fi
// and for "Release" & "Distribution" as well..
Now I am trying to resolve compile errors upon build, which are related to static vs dynamic library includes.
/path../Pods/SSKeychain/Sources/SSKeychain.h:65:1: Duplicate interface definition for class ‘SSKeychain'
[Updated] Posted a new question: CocoaPods 1.0.1 Redefinition of 'XYZ', Redefinition of enumerator 'ABC', Duplicate interface definition for 'MNO'
Related:
OS X Framework Library not loaded: 'Image not found'
Seems relevant: https://github.com/CocoaPods/CocoaPods/issues/4772
Try using use_frameworks! (it's currently commented out). PSPDFKit is a dynamic framework, so you need to enable this option.
Also try it with the newest Xcode and CocoaPods >= 1.0.0. Older versions might not work correctly.
You can find more information about PSPDFKit integration via CocoaPods here: https://pspdfkit.com/guides/ios/current/getting-started/using-cocoapods
If all of this doesn't help you can reach the PSPDFKit developers directly at https://pspdfkit.com/support/request
same issue on dyld: Library not loaded: #rpath/TwilioAccessManager.framework/TwilioAccessManager
Reason: image not found
I had the same problem, this fixed it for me.I Changed Framework status required to optional .

Grails 2.5.0 + mongo + hibernate

I am trying to use hibernate with mongo driver and experiencing some issues:
I have created brand new grails app, using grails 2.5.0. changed dataSource.groovy to point to mysql, uncommented mysql-connector-java:5.1.29 and everything works fine.
But when i am adding compile "org.grails.plugins:mongodb:5.0.0.RC1" to plugins section in Build Config i get this on startup:
| Error 2016-02-22 14:32:29,439 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.evaluateMapping
what am i missing?
NB! App does not start, so all internal mappings don't matter at this point.
Here is my config files:
Datasource -> https://cldup.com/GnXUJDOy0b.txt
BuildConfig ->https://cldup.com/xtk5l1F_BW.txt
Error -> https://cldup.com/NJ7vpoX3Kb.txt
It could be useful if you show more code but seems you are not setting the mapping for mongo in the domain class definition :
static mapWith="mongo"
Here you can find an useful tutorial about this
I could not find a way to make mongodb 5.0.1 to work, after days of searching found this answer. This solution worked.
plugins {
compile (":mongodb:3.0.2") {
excludes 'grails-datastore-gorm-plugin-support'
excludes 'grails-datastore-gorm'
excludes 'grails-datastore-core'
}
}
and then in dependencies, pull the correct ones in:
dependencies {
compile 'org.grails:grails-datastore-gorm-plugin-support:3.1.3.RELEASE'
compile 'org.grails:grails-datastore-gorm:3.1.3.RELEASE'
compile 'org.grails:grails-datastore-core:3.1.3.RELEASE'
}
from here Cannot install Grails MongoDB plugin
Hope this will save someone a great deal of time and effort.

How to add javax.swing.SwingUtilities dependency to SBT?

I'm starting to develop a Scala application with Swing using SBT. I figured out that I need two dependencies for a start, so that's scala-swing and javax.swing.SwingUtilities.
I've been searching the web, maven repositories and github, but stil couldn't find, where did the javax.swing package go.
So far I have found javax in Maven Repos, but javax.swing is not listed there for some reason.
I tried to add a javax dependency to my Build.scala:
val javax = "javax" % "javaee-api" % "7.0"
SBT downloaded several packages. Then I launched the terminal:
scala> import javax.swing.SwingUtilities
import javax.swing.SwingUtilities
scala> SwingUtilities.invokeLater()
<console>:9: error: not enough arguments for method invokeLater: (x$1: Runnable)Unit.
Unspecified value parameter x$1.
SwingUtilities.invokeLater()
^
That's scala console being launched from sbt project. So as you can see, import was successful and the console knows about invokeLater() method. But IntelliJ Idea still does not, it marks javax.swing as unresolvable, though it has downloaded the packages.
I'm completely stuck here.
javax.swing is part of any standard Java SE installation (see http://docs.oracle.com/javase/6/docs/api/ - there you have SwingUtilities), so there is no need to add a dependency. You only need the scala-swing dependency:
libraryDependencies += "org.scala-lang" % "scala-swing" % scalaVersion.value
If IntelliJ IDEA doesn't see javax.swing, you have probably not yet defined an "SDK". Go to File -> Project Structure -> Platform Settings -> SDKs. There you should have at least one entry such as "1.6" for Java 1.6 or "1.7" for Java 1.7. If not, press the "+" to add one and locate the appropriate Java home directory for the version you want to use (depends on your OS).

How to setup Robot Framework standalone jar with SwingLibrary?

I'm using Robot Framework with SwingLibrary to test a Java Swing based application. Since I'm not used to Python and also don't want to setup the Python environment, I decided to go with the Robot standalone JAR version (current version 2.8.4).
My problem is the setup in combination with SwingLibrary (version 1.8.0). I don't know where to put the library such that it gets recognized by Robot.
So far, I have the following test case (mytest.txt):
*** Settings ***
Library SwingLibrary
*** Test Cases ***
MyTestCase
Start Application MyApp
I tried with putting the standalone jar in conjunction with the test case in a folder, and created one subfolder (called it Lib) where I put the SwingLibrary JAR (and later also extracted the JAR).
I added the SwingLibrary as well as my own application to the classpath, tried executing robot the following way:
java -Xbootclasspath/a:Lib/swinglibrary-1.8.0.jar:Lib/MyApp.jar -jar robotframework-2.8.4.jar mytest.txt
and also with
java -jar robotframework-2.8.4.jar mytest.txt
I always get one of the following errors:
[ WARN ] Imported library 'SwingLibrary' contains no keywords
==============================================================================
Mytest
==============================================================================
MyTestCase | FAIL |
No keyword with name 'Start Application' found.
or
[ ERROR ] Error in file 'mytest.txt': Importing test library 'SwingLibrary' failed: ImportError: No module named SwingLibrary
You can use the standalone jar without the -jar option, allowing you to specify the classpath in the standard manner. The main class for the standalone jar is org.robotframework.RobotFramework, so the syntax would be
java -cp robotframework-2.8.4.jar:Lib/swinglibrary-1.8.0.jar:Lib/MyApp.jar org.robotframework.RobotFramework
Slightly more verbose but it's standard and so avoids any oddnesses caused by using the non-standard -Xbootclasspath option.