w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
JPA + Hibernate + java.util.logging (JDK logging): show sql queries with arguments
Alternative way is to use JDBC Driver Proxy logging library like log4jdbc log4jdbc uses the Simple Logging Facade for Java (SLF4J) and supports below logging systems:- Log4j java.util logging in JDK 1.4 logback Jakarta Commons Logging It support showing SQL Queries with parameters ..here is an excerpt from their documentation jdbc.sqlonly :- Logs only SQL. SQL executed within a prepared statement is automatically shown with it's bind arguments replaced with the data bound at that position, for greatly increased readability

Categories : SQL

glassfish not logging after deploy
The problem arises after these lines in the log: INFO: HHH000227: Running hbm2ddl schema export INFO: HHH000230: Schema export complete INFO: HHH000030: Cleaning up connection pool [jdbc:hsqldb:mem:richfaces_showcase] so, I guess the problem is caused by richfaces-showcase, when Hibernate is trying to clean up the connection pool. If you're not using the richfaces-showcase anyway (which you're probably not), you could exclude it from your dependencies, so it cannot cause any trouble. By running the dependency:tree goal, you can see, that the richfaces-distribution contains the following: +- org.richfaces.ui:richfaces-components-api:jar:4.3.2.Final:compile +- org.richfaces.ui:richfaces-components-ui:jar:4.3.2.Final:compile +- org.richfaces.core:richfaces-core-api:jar:4.3.2.Final

Categories : Maven

PostgreSQL - proxying queries and logging them
You can try jdbcspy or log4jdbc. They are both JDBC driver proxies. Advantage is that they work with any database.

Categories : SQL

logging hibernate queries with log4j when using servlet filter for open session in view pattern
Ok, so I think I reached a conclusion on this issue. There is not a problem with the combination of these technologies and/or patterns but with the version of Hibernate. I used Hibernate 3 before and the logging went just fine but according to this documentation http://docs.jboss.org/hibernate/orm/4.2/manual/en-US/html/ch03.html#configuration-logging starting with Hibernate 4.0 they gave up on slf4j as the logging facade and they switched to JBoss logging. From this link (https://community.jboss.org/wiki/Logging) it seems that JBoss logging has a variant that uses log4j but unfortunately I haven't managed to configure the whole environment to use JBoss logging instead of slf4j. For my application I reverted to Hibernate 3 and the logging is going just fine. If there is someone that used H

Categories : Hibernate

Java EE 7 GlassFish 4.0 Restful Webservices using and Netbean and deploying on Glassfish 4.0
To Fix First problem, open your glassfish-resource.xml file from your project, it will look something like this. if you don't have glassfish-resource.xml in server-configuration folder you can also check the these details by clicking on services tab in netbeans and furhter clicking on connection pools as shown in this screenshot. Based on the information in it, and using Glassfish 4.0 web interface http://localhost:4848 Firstly Create new JDBC connection pool by navigating Common Tasks -> Resources -> JDBC -> JDBC Connection Pools. It will look something like this. Then Secondly create Connection resource by navigating Common Tasks -> Resources -> JDBC -> JDBC Resources It will look somehting like this. First Problem is sorted. you can test it using Ping button in connect

Categories : Web Services

Maven Glassfish plugin for glassfish 4
If you installed a default GlassFish 4 instance, then there is only the admin user with no password. The password file for that user is in the domain configuration directory named "admin-keyfile". In this situation when you access the GlassFish admin console no authentication is required. In your plugin configuration just provide the user and the password file (delete the adminPassword entry): <user>admin</user> <passwordFile>[...]domainsdomain1configadmin-keyfile</passwordFile> If you decide to change the admin password with the asadmin utility then change the plugin configuration in your pom.xml as follows: <user>admin</user> <adminPassword>YOUR_NEW_PASSWORD</adminPassword> For further details check the Security Guide

Categories : Maven

Logging from thread: Thread exits when logging to INFO and higher, runs normally when logging to DEBUG
How is your logger object configured? It is possible to configure different handlers for different log levels and they could be failing. See https://docs.djangoproject.com/en/1.3/topics/logging/#configuring-logging Also look at this note http://docs.python.org/2.7/library/logging.html?highlight=logging#thread-safety. May be the case. Update: You may also try to use catch-all exception handler to see what's going on inside your thread. Some thing like this: def func(): try: logger.info("Some informational message") time.sleep(15) print "And we are done here" except: print "We are interrupted" pprint.pprint(sys.exc_info()) Update2: As seen in http://hg.python.org/cpython/file/af18829a7754/Lib/concurrent/futures/_base.py#l343. done() meth

Categories : Python

JQuery AJAX call to SOAP Web Service - Access denied. Working in SOAP UI
Possible problems are: You're using absolute urls (with https://serverdomain). Some browsers block absolute urls even if they're not cross-domain request. Try using relative urls instead (without https://serverdomain) if you're not making cross-domain requests. If the above does not work, the other possible problem is you're performing a cross-domain request. If you need to perform cross-domain requests, you need to use some techniques like JSONP, CORS.

Categories : Jquery

SOAP Action issue when calling WCF Service in Perl (SOAP Lite)
I had to do this to make SOAP::Lite work with WCF: my $serviceInterface = 'IMyWcfServiceInterface'; # Setup Network Connection my $service = SOAP::Lite ->ns( $namespace, $namespacePrefix ) ->proxy( $server, credentials => [ "$host:$port", $realm, $username => $password ] ) ->on_action( sub { my $action = sprintf( '%s$serviceInterface/%s', @_ ); print( "action: '$action' " ); return $action; } ); my $response = $service->MyServiceFunction() In your case, you seem to want the action to be: urn:sdp:manager:100818.ProfileScopeServiceContract.ProcessMessage, so you should probably be able to just use: ... ->on_action( 'urn:sdp:manager:100818.ProfileScopeServiceContract.ProcessMessage' ) ... Perl the pom documentation: on_

Categories : Wcf

How to query SOAP based endpoint using Spring WS by passing pre generated SOAP Request instead of XML payload?
You can do the following: ClientMessageCallBack _callBack = new ClientMessageCallBack("yournamespaceuri/operationx"); final String _message = "<ns1:operationx xmlns:ns1="yournamespaceuri"></ns1:operationx>"; StreamSource _source = new StreamSource(new StringReader(_message)); // the result will be output in the console StreamResult _result = new StreamResult(System.out); // suppose you have a reference to webServiceTemplate webServiceTemplate.sendSourceAndReceiveToResult(_source,_callBack, _result);

Categories : Spring

Inspect SOAP message with SOAP Handler without making configuration
No it is not possible. Think about this logically. If your service does not make any call, does not create any objects (i.e. does not reference it the library in any way) then no code from that library will be run and therefore it will not be able to do anything. Using the message handler is the most minimalistic and least intrusive way I have found (and it is the way I do it) do handle such problem.

Categories : Java

Exporting a logging properties file from Solr logging level editor
The settings are not persistent and just modified dynamically at runtime. So you have to set the log levels accordingly into the log properties and use it. LogLevelSelection class handles change in the log levels and sets the level. Relevant code :- Logger logger; LogManager logManager = LogManager.getLogManager(); if ("root".equals(name)) { logger = logManager.getLogger(""); } else logger = logManager.getLogger(name); if ("unset".equals(value)) { if ((logger != null) && (logger.getLevel() != null)) { logger.setLevel(null); log.info("Unset log level on '" + name + "'."); } } else { Level level = Level.parse(value); if (logger == null) logger = Logger.getLogger(name); if (logger.getLevel() != level) {

Categories : Solr

centralized logging method and logging current line number
You can use the inspect package to find the calling line of code. I use this method to mark a function as deprecated and then track down the callers (in your unit tests of course). You can adjust to your logging needs. Tattletale logging In the file that will log (a.py): import logging # of course you have this import inspect # some lines to set logger log = logging.getLogger('some_loger') log.addHandler(logging.StreamHandler()) class SomeClass: def log_it(self, log_text): log.warn("DEPRECATION WARNING: {0[3]} was called from {1[3]} at line {1[2]} in {1[1]}".format(*inspect.stack()[:2])) In the "child" file (b.py): from a import SomeClass class MyOtherClass(SomeClass): def some_method(self): self.log_it('let me log this text')~ b = MyOtherClass() b.so

Categories : Python

PHP/SOAP: How can UserCredentials be passed to SOAP request?
You are nearly there, this line: $header = new SoapHeader($ns,'UserCredentials',$soapParameters,false); Already creates the UserCredentials node, so this line: $soapParameters = array('UserCredentials'=>array('userName' => $username, 'password' => $password)); Can/Should be: $soapParameters = array('userName' => $username, 'password' => $password); Which gives you an empty response, because of the way you call the function, you have two possible ways: //1. add an extra array around params $soapClient->__soapCall($soapFunction, array($soapFunctionParameters)); //2. or call like this: $soapClient->$soapFunction($soapFunctionParameters); (Which still gives me an empty response, but I would think that's because I have no valid credentials, which is a thing to l

Categories : PHP

ServiceStack Soap Retrieve Soap Headers
In the latest version of ServiceStack v3.9.49 you can access the Request SOAP Message (for SOAP Requests) using the IHttpRequest.GetSoapMessage() extension method, e.g: public class NotificationServices : Service { public GetAccountNotificationResponse Any (GetAccountNotification request) { //Do Some stuff Here!!! var requestSoapMessage = base.Request.GetSoapMessage(); } } From the Serialization / Deserialization wiki: You can access raw WCF Message when accessed with the SOAP endpoints in your Service with IHttpRequest.GetSoapMessage() extension method, e.g: Message requestMsg = base.Request.GetSoapMessage(); To tell ServiceStack to skip Deserializing the SOAP request entirely, add the IRequiresSoapMessage interface to your Request DTO, e.g: public cl

Categories : C#

Error with Soap :SOAP body does not match
Can you make these two changes in your code? Try to change String URL = "http://202.122.131.25/EISDatagetDB"; to String URL = "http://57.59.36.25:80/EISDatagetDB"; because the endpoint address is indicated in element <wsdlsoap:address location="http://57.59.36.25:80/EISDatagetDB"/>

Categories : Android

Logging different project libraries, with a single logging library
Instead of writing to the file at each logged message (which is the source of your slow down), you could write your log messages to the Logger Library's ScriptDB instance and add a .write() method to your logger that will output the messages in one go. Your logger constructor can take a messageGroup parameter which can serve as a unique identifier for the lines you would like to write. This would also allow you to use different files for logging output. As you build your messages into proper output to write to the file (don't write each line individually, batch operations are your friend), you might want to remove the message from the ScriptDB. However, it might also be a nice place to pull back old logs. Your message object might look something like this: { message: "My message", c

Categories : Google Apps Script

Zend SOAP Server SOAP-ERROR:Parsing WSDL: Couldn't load from 'X' : failed to load external entity 'X"
I think the problem is in your controller, first your $_URI must be $_URI = "http://testws.localhost/album"; (i.e. with the http schema). second you are passing the wrong argument to AutoDiscover, the first argument of the AutoDiscover is not the url, try replacing your handleWSDL method with this: private function handleWSDL() { $autodiscover = new AutoDiscover(); $autodiscover->setClass('Soaptest') ->setUri($this->_URI); $autodiscover->handle(); }

Categories : PHP

what is soap in magento? what is use of it?what is use of soap/xml-RPC-user?
The original Magento API was implemented both in SOAP and XML-RPC. SOAP and XML-RPC are well known technologies for creating functions, classes, and methods client-programmers may call over HTTP. Explaining them in greater detail is beyond the scope of a Stack Overflow question. The User and Roles menus are the for the authentication portion of the Magento API. To authenticate the API, you call a login method, passing in a username and password. You setup this user name and password in the Users menu you mentioned. Each user you setup has access to a "role". Roles determine which API functions a user may call. You setup the roles in the Roles menu you mentioned. You assign a role to a User when you're editing it in the User section you mentioned. In newer versions of Magento these

Categories : Magento

Categorizing the logging in enterprise logging c#
I normally use System.Diagnostics.EventLogEntryType for this. It gives you the following enums: EventLogEntryType.Error; EventLogEntryType.FailureAudit; EventLogEntryType.Information; EventLogEntryType.SuccessAudit; EventLogEntryType.Warning;

Categories : C#

Logging to file vs. Logging to Database
so that users connected to the task can know who has done which changes This changes the data in question from system-level logging to application-visible data. As such, it probably belongs in the application's database. This will also make it a lot easier to filter the log data for display. For example, if you want to show all historical events for Item X then you can easily query a database table which has a foreign key relationship to the Items table. Reading in that data from a file and filtering it manually would be unnecessarily difficult. Side note: "audit data" or perhaps "history data" might be a better term, to distinguish it from system logging such as error logs.

Categories : Mysql

Causes of MySQL error 2014 Cannot execute queries while other unbuffered queries are active
I am hoping for a better answer than the following. While some of these solutions might "fix" the problem, they don't answer the original question regarding what causes this error. Set PDO::ATTR_EMULATE_PREPARES=>true (I don't wish to do this) Set PDO::MYSQL_ATTR_USE_BUFFERED_QUERY (didn't work for me) Use PDOStatement::fetchAll() (not always desirable) Use $stmt->closeCursor() after each $stmt->fetch() (this mostly worked, however, I still had several cases where it didn't) Change PHP MySQL library from php-mysql to php-mysqlnd (probably what I will do if no better answer)

Categories : PHP

Is it possible to combine MySQL queries to multiple tables into a single query based on the results from one of the queries?
You want to look at MySQL Joins. I think this may do something like what you're after, but it will almost definitely need debugging! SELECT DISTINCT s.ownerid, s.message FROM statusupdates s LEFT JOIN friends f ON ($userid = f.requestfrom) LEFT JOIN friends f ON ($userid = f.requestto) ORDER BY s.createddate;

Categories : PHP

externalize hibernate queries or sql queries in properties file in spring
If I understood right, it sounds like regular Spring usage. You may have a class like: class userDao { String findActiveUsers; //... Getters and Setters public List<User> findActiveUsers() { return getCurrentSession().createQuery(findActiveUsers).list(); } } So, your application context would look like: <bean id="userDao" class="my.package.UserDao"> <property name="findActiveUsers" value="FROM User u WHERE u.active=true"/> </bean>

Categories : Java

'PDOException' with message 'SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active
Took a bit of fiddling, but I found that when I took the ATTR_EMULATE_PREPARES=false out (the default is to emulate), it worked: <?php $db = new PDO ($cnstring, $user, $pwd); $db->setAttribute (PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); //$db->setAttribute (PDO::ATTR_EMULATE_PREPARES, false); $db->setAttribute (PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); $st = $db->query ("CREATE TRIGGER `CirclesClosureSync` AFTER INSERT ON Circles FOR EACH ROW BEGIN INSERT INTO CirclesClosure (ancestor, descendant) SELECT ancestor, NEW.ID from CirclesClosure WHERE descendant=NEW.Parent; INSERT INTO CirclesClosure (ancestor, descendant) values (NEW.ID, NEW.ID); END;"); $st->closeCursor(); ?> Hope this helps someone

Categories : PHP

mssql multiple queries insert queries and results
I think that you are talking about an OUTPUT clause from the insert statement. http://msdn.microsoft.com/en-us/library/ms177564.aspx CREATE TABLE #t (id int identity (1, 1), f1 nvarchar(20 ) ) --the table that has the identities CREATE TABLE #ids ( id int ) --the table to store the inserts into table #t INSERT INTO #t ( f1 ) OUTPUT INSERTED.id INTO #ids SELECT N'AAAA' INSERT INTO #t ( f1 ) OUTPUT INSERTED.id INTO #ids SELECT N'BBBB' INSERT INTO #t ( f1 ) OUTPUT INSERTED.id INTO #ids SELECT N'CCCC' SELECT * FROM #t SELECT * FROM #ids Another way is to use @@IDENTITY or SCOPE_IDENTITY() SQL Authority link discussing/comparing them CREATE TABLE #t (id int identity (1, 1), f1 nvarchar(20 ) ) CREATE TABLE #ids ( id int ) INSERT INTO #t ( f1 ) SELECT N'AAAA' INSERT INTO #ids SELECT @@ID

Categories : Sql Server

Generate UPDATE queries from results of SELECT queries
The closest thing in pgAdmin is the query tool (see http://www.pgadmin.org/docs/1.16/query.html). This would not take your select statements and turn them into queries, but you can graphically build queries if you don't want to parse and concatenate. If this is going to be a big, repetitive task, I would look at writing a Perl script to parse a query and rewrite it as needed. This would require some inside knowledge. It isn't clear what you want to do regarding updating the values so you'd have to design your solution around that. More likely you would want to write a functional API (a UDF) to do what you want, and then write calls to that, probably not in a config file directly (since it is not clear you can trust that) but through an interface.

Categories : Postgresql

SOAP over HTTP and SOAP over JMS
Consider using SOAP over HTTP for: Externally facing web services (e.g. customers or suppliers) For simple point-to-point and stateless services Where you need a thin client with no MOM installations Consider using SOAP over JMS for: High-volume distributed messaging Asynchronous messaging Where a transaction boundary is needed in the middleware Where the message consumers are slower than the producers Guaranteed deliver and/or only once delivery of messages Publish/subscribe Distributed peer systems that might at times be disconnected source SOAP over JMS examples: IBM, TIBCO, JBoss

Categories : Web Services

Python: How to distinguish logging of python and a custom package "logging"
First of all, I'm not sure that method of importing is fully supported and is against the PEP8 standard. The correct way (assuming you want to keep the package out of your path) is: import sys sys.path.append('path/to/custom/module/dir') import logging However, to then solve your issue you will want to "rename" the module on import by replacing that last line with: import logging as foo #system logging sys.path.append('path/to/custom/module/dir') import logging as bar #your module The easiest and cleanest solution though, would be to just rename your module.

Categories : Python

FINE logging not logging
replace log4j.rootLogger=FINE, stdout with log4j.rootLogger=TRACE, stdout And check here: http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html and http://logging.apache.org/log4j/1.2/manual.html The second link says: Loggers may be assigned levels. The set of possible levels, that is: TRACE, DEBUG, INFO, WARN, ERROR and FATAL

Categories : Java

Where should I do database queries and why am I not getting the results of the queries?
That's because the asynchronous nature of Node. Everything that has networking involved (DB queries, webservices, etc) is async. Because of this, you should refactor your selectalldate() method to accept an callback. From that callback you'll be able to render your template successfully with the data fetched from the DB. In the end, it'll be something like this: exports.selectalldate = function(callback) { connection.query('SELECT * FROM date', function (err, rows, fields) { if(rows.length > 0) { for(i = 0; i < rows.length; i ++) { rows[i].date = dateFormat(rows[i].date, "yyyy-mm-dd") } } callback(err, rows); }); } app.get('/dashboard', function(req, res) { db.selectalldate(function(err, datee) { if (err) { // Handle the error in s

Categories : Node Js

Optimizing sub-queries, making two queries become one
The main thing you seem to be checking is the last name with a leading % in the like. This renders the index on that column useless, and your SQL is searching for it twice. I am not 100% sure what you are trying to do. Your SQL appears to get all the members who match on name to the one required, then get the last registration_history record for those. The one you get could be from any one of the matching members, which seems strange unless you only ever expect to get a single member. If this is the case the following minor tidy (removing and IN and changing it to a JOIN) up will possibly slightly improve things. SELECT COALESCE(NULLIF(Registration_History.RegYear, ''), NULLIF(Registration.Year, '')) AS RegYear, COALESCE(NULLIF(Registration_History.RegNumber, ''), NULLIF(Registr

Categories : Mysql

How to use a logging.properties file from disk as a java.util.logging.properties file
You could try this: String yourFilePath = "./yourLogProperties.properties"; LogManager.getLogManager().readConfiguration(new FileInputStream(yourFilePath); Properties will be loaded from a file stored in the same folder which your app is executed. Update: I was searching a little bit how to pass properties thru command line and there's a pretty good explanation here. So, in your case you'll need something like this: java -jar -Djava.util.logging.config.file="./yourLogProperties.properties" YourApp.jar Also you can test if it works making a simple test: public class Tests { public static void main(String[] args) { System.out.println(System.getProperty("java.util.logging.config.file")); } } Running this from command line you should get the answer ./yourLogP

Categories : Java

Cannot use JPA in Glassfish v4
You have two persistence.xml both at incorrect location : META-INF/persistence.xml WEB-INF/classes/persistence.xml The correct location relative to your war package root is WEB-INF/classes/META-INF/persistence.xml Avoid the ambiguity, do not place more than 1 persistence.xml. Also if you use maven you have to put persistence.xml on src/main/resources to have it assembled at the correct location on the war

Categories : Java

Java EE EJB 3.0 Glassfish
As Java EE 6 comes with different profiles (i.e. Web/Lite profile and Full) not all functionality is supported in the Web/Lite profile. Especially the web profile only supports "EJB Lite" which comes without support for asynchronous EJBs have a look at the following article which comes with a table describing the features in EJB Lite and 'regular' EJB So what you'd have to do is create a project with the full profile in Netbeans. This will give you access to @Asynchonous.

Categories : Java

Arquillian with Glassfish V4
Latest 3.1 container adapter (CR4) should work with 4.x without any problems, as indicated on this blog entry.

Categories : Java

how to install ssl on glassfish 3.1.2.2
This configuration works for me: (on the SSL tab of http-listener-2) SSL3 - [enabled] TLS - [enabled] Client Authentication - [enabled] Certificate NickName: s1as Key Store: [empty] Trust Algorithm: [empty] Max Certificate Length: 5 Trust Store: [empty] Cipher Suites: [all selected] Hope it helps.

Categories : Java

jsf 2.2 not supported on glassfish 3.1.2?
You can manually update the .jar file located at the Glassfish's /modules directory. More information: How do I upgrade Glassfish JSF api?

Categories : JSF

GlassFish Quandary
The 404 error is the HTTP page not found error. This means, the page you are trying to access does not exist. I believe your application is not deployed on the server. To deploy your application, go to server admin page localhost:4848 click on application from the navigation menu. From there click on Deploy and browse to the file location. You can also specify the context root where your application should be deployed. However, your application might be deployed on the server with a different context root. If you have a glassfish descriptor, then you can check your context root from there. However, If you do not have a glassfish descriptor then you need to create one. In this descriptor you need to define your context root name. <context-root>/foobar</context-root> this

Categories : Java

Does Glassfish v4 support SSL SNI?
According to the Glassfish 4 security guide, https://glassfish.java.net/docs/4.0/security-guide.pdf, there is NOT support for SNI. However, it's generally bad practice IMO (though still debated by many), to expose Glassfish directly to the internet. I usually solve this problem by running an Apache server with mod_ajp_proxy, connected to a jk-listener on Glassfish.

Categories : Ssl



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.