So I've been developing a GraphAware Runtime module to extend Neo4J functionality.
According to GraphAware, in order to enable logging I need to add a slf4j provided dependency to my module and add an entry to custom-logback.xml file.
That unfortunately doesn't seem to work. Specifying custom log levels doesn't seem to affect what is being printed in the console, and adding a new appender (file) doesn't seem to take any effect, i.e. no files are created.
Did anyone have a go at adding logs to graphaware runtime modules?
Also, how would one debug such a module, if you have to deploy it to neo4j, and it's being run by the neo4j itself?
UPDATE 1:
So I'm using Neo4J 2.3.2 and the custom-logback.xml file didn't exist orignally in the package, and I had to create it.
I just checked and downloaded 2.2.8 version, and that file seems to exist in that package. Did anything change in the 2.3 version of Neo4J in terms of logging?
Turns out adding a logback.xml file to your conf directory with contents along these lines seems to work perfectly. I'll update the docs, please let me know if that worked. Cheers!
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSSZ} %-5level %msg%n</pattern>
</encoder>
</appender>
<logger name="com.graphaware" level="INFO"/>
<root level="DEBUG">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
Related
I'm creating my first project Java EE 7, but I'm having trouble. Appreciate any help.
Tomcat 7.0.34
JSF 2.2
Primefaces 3.5
javaee-api-7.0.jar
When the application start, the Tomcat log shows the following message:
"validateJarFile (C:\...\build\web\WEB-INF\lib\javaee-api-7.0.jar)-jar not loaded. See Servlet 2.3 Spec, section 9.7.2. Offending class: javax/servlet/Servlet .class"
when I click on the button that calls the managed bean, I get the error:
AdvertĂȘncia: /index.xhtml #18,66 value="#{indexMB.user}": Target Unreachable, identifier 'indexMB' resolved to null
javax.el.PropertyNotFoundException: /index.xhtml #18,66 value="#{indexMB.user}": Target Unreachable, identifier 'indexMB' resolved to null
IndexMB
#Named("indexMB")
#RequestScoped
public class IndexMB {
private String password;
private String user;
public String loginTest(){
return (this.user.equals("admin") ? "adminPage" : "inOutPage");
}
// getters and setters
}
index.xhtml
<html ...>
<f:loadBundle basename="i18n" var="bundle" />
<h:head>
<title>#{bundle['index_title']}</title>
</h:head>
<h:body>
#{bundle['index_appname']}
<br />
<h:form id="frmIndex">
<p:panelGrid columns="2">
<p:outputLabel for="user" value="#{bundle['lblUser']}" />
<p:inputText id="user" value="#{indexMB.user}" />
<p:outputLabel for="password" value="#{bundle['lblPassword']}" />
<p:password id="password" value="#{indexMB.password}" />
</p:panelGrid>
<p:commandButton action="#{indexMB.loginTest}" value="#{bundle['btn_login']}" />
</h:form>
</h:body>
faces-config.xml
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<application>
<locale-config>
<default-locale>pt_BR</default-locale>
<supported-locale>en</supported-locale>
<supported-locale>fr</supported-locale>
</locale-config>
</application>
These topics have not helped me:
Java EE 6 #javax.annotation.ManagedBean vs. #javax.inject.Named vs. #javax.faces.ManagedBean
Target Unreachable identifier resolved to null
Target Unreachable, identifier resolved to null
javax.el.PropertyNotFoundException : Target Unreachable, identifier 'login' resolved to null Spring + JSF
http://www.andrejkoelewijn.com/blog/2010/03/05/jee-cdi-tip-target-unreachable-identifier-resolved-to-null/
Tomcat as being a barebones JSP/Servlet container doesn't support CDI out the box. It is not correct to drop jakartaee-api.jar or javaee-api.jar in /WEB-INF/lib just to get your code to compile. The JEE API JAR contains solely the API classes, not the concrete implementation. Get rid of the whole JAR. It can cause many other portability troubles like as the ones described in this answer: How do I import the javax.servlet / jakarta.servlet API in my Eclipse project? You should actually be installing the concrete implementation along with the specific API.
You have 2 options:
Drop Tomcat and go for a true Jakarta EE container. As you're using Tomcat, just step over to TomEE. It's really simple, download the TomEE web profile zip file, extract it and integrate it in Eclipse exactly the same way as you did for Tomcat. Don't forget to remove the Jakarta EE JAR file from webapp and alter the Targeted Runtime property in project's properties from Tomcat to TomEE so that Jakarta EE dependencies are properly resolved. See also What exactly is Java EE?
No additional JARs or configuration is necessary. You can even remove the manually installed JSF/JSTL/CDI/BV/JPA/EJB/JTA/JSONPJAX-RS/etc/etc libraries from your webapp. TomEE as being a true Jakarta EE container already provides them all out the box. In case you're using Maven, the below coordinate is sufficient.
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-web-api</artifactId>
<version><!-- e.g. 10.0.0 or 9.1.0 --></version>
<scope>provided</scope>
</dependency>
Note the importance of provided and its meaning as in "the target runtime already provides this out the box". See also How to properly configure Jakarta EE libraries in Maven pom.xml for Tomcat? for detailed pom.xml examples of Tomcat and normal JEE containers.
If you want to stick to Tomcat, then you need to manually install a true CDI implementation via the webapp. Below instructions assume Tomcat 10+. Weld is one of the available CDI implementations. In the Weld installation guide you can find instructions how to integrate it in Tomcat. For sake of completeness and future reference, here are the steps:
For Tomcat 10.1.x, drop the weld-servlet-shaded.jar of version 5.x in webapp's /WEB-INF/lib. In case you're using Maven, use this coordinate:
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet-shaded</artifactId>
<version>5.1.0.Final</version>
</dependency>
For Tomcat 10.x, use weld-servlet-shaded.jar of version 4.x instead:
<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet-shaded</artifactId>
<version>4.0.3.Final</version>
</dependency>
Optionally, create a /META-INF/context.xml file in webapp with following content:
<Context>
<Resource name="BeanManager"
auth="Container"
type="jakarta.enterprise.inject.spi.BeanManager"
factory="org.jboss.weld.resources.ManagerObjectFactory"/>
</Context>
This step is is only necessary when the CDI-dependent library tries to manually find it in JNDI. This step is not necessary when you're using for example Jakarta Faces / JSF version 2.3 or newer.
Create a /WEB-INF/beans.xml file in webapp to trigger activation of CDI. It can be kept empty.
That's it.
In case you prefer OpenWebBeans above Weld as CDI implementation, or need to install CDI in Tomcat 9.x or older, head to this blog for detailed Maven installation instructions: How to install CDI in Tomcat?
Other possible option is leaving beans.xml in your deployment.
I am trying to create a web application using MS Access as database. For it, I am using ucanaccess driver and my server is Wildfly 8.0
The issue is to how correctly configure this driver on the server ?
After researching on internet I got to know below steps
create a folder structre and place all the ucanaccess jar files-
wildfly-8.0.0.Final\modules\system\layers\base\com\ucanaccess\jdbc\main
Edit module.xml file-
<module xmlns="urn:jboss:module:1.1" name="com.ucanaccess.jdbc">
<resources>
<resource-root path="ucanaccess-2.0.9.4.jar"/>
<resource-root path="commons-lang-2.6.jar"/>
<resource-root path="commons-logging-1.1.1.jar"/>
<resource-root path="hsqldb.jar"/>
<resource-root path="jackcess-2.0.8.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
Edit standalone-full.xml file
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jndi-name="java:jboss/MyDS" pool-name="MyDS" enabled="true" use-java-context="true">
<connection-url>jdbc:ucanaccess://C://Users//sahashu//Documents//NGCORE.accdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>ucanaccess-2.0.9.4.jar</driver>
<security>
<user-name></user-name>
<password></password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="ucanaccess" module="com.ucanaccess.jdbc">
<xa-datasource-class>org.ucanaccess.jdbc.MsAccessDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
However, still I get this error-
23:29:34,422 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 28) JBAS014613: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "ucanaccess")
]) - failure description: "JBAS010441: Failed to load module for driver [com.ucanaccess.jdbc]"
Please help me to identify the issue
Thanks
There is an easier way: Just create your own JAR using the UcanAccess JAR files.
In Eclipse:
Create a plain Java Project (for Java 8)
Create a dummy class with a dummy main method, and execute it (for example a simple Hello World program)
Right-click on the project -> Build Path -> Configure Build Path
Go to the Libraries tab and use "Add External JARs" to add all 5 JARs that you find in your UcanAccess download
Right-click on the project -> Export -> Java / Runnable JAR file, choose your dummy class as Launch configuration, and keep Library handling as "Extract required libraries..."
Now go to your WildFly administration console, and click on "Deployments". There you can add your freshly baked JAR and enable it. WildFly will recognize this driver automatically from now on, when you need to add a Microsoft Access Datasource using the Wizard in the administration console.
I am having issues with getting Maven to build out my iOS app. My plug in is set up like so:
<plugin>
<groupId>com.sap.prd.mobile.ios.mios</groupId>
<artifactId>xcode-maven-plugin</artifactId>
<version>1.14.0</version>
<extensions>true</extensions>
<configuration>
<settings>
<ARCHS>armv7 armv7s</ARCHS>
<ONLY_ACTIVE_ARCH>NO</ONLY_ACTIVE_ARCH>
</settings>
<sdks>
<sdk>iphonesimulator</sdk>
</sdks>
<configurations>
<configuration>Debug</configuration>
</configurations>
</configuration>
</plugin>
However, I'm getting the error:
The build has not been performed for default configuration 'Release' and default sdk 'iphoneos'
even though I'm trying to exclude Release by adding only the Debug configuration. What am I doing wrong here? I'd like to also build release, but I am trying to exclude it for now since it is giving me issues.
I've been stuck on this for about a month, sadly. So, any insight would be greatly appreciated.
Turns out there was a bug with version 1.14.0. Please update to version 1.14.1 of this xcode-maven-plugin to fix this issue.
I want to create nuget packages (and deploy them to my private nuget repository) after my assemblies are compiled.
I tried setting everything up by using NuGetter, but that project is kind of inactive and only allows you to build one package/project while I need one package/assembly.
Now I'm kind of stuck. I'm currently looking at their source, hoping to make it more useable for me.
What I'm asking here, in parallel, is: Does anyone have a finished solution for publishing/creating nuget packages from TFS 2012 and/or TFS2010 for multi-package solutions?
I tried setting everything up by using NuGetter, but that project is kind of inactive and only allows you to build one package/project while I need one package/assembly.
NuGetter does support multiple packages, i only use the multiple package method now as you can use it for single or multiple packages.
by using a packages xml file you can specify the multiple packages
<?xml version="1.0"?>
<NuGetterPackages>
<NuGetterPackage name="Package1">
<NuSpecFilePath>Package1.nuspec</NuSpecFilePath>
<BasePath>NuGetPrePackage_Package1</BasePath>
<InvokePowerShell>True</InvokePowerShell>
<PowerShellScriptPath>PrePackage_Package1.ps1</PowerShellScriptPath>
<InvokePush>True</InvokePush>
<OutputDirectory>NuGetPackage</OutputDirectory>
<PushDestination>\\MYFeedLoc\NugetFeed</PushDestination>
<Version>1.0.J.B</Version>
</NuGetterPackage>
<NuGetterPackage name="Package2">
<NuSpecFilePath>Package2.nuspec</NuSpecFilePath>
<BasePath>NuGetPrePackage_Package2</BasePath>
<InvokePowerShell>True</InvokePowerShell>
<PowerShellScriptPath>PrePackage_Package2.ps1</PowerShellScriptPath>
<InvokePush>True</InvokePush>
<OutputDirectory>NuGetPackage</OutputDirectory>
<PushDestination>\\MYFeedLoc\NugetFeed</PushDestination>
<Version>1.0.J.B</Version>
</NuGetterPackage>
</NuGetterPackages>
under source control i have the packages.xml file, and then per Nuget Package a powershell file and a nuspec file.
Nuspec File looks like this
<?xml version="1.0"?>
<package >
<metadata>
<id>Package1</id>
<version>$version$</version>
<title>Package1</title>
<authors>Package1 Author</authors>
<owners>Package1 Owner</owners>
<iconUrl>http://Iconserver/nextlogo.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Description of Contents</description>
<releaseNotes>First release of the package.</releaseNotes>
<copyright>Copyright 2014</copyright>
<tags>Space Seperated Tags</tags>
<dependencies>
<dependency id="AnyLatestDependencyIMayHAve" version=""/>
<dependency id="AFixedDependencyIMayHAve" version="[1.0.0]"/>
</dependencies>
</metadata>
</package>
And then a Powershell file that just creates the folder structure within the BasePathDeclaration in the Packages.xml, this is the same file as shown on the NuGetter site
I have added a full explanation at my blog
I have been having trouble deploying liferay portlets and themes from the command line with ant deploy;
sample execution:
pwd: C:\liferay-plugins-sdk\themes
create.bat deep-blue "Deep Blue"
cd deep-blue-theme
ant deploy
-> Buildfile: C:\liferay-plugins-sdk\themes\deep-blue-theme\build.xml
-> compile:
-> BUILD FAILED
-> C:\liferay-plugins-stk\themes\build-common-theme.xml:172: C:\liferay-plugins-sdk\themes\deep-blue-theme\liferay-portal-6.0.6 omcat-6.0.29webappsROOT\html\themes_unstyled does not exist.
the problem appears to be with the bold section and how the path is obviously incorrect; where is this directory being set?
edit:
the problem was my app.server.dir in build.{username}.properties
The error is a result of the ant build not being able to find a Liferay installation (which contains items needed by the SDK).
By default, the build properties in the SDK are set up on the assumption that your setup looks like this:
- Your Development Directory
- bundles
- data
- deploy
- license
- tomcat-6.0.29
- liferay-plugins-sdk
Where bundles contains a Liferay bundle distribution, including the bundled Tomcat server.
You can see this setup in the build.properties file at the root level of your SDK.
#
# Specify the paths to an unzipped Tomcat bundle.
#
app.server.type=tomcat
app.server.dir=${project.dir}/../bundles/tomcat-6.0.29
app.server.deploy.dir=${app.server.dir}/webapps
app.server.lib.global.dir=${app.server.dir}/lib/ext
app.server.portal.dir=${app.server.dir}/webapps/ROOT
The recommended way to change this is not to edit this section of build.properties, but to create overriding entries in a new file, called build.username.properties. (where username is your user name on your computer account).
As you say in the comment to kirkz's answer, you have already set your build.connor.properties: You obviously have used backslash in there. Here \t is short for the tab character. This explains what you see: ...liferay-portal-6.0.6 omcat... (there's a tab between 6.0.6 and omcat)
Do only use forward-slash in properties files (when you refer to file names, no matter if you're on windows or on any other platforms)
I think to solve this issue just for now. To check weather you are getting unsuccessful build or not you can try this solution:
I have just used the static liferay path in this solution.
<elseif>
<equals arg1="${theme.parent}" arg2="classic" />
<then>
<copy todir="docroot" overwrite="true">
<fileset
dir="C:/Liferay/liferay-portal-6.2-ce-ga2/tomcat-7.0.42/webapps/ROOT/html/themes/classic"
excludes="_diffs/**,templates/**"
/>
</copy>
<copy todir="docroot/templates" overwrite="true">
<fileset
dir="C:/Liferay/liferay-portal-6.2-ce-ga2/tomcat-7.0.42/webapps/ROOT/html/themes/classic/templates"
includes="*.${theme.type}"
/>
</copy>
</then>
</elseif>
After setting up this code in your build-common-theme.xml file you will NOT get omcat-6.0.29webappsROOT\html\themes_unstyled error at least.